In pyqt, some signals seems not work well

Jacknaruto naruto0.1 at live.cn
Sun Aug 4 12:06:46 EDT 2013


Hi, Guys!
I created a thread class based QThread, and defined some signals to update UI through main thread.
the UI used a stackedWidget,someone page named 'progressPage' have a progressBar and a Label, the next page named 'resultsPage' shows results(some Labels).
When the window showed progressPage, my code that updates progressBar was well, but the updating resultsPage's labels signals seems ignored by main thread.(I guess, because I added some prints in the slot, it wasn't printed)
the code like this:class worker(QtCore.QThread):    sig_jump_finish_page = QtCore.pyqtSignal()    sig_set_label_text = QtCore.pyqtSignal(str,  str)    sig_set_progress_value = QtCore.pyqtSignal(int)
    for dirpath,  dirnames, filenames  in os.walk(self.root):        for filename in filenames:            self.sig_set_label_text.emit('current', self.current())   # work well            # so something
    #self.dialog.set_found(str(self.found()))  # work well    #self.dialog.set_all(str(self.total()))  # work well    self.sig_set_label_text.emit('found',  str(self.found()))  # :(    self.sig_set_label_text.emit('all',  str(self.total()))   # :(
    self.sig_jump_finish_page.emit()
So I have to update UI directly in the thread(comments Line 11-12 shows), it looks work well.
I found the difference between line 8 and line 13-14 is line 8 manipulates current page -progressPage, line 13-14 manipulates next page -resultsPage.
Is some wrongs in there?

            
     		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130805/14853e4c/attachment.html>


More information about the Python-list mailing list