[PyKDE] PyQt dbus doesn't work with HAL

Kovid Goyal kovid at theory.caltech.edu
Thu Jan 11 17:27:01 GMT 2007


Nice catch. It works if I create the QApplication before the mainloop. There 
are also no warnings from QSocketNotifier.

Thanks,

Kovid.

On Thursday 11 January 2007 01:01, Phil Thompson wrote:
> 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
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>
> !DSPAM:2,45a5fd8a24221328276924!

-- 
_____________________________________

Kovid Goyal  MC 452-48
California Institute of Technology
1200 E California Blvd
Pasadena, CA 91125

home  : +01 626 390 8699
office: +01 626 395 6595 (449 Lauritsen)
email : kovid at theory.caltech.edu
web   : http://www.kovidgoyal.net
_____________________________________




More information about the PyQt mailing list