grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a 8g+^îã@s”dZddlmZddlmZddlmZddlmZddlZddlmZGdd „d e ƒZ Gd d „d e ƒZ d d „Z Gdd„de ƒZ Gdd„de ƒZdS)z• pyudev._qt_base =============== Base mixin class for Qt4,Qt5 support. .. moduleauthor:: Sebastian Wiesner é)Úabsolute_import)Údivision)Úprint_function)Úunicode_literalsN)ÚDevicec@sBeZdZdZdd„Zedd„ƒZejdd„ƒZdd„Zd d „Z d S) ÚMonitorObserverMixinz0 Base mixin for pyqt monitor observers. cCs2||_|| ¡|j|ƒ|_|jjt |j¡dS©N)ÚmonitorÚfilenoZReadÚnotifierZ activatedÚintZconnectÚ_process_udev_event)Úselfr Únotifier_class©rú3/usr/lib/python3.9/site-packages/pyudev/_qt_base.pyÚ_setup_notifier+s  ÿz$MonitorObserverMixin._setup_notifiercCs |j ¡S)aY Whether this observer is enabled or not. If ``True`` (the default), this observer is enabled, and emits events. Otherwise it is disabled and does not emit any events. This merely reflects the state of the ``enabled`` property of the underlying :attr:`notifier`. .. versionadded:: 0.14 )r Z isEnabled)rrrrÚenabled1s zMonitorObserverMixin.enabledcCs|j |¡dSr)r Z setEnabled)rÚvaluerrrr?scCs$|jjdd�}|dur | |¡dS)zê Attempt to receive a single device event from the monitor, process the event and emit corresponding signals. Called by ``QSocketNotifier``, if data is available on the udev monitoring socket. r)ÚtimeoutN)r ZpollÚ _emit_event©rÚdevicerrrr Csz(MonitorObserverMixin._process_udev_eventcCs|j |¡dSr)Ú deviceEventÚemitrrrrrOsz MonitorObserverMixin._emit_eventN) Ú__name__Ú __module__Ú __qualname__Ú__doc__rÚpropertyrÚsetterr rrrrrr$s   rc@s eZdZdZdd„Zdd„ZdS)ÚQUDevMonitorObserverMixinz* Obsolete monitor observer mixin. cCs>t |||¡|j|j|j|jdœ|_ddl}| dt ¡dS)N)ÚaddÚremoveZchangeÚmoverzAWill be removed in 1.0. Use pyudev.pyqt4.MonitorObserver instead.) rrÚ deviceAddedÚ deviceRemovedÚ deviceChangedÚ deviceMovedÚ_action_signal_mapÚwarningsÚwarnÚDeprecationWarning)rr rr*rrrrZsüþz)QUDevMonitorObserverMixin._setup_notifiercCs4|j |j|¡|j |j¡}|dur0| |¡dSr)rrÚactionr)Úget)rrÚsignalrrrrgsz%QUDevMonitorObserverMixin._emit_eventN)rrrrrrrrrrr!Ss r!csd‡‡fdd„ }|S)a Generates an initializer to observer the given ``monitor`` (a :class:`~pyudev.Monitor`): ``parent`` is the parent :class:`~PyQt{4,5}.QtCore.QObject` of this object. It is passed unchanged to the inherited constructor of :class:`~PyQt{4,5}.QtCore.QObject`. Ncsˆ ||¡| |ˆ¡dSr)Ú__init__r)rr Úparent©ÚqobjectÚsocket_notifierrrr0xs zmake_init..__init__)Nr)r3r4r0rr2rÚ make_initns r5c@seZdZdZedd„ƒZdS)ÚMonitorObserverGeneratorú4 Class to generate a MonitorObserver class. cCs.ttdƒ|tftdƒt||ƒtdƒ|tƒiƒS)aGenerates an observer for device events integrating into the PyQt{4,5} mainloop. This class inherits :class:`~PyQt{4,5}.QtCore.QObject` to turn device events into Qt signals: >>> from pyudev import Context, Monitor >>> from pyudev.pyqt4 import MonitorObserver >>> context = Context() >>> monitor = Monitor.from_netlink(context) >>> monitor.filter_by(subsystem='input') >>> observer = MonitorObserver(monitor) >>> def device_event(device): ... print('event {0} on device {1}'.format(device.action, device)) >>> observer.deviceEvent.connect(device_event) >>> monitor.start() This class is a child of :class:`~{PySide, PyQt{4,5}}.QtCore.QObject`. ZMonitorObserverr0r)ÚtypeÚstrrr5r©r3r/r4rrrÚmake_monitor_observer†s   þÿz.MonitorObserverGenerator.make_monitor_observerN©rrrrÚ staticmethodr;rrrrr6€sr6c@seZdZdZedd„ƒZdS)ÚQUDevMonitorObserverGeneratorr7cCsbttdƒ|tftdƒt||ƒtdƒ|tjtƒtdƒ|tƒtdƒ|tƒtdƒ|tƒtdƒ|tƒiƒS)aGenerates an observer for device events integrating into the PyQt{4,5} mainloop. This class inherits :class:`~PyQt{4,5}.QtCore.QObject` to turn device events into Qt signals: >>> from pyudev import Context, Monitor >>> from pyudev.pyqt4 import MonitorObserver >>> context = Context() >>> monitor = Monitor.from_netlink(context) >>> monitor.filter_by(subsystem='input') >>> observer = MonitorObserver(monitor) >>> def device_event(device): ... print('event {0} on device {1}'.format(device.action, device)) >>> observer.deviceEvent.connect(device_event) >>> monitor.start() This class is a child of :class:`~{PyQt{4,5}, PySide}.QtCore.QObject`. ZQUDevMonitorObserverr0rr%r&r'r()r8r9r!r5ÚsixZ text_typerr:rrrr;©s" ïýz3QUDevMonitorObserverGenerator.make_monitor_observerNr<rrrrr>£sr>)rZ __future__rrrrr?Z pyudev.devicerÚobjectrr!r5r6r>rrrrÚs     /#