def start_listening(): import dbus from dbus.mainloop.pyqt5 import DBusQtMainLoop DBusQtMainLoop(set_as_default=True) bus = dbus.SystemBus() # Function which will run when signal is received def callback_function(*args): print('Received something .. ', args) # Which signal to have an eye for iface = 'org.freedesktop.DBus.ObjectManager' signal = 'InterfacesAdded' bus.add_signal_receiver(callback_function, signal, iface) # Let's start the loop from PyQt5.QtCore import QObject QObject.thread()
def debug_object(obj: QObject) -> None: log.debug("Object {} belongs to QThread {}".format(obj, obj.thread()))