Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51928

In pyqt, some signals seems not work well

From Jacknaruto <naruto0.1@live.cn>
Subject In pyqt, some signals seems not work well
Date 2013-08-05 00:06 +0800
Newsgroups comp.lang.python
Message-ID <mailman.183.1375632477.1251.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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?

            
     		 	   		  

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

In pyqt, some signals seems not work well Jacknaruto <naruto0.1@live.cn> - 2013-08-05 00:06 +0800

csiph-web