Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'correct.': 0.07; 'subject: + ': 0.07; 'subject:code': 0.07; 'users,': 0.07; 'logic': 0.09; 'gui': 0.12; 'thread': 0.14; 'windows': 0.15; 'api,': 0.16; 'better?': 0.16; 'drag': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'mean,': 0.16; 'seconds,': 0.16; 'seconds.': 0.16; 'subject:analysis': 0.16; 'thread?': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'users.': 0.18; 'seems': 0.21; 'machine': 0.22; 'header :User-Agent:1': 0.23; 'certainly': 0.24; 'issue,': 0.24; 'question': 0.24; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'originally': 0.30; 'especially': 0.30; 'code': 0.31; "we're": 0.32; 'maybe': 0.34; 'problem': 0.35; 'info': 0.35; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'instances': 0.36; 'minutes,': 0.36; 'right?': 0.36; 'var': 0.36; 'done': 0.36; "i'll": 0.36; 'so,': 0.37; 'starting': 0.37; 'christian': 0.38; 'sometimes': 0.38; 'message-id:@gmail.com': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'moving': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'users': 0.40; 'how': 0.40; 'most': 0.60; 'new': 0.61; 'subject:Fwd': 0.61; 'simply': 0.61; "you'll": 0.62; 'real': 0.63; 'different': 0.65; '100': 0.79; 'id,': 0.84; 'instantly': 0.84; 'replicate': 0.84; 'waste.': 0.84 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Thu, 27 Nov 2014 17:52:45 -0700 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Fwd: Python Signal/Slot + QThred code analysis References: <5473E188.5020608@gmail.com> <5474A333.2090207@mrabarnett.plus.com> <5474C889.5090503@mrabarnett.plus.com> <547545CF.60208@gmail.com> <5476A134.7050407@gmail.com> <5476A48C.1050607@gmail.com> <5477AB1E.3030609@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1417135976 news.xs4all.nl 2855 [2001:888:2000:d::a6]:42004 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81655 On 11/27/2014 04:29 PM, Juan Christian wrote: > So, instantly I found one issue, you said that this code won't block the > GUI, only the thread event loop, but if we keep moving the window while > it's open, every time new info is printed the GUI freezes for like 1-2 > seconds. Correct. The thread does not block the GUI. I cannot replicate your problem on my machine here. Maybe we're finding a problem with Windows and Qt. I can drag the window around and it keeps on a going. > And why this approach of a single instance is better? I mean, I'll have to > call Outpost every time I get new data from my other API, because there > will be different users, so I need to create different instances so I call > the site with a new ID, don't I? Just seems wasteful, that's all. Why not instantiate Outpost from the worker thread? Especially if your thread only does one thing every 5 seconds. Starting up a new thread and destroying seems like a waste. But it certainly can be done that way. > Maybe the answer for that question is that you using a timer that is ALWAYS > active and ALWAYS calling the the outpost site, so I'll have something like: > > var = Outpost('12345') > var.posts -> 100 > var.setID('67893') > var.posts -> 35 > > Is that right? But I don't think that always calling the site this way is > good for them and for me, sometimes I may not get new users for like 10~15 > minutes, so I would have wasted a lot of calls for nothing. That's why I > only instantiate/call the site when I get new users. I was simply using the logic you originally provided. I have no idea what Outpost does or how you use it. Your original code just grabbed some data every 5 seconds, so that's what I got it to do in the most efficient way. You'll have to adapt it to your real needs.