[Twisted-Python] Twisted with PyQt
Hi, i am using qt4reactor with twisted. My app structure is below: i have pyqt class class MainWindow(Object): bla bla bla from twisted.internet import reactor reactor.connectTCP('192.168.1.100', 8000, ClientFactory_(self)) # i am sending qt object to clientFactory class ClientFactory_(ClientFactory): def __init__(self,ui): self.ui = ui def buildProtocol(self, addr): return Uploader(self.ui) bla bla class Uploader(Protocol): def __init__(self,ui): self.ui = ui """ Some upload stuffs""" bla bla bla def updateProgressBar(self, newValue): self.ui.progressBar.setValue(newValue) i am updating my progressBar from Upload class, but window is freezing when i do it (only progressBar isnot, others are freezing when i upload file). How can i solve this, how can i design it? Thanks all.. -- Aydın ŞEN Ege Üniversitesi Uluslararası Bilgisayar Enstitüsü
On Tue, 2 Dec 2008 14:29:54 +0200, Aydın ŞEN
Hi, i am using qt4reactor with twisted. My app structure is below:
i have pyqt class
[snip]
i am updating my progressBar from Upload class, but window is freezing when i do it (only progressBar isnot, others are freezing when i upload file). How can i solve this, how can i design it?
You've probably omitted too many details for anyone to know what is causing the problem or make a suggestion about how to fix it. Try posting a complete, minimal example which demonstrates the problem so that others can reproduce it themselves. Jean-Paul
Hi,
Actuallly i solved my problem but i have another one. I am sending file in
while loop, as you said before it doesnt send data pyhshically, i am
updating my progressBar in while loop, so the progressBar is being updated
before data being sent..
Is there any signal that self.transport.write() creates when data "really"
sent? May be i can update my progressBar with that signal..
Thanks..
-adige-
2008/12/2 Jean-Paul Calderone
On Tue, 2 Dec 2008 14:29:54 +0200, Aydın ŞEN
wrote: Hi, i am using qt4reactor with twisted. My app structure is below:
i have pyqt class
[snip]
i am updating my progressBar from Upload class, but window is freezing when i do it (only progressBar isnot, others are freezing when i upload file). How can i solve this, how can i design it?
You've probably omitted too many details for anyone to know what is causing the problem or make a suggestion about how to fix it. Try posting a complete, minimal example which demonstrates the problem so that others can reproduce it themselves.
Jean-Paul
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- Aydın ŞEN Ege Üniversitesi Uluslararası Bilgisayar Enstitüsü
On 11:13 am, adigeaydin@gmail.com wrote:
Hi, Actuallly i solved my problem but i have another one. I am sending file in while loop, as you said before it doesnt send data pyhshically, i am updating my progressBar in while loop, so the progressBar is being updated before data being sent..
Is there any signal that self.transport.write() creates when data "really" sent? May be i can update my progressBar with that signal..
Sort of. You shouldn't call transport.write() in a loop, you should register a producer for the transport and call transport.write when it's ready. Documentation is here: http://twistedmatrix.com/projects/core/documentation/howto/producers.html
Yes, the point is Producer, i solved my problem.
Thanks all.
-adige-
2008/12/3
On 11:13 am, adigeaydin@gmail.com wrote:
Hi, Actuallly i solved my problem but i have another one. I am sending file in while loop, as you said before it doesnt send data pyhshically, i am updating my progressBar in while loop, so the progressBar is being updated before data being sent..
Is there any signal that self.transport.write() creates when data "really" sent? May be i can update my progressBar with that signal..
Sort of. You shouldn't call transport.write() in a loop, you should register a producer for the transport and call transport.write when it's ready. Documentation is here: http://twistedmatrix.com/projects/core/documentation/howto/producers.html
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- Aydın ŞEN Ege Üniversitesi Uluslararası Bilgisayar Enstitüsü
participants (3)
-
Aydın ŞEN
-
glyph@divmod.com
-
Jean-Paul Calderone