[PyKDE] twisted and PyQt4
scalet at yebu.de
scalet at yebu.de
Fri Jun 2 09:37:38 BST 2006
Hi Toby,
> On Thursday 01 June 2006 11:24, scalet at yebu.de wrote:
>> just for the record,
>>
>> I got some replies on the twisted mailing list, now
>> they have an experimatal reactor for pyqt4 in there
>> tracking system:
>>
>> http://twistedmatrix.com/trac/ticket/1770
>>
>> I used it and it worked fine, so far
>
> Im not sure which platform you are using, but Ive never had much success
> with
here Windows, too
> this approach on Windows. Your main thread normally spends its time
> running
> the Qt main loop, however on Windows it is quite legitimate for library
> functions to briefly run their own message loop. Examples include standard
> dialog boxes (file chooser, font chooser etc), MessageBox, and
I do not have any like problems, since I use qt in a very special
(embedded) environment. No real qt-dialogs (but simulating my own),
no message-boxes, not even mouse-handling, just hard-key handling.
But the problems you describe interested me, and so I did setup a
message box. When this box comes up, incoming network traffic is
processed normally (I got cyclic data packet into my app), only
if I _click_ into the caption bar on top of the message box, traffic
processing stops as long as mouse button one is pressed. And that is
bad.
BUT: Doesn't that mean, that twisted's asynchronous one-loop-only,
single-threaded model in combination with _any_ graphical user
interface (not just qt's) does not make that much sense.
(Again: this should better be addressed to twisted's list / twisted
experts)
> cross-process
> COM method calls. This will cause your twisted reactor to stop processing
> twisted events until control returns to the Qt message loop.
>
> One alternative approach which does integrate well with these secondary
> message loops is Twisted's ThreadedSelectReactor. (I forget whether this
> is
> released now, or whether you need to grab it from SVN).
I did not look into that yet, but at first it seems, that the major advantage
of twisted's model (avoiding the hassle to synchronize between network-
thread and gui-thread) is gone then.
Karl
More information about the PyQt
mailing list