[PyKDE] PyQt dbus doesn't work with HAL

Phil Thompson phil at riverbankcomputing.co.uk
Thu Jan 11 09:01:48 GMT 2007


On Thursday 11 January 2007 4:28 am, Kovid Goyal wrote:
> Hi,
>
> I've been testing dbus.mainloop.qt with HAL. With the glib mainloop my code
> receives HAL signals, with the Qt mainloop it does not. THis is with
> dbus-pythun-0.80rc3 and the latest PyQt4 snapshot.
>
> Here's the test code
> import dbus, sys
> import dbus.mainloop.qt
> from PyQt4.Qt import QApplication
>
> def handle_signal(*args):
>   print 'received signal:', args
>
> dbus.mainloop.qt.DBusQtMainLoop(set_as_default=True)
> bus = dbus.SystemBus()
> bus.add_signal_receiver(handle_signal, None, None, None)
>
> app = QApplication(sys.argv)
> app.exec_()
>
>
> The output I get is
> QSocketNotifier: Can only be used with threads started with QThread
> QSocketNotifier: Can only be used with threads started with QThread
> received signal: (dbus.String(u':1.32'),)
>
> But plugging in a USB device doesn't generate a signal. The same code with
> the glib mainloop does receive a signal.

Is there any difference if you create the QApplication before the mainloop?

Phil




More information about the PyQt mailing list