views:

55

answers:

1

Hi all.

I've a django application, served via Twisted, which also serves ohter services (three sockets, mainly).

I need to have it working under windows, and I decide to write a PyQt4 application which acts quite like Apache Service Monitor for windows.

I was not able to connect twisted reactor to pyqt application reactor, so any hint on this will be welcome too.

Now I've this kind of architecture:

  • QMainWindow which, in __ init __() has the log.addObserver(callBack) function, and the widget.
  • Twisted initializer class which extends QtCore.QThread and works in a different thread.
  • the django app which runs over Twisted.

I need to understand how to run the reactor, becouse calling reactor.start() from QtCore.QThread works not at all, giving me:

exceptions.ValueError: signal only works in main thread

Also I'm asking your opinion on the design of applications, does it makes sense for you?

+1  A: 

I'm not sure I totally understand your design but what I can say is that you need to use only one reactor in an application. The reactor is the main (event) loop of the application. And, I think, this reactor should be the QTReactor in your case.

Etienne
That's true, but I have not been able to have it running.
Enrico Carlesso
One thing is that you should use `reactor.run()` to start the reactor (and not `reactor.start()`. Are you able to run the *QT reactor demo* from the link I have post? If yes, I would say, base your design from this demo.
Etienne
That demo is for qt3, not for qt4, sadly.
Enrico Carlesso
Do you know/use this one: http://github.com/ghtdak/qtreactor ?
Etienne
That github project is the right way (imho). I'll follow the hint.
Enrico Carlesso