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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <naruto0.1@live.cn>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:not': 0.03; 'ignored': 0.07; 'filename': 0.09; 'filenames': 0.09; 'filenames:': 0.09; 'guys!': 0.09; 'label,': 0.09; 'skip:# 30': 0.09; 'thread': 0.14; 'dirnames,': 0.16; 'dirpath,': 0.16; 'str)': 0.16; 'there?': 0.16; 'seems': 0.21; 'to:name:python- list@python.org': 0.22; 'looks': 0.24; 'updating': 0.26; 'defined': 0.27; 'code': 0.31; "skip:' 10": 0.31; 'prints': 0.31; 'skip:q 20': 0.31; 'subject:some': 0.31; 'class': 0.32; 'created': 0.35; 'skip:s 30': 0.35; 'something': 0.35; 'but': 0.35; 'next': 0.36; 'shows': 0.36; 'hi,': 0.36; 'window': 0.38; 'to:addr:python- list': 0.38; 'skip:- 10': 0.38; 'received:65.54': 0.38; 'received:65.54.190': 0.38; 'received:bay0.hotmail.com': 0.38; 'to:addr:python.org': 0.39; 'between': 0.67; 'charset:gb2312': 0.80; 'slot,': 0.84
X-TMN [pQPrXRhKQhmDYjfwA7MO3NQwheboNtZ4]
X-Originating-Email [naruto0.1@live.cn]
Content-Type multipart/alternative; boundary="_b9d22beb-2f72-4743-bc3a-2f3019cd4810_"
From Jacknaruto <naruto0.1@live.cn>
To "python-list@python.org" <python-list@python.org>
Subject In pyqt, some signals seems not work well
Date Mon, 5 Aug 2013 00:06:46 +0800
Importance Normal
MIME-Version 1.0
X-OriginalArrivalTime 04 Aug 2013 16:06:46.0725 (UTC) FILETIME=[9EB00F50:01CE912C]
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.183.1375632477.1251.python-list@python.org> (permalink)
Lines 94
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1375632477 news.xs4all.nl 15986 [2001:888:2000:d::a6]:46021
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51928

Show key headers only | 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