logitech_receiver: Remove GDK dependency
This commit is contained in:
parent
ea0eb66f39
commit
8fb087be14
|
|
@ -23,6 +23,7 @@ import dataclasses
|
|||
import logging
|
||||
import struct
|
||||
import threading
|
||||
import typing
|
||||
|
||||
from contextlib import contextmanager
|
||||
from random import getrandbits
|
||||
|
|
@ -42,6 +43,7 @@ from . import hidpp20_constants
|
|||
from .common import LOGITECH_VENDOR_ID
|
||||
from .common import BusID
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
gi.require_version("Gdk", "3.0")
|
||||
from gi.repository import GLib # NOQA: E402
|
||||
|
||||
|
|
@ -178,9 +180,15 @@ def receivers_and_devices():
|
|||
yield from hidapi.enumerate(filter)
|
||||
|
||||
|
||||
def notify_on_receivers_glib(callback):
|
||||
"""Watch for matching devices and notifies the callback on the GLib thread."""
|
||||
return hidapi.monitor_glib(GLib, callback, filter)
|
||||
def notify_on_receivers_glib(glib: GLib, callback):
|
||||
"""Watch for matching devices and notifies the callback on the GLib thread.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
glib
|
||||
GLib instance.
|
||||
"""
|
||||
return hidapi.monitor_glib(glib, callback, filter)
|
||||
|
||||
|
||||
def open_path(path):
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ def setup_scanner(status_changed_callback, setting_changed_callback, error_callb
|
|||
_status_callback = status_changed_callback
|
||||
_setting_callback = setting_changed_callback
|
||||
_error_callback = error_callback
|
||||
base.notify_on_receivers_glib(_process_receiver_event)
|
||||
base.notify_on_receivers_glib(GLib, _process_receiver_event)
|
||||
|
||||
|
||||
def _process_add(device_info, retry):
|
||||
|
|
|
|||
Loading…
Reference in New Issue