Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51934
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <vincent.vandevyvre@swing.be> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'url:launchpad': 0.05; '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; '16.': 0.16; 'comments:': 0.16; 'dirnames,': 0.16; 'dirpath,': 0.16; 'from:addr:swing.be': 0.16; 'from:addr:vincent.vandevyvre': 0.16; 'from:name:vincent vande vyvre': 0.16; 'message-id:@swing.be': 0.16; 'oqapy': 0.16; 'paqager': 0.16; 'received:mobistar.be': 0.16; 'str)': 0.16; 'there?': 0.16; 'url:oqapy': 0.16; 'url:paqager': 0.16; 'url:qarte': 0.16; 'v.v.': 0.16; 'seems': 0.21; 'header:User- Agent:1': 0.23; 'looks': 0.24; 'this:': 0.26; 'updating': 0.26; 'defined': 0.27; 'header:In-Reply-To:1': 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; 'etc': 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; 'to:addr:python.org': 0.39; 'here': 0.66; 'between': 0.67; '11.': 0.74; 'slot,': 0.84 |
| Date | Sun, 04 Aug 2013 20:20:56 +0200 |
| From | Vincent Vande Vyvre <vincent.vandevyvre@swing.be> |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: In pyqt, some signals seems not work well |
| References | <BAY175-W414DAF53B9935BAD5F8714F3530@phx.gbl> |
| In-Reply-To | <BAY175-W414DAF53B9935BAD5F8714F3530@phx.gbl> |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| 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.187.1375640467.1251.python-list@python.org> (permalink) |
| Lines | 77 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1375640467 news.xs4all.nl 15958 [2001:888:2000:d::a6]:36420 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:51934 |
Show key headers only | View raw
Le 04/08/2013 18:06, Jacknaruto a écrit :
> 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:
>
> 1. class worker(QtCore.QThread):
> 2. sig_jump_finish_page = QtCore.pyqtSignal()
> 3. sig_set_label_text = QtCore.pyqtSignal(str, str)
> 4. sig_set_progress_value = QtCore.pyqtSignal(int)
> 5.
>
> 6. for dirpath, dirnames, filenames in os.walk(self.root):
> 7. for filename in filenames:
> 8. self.sig_set_label_text.emit('current', self.current()) # work well
> 9. # so something
>10.
>
> 11. #self.dialog.set_found(str(self.found())) # work well
> 12. #self.dialog.set_all(str(self.total())) # work well
> 13. self.sig_set_label_text.emit('found', str(self.found())) # :(
> 14. self.sig_set_label_text.emit('all', str(self.total())) # :(
>15.
>
> 16. 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?
>
>
>
>
>
Have a look at my comments:
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): # What is 'self'
here ?
for filename in filenames:
self.sig_set_label_text.emit('current', self.current()) # where is
'current' ?
# so something
#self.dialog.set_found(str(self.found())) # What is self, and dialog,
and found ?
#self.dialog.set_all(str(self.total())) # ...
self.sig_set_label_text.emit('found', str(self.found())) # again ?
self.sig_set_label_text.emit('all', str(self.total())) # etc
self.sig_jump_finish_page.emit()
--
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte
<https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: In pyqt, some signals seems not work well Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2013-08-04 20:20 +0200
csiph-web