[Twisted-Python] Running a GUI application based on PyQt

Hi, I'm trying to use a simple application based in twisted.internet.Protocol with PyQt4. PyQt has its own way of dealing with events, I've tried to run the reactor in a thread, but it says it only can acquire SIGINT from the main thread :( I've tried the code posted in qt4reactor.py but it doesn't work. It fails telling that a reactor's been already installed. Is it possible to use PyQt4 (v.4.4) with twisted? Thanks Nahuel

On Mon, Nov 24, 2008 at 8:37 AM, Nahuel Defossé <nahueldefosse@yahoo.com.ar>wrote:
Hi, I'm trying to use a simple application based in twisted.internet.Protocol with PyQt4. PyQt has its own way of dealing with events, I've tried to run the reactor in a thread, but it says it only can acquire SIGINT from the main thread :(
Hi Nahuel, I don't have any way of testing qt4reactor.py easily, but if you run your reactor in a separate thread, make sure to instruct twisted not to install its signal handlers with a: reactor.run(installSignalHandlers=0) Hope that helps, Reza -- Reza Lotun Senior Software Engineer GetPeer Limited reza@getpeer.com

On Mon, 2008-11-24 at 06:37 -0200, Nahuel Defossé wrote:
I've tried the code posted in qt4reactor.py but it doesn't work. It fails telling that a reactor's been already installed. Is it possible to use PyQt4 (v.4.4) with twisted?
Only import "twisted.internet.reactor" *after* you've installed qt4reactor. Importing auto-installs reactor if one hasn't already been installed.

Thanks both quick and helpful responses! I was messing with the order, but finally it worked, though I've just tested a very basic piece of code. The non-threading nature in a pyqt app sacres me a bit, but I hope it's temporal :) Now it's time for me to merge the whole thing, sqlalchemy via sAsync, my protocol and the GUI. Regards El Monday 24 November 2008 11:28:18 Itamar Shtull-Trauring escribió:
On Mon, 2008-11-24 at 06:37 -0200, Nahuel Defossé wrote:
I've tried the code posted in qt4reactor.py but it doesn't work. It fails telling that a reactor's been already installed. Is it possible to use PyQt4 (v.4.4) with twisted?
Only import "twisted.internet.reactor" *after* you've installed qt4reactor. Importing auto-installs reactor if one hasn't already been installed.
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
participants (3)
-
Itamar Shtull-Trauring
-
Nahuel Defossé
-
Reza Lotun