Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81617
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <torriem+gmail@torriefamily.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'resulting': 0.04; 'subject:Python': 0.06; 'subject: + ': 0.07; 'subject:code': 0.07; '*args,': 0.09; 'callback': 0.09; 'observation': 0.09; 'strings.': 0.09; 'python': 0.11; 'def': 0.12; 'random': 0.14; '**kwargs)': 0.16; '**kwargs):': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'once.': 0.16; 'posted.': 0.16; 'simulate': 0.16; 'soup': 0.16; 'subject:analysis': 0.16; 'think.': 0.16; 'attach': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'module': 0.19; 'trying': 0.19; 'small,': 0.19; 'seems': 0.21; 'import': 0.22; 'putting': 0.22; 'separate': 0.22; 'header:User- Agent:1': 0.23; 'file.': 0.24; 'post': 0.26; 'subject:/': 0.26; 'code:': 0.26; 'header:In-Reply-To:1': 0.27; 'michael': 0.29; "i'm": 0.30; 'code': 0.31; 'complete,': 0.31; 'request,': 0.31; 'with,': 0.31; 'file': 0.32; 'class': 0.32; 'stuff': 0.32; 'run': 0.32; 'skip:_ 10': 0.34; 'maybe': 0.34; "can't": 0.35; 'but': 0.35; 'there': 0.35; 'replies': 0.36; 'returning': 0.36; 'surely': 0.36; "i'll": 0.36; 'example,': 0.37; 'christian': 0.38; 'message- id:@gmail.com': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'remove': 0.60; 'signal': 0.60; 'subject:Fwd': 0.61; "you're": 0.61; 'further': 0.61; 'kind': 0.63; 'here': 0.66; 'beautiful': 0.68; 'study': 0.69; 'obvious': 0.74; 'everything.': 0.84; 'fragments': 0.84; 'rework': 0.84; 'trader': 0.84; 'wall.': 0.84 |
| X-Virus-Scanned | amavisd-new at torriefamily.org |
| Date | Wed, 26 Nov 2014 21:11:56 -0700 |
| From | Michael Torrie <torriem@gmail.com> |
| 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 | <CAAp0bGttki1B=1q5SX_C39L_dRB22YOQiTbVxdvo4jSee0srcw@mail.gmail.com> <CAAp0bGsgMTK7MS1Wvh13304et7Bb7XUyfZTU8ZmF2++BuLj7dw@mail.gmail.com> <5473E188.5020608@gmail.com> <CAAp0bGtYCEWNLV7tnR6O5N706_3AkO9XRBs1pNP8TCxfctUyow@mail.gmail.com> <5474A333.2090207@mrabarnett.plus.com> <CAAp0bGsGLsWoXQnqFYN3KLeUsmcD5ujF80sasM16wx70zQ1xUA@mail.gmail.com> <CAAp0bGvhhWcLO76UQ+nXZuhazjJr9wsjwBkuCX78O4K=em9wuQ@mail.gmail.com> <5474C889.5090503@mrabarnett.plus.com> <CAAp0bGtv13QaPhfTx+tzSe6ZpQ9RCLiWrG1Cv+qfEw3JZ41o9g@mail.gmail.com> <547545CF.60208@gmail.com> <CAAp0bGuMRmEXXFpHaVx0MBoQ72N3MYXYwnnxpS58w-LSV6vTdw@mail.gmail.com> <5476A134.7050407@gmail.com> |
| In-Reply-To | <5476A134.7050407@gmail.com> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16360.1417061524.18130.python-list@python.org> (permalink) |
| Lines | 57 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1417061524 news.xs4all.nl 2864 [2001:888:2000:d::a6]:60031 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:81617 |
Show key headers only | View raw
On 11/26/2014 08:57 PM, Michael Torrie wrote:
> On 11/26/2014 02:55 PM, Juan Christian wrote:
>> On Wed Nov 26 2014 at 1:16:11 AM Michael Torrie <torriem@gmail.com> wrote:
>> You're going to have to post a complete, but small, code example, I
>> think. Working with fragments of code is very difficult if not
>> impossible to assist with, resulting in obtuse, obvious replies from folks.
>>
>> As asked, here is all the code:
>>
>> outpost module: http://pastebin.com/H3K9UUWi
>> main module: http://pastebin.com/dFzums9W
>>
>> I was trying to do other things there but I ended up screwing everything.
>
> I'm sorry I can't run the code you posted. I don't seem to have any
> modules named "request" on Python 3 or Python 2 and your Trader.py seems
> to require it.
>
> You might want to remove the url downloading and Beautiful Soup stuff
> and put in some kind of nop loop instead to simulate it. For example,
> in the Trader module you can remove everything in run() and just have it
> return dummy values, maybe putting in a delay to simulate the work of
> downloading and parsing.
>
> Just an observation from looking at the main module code.
> You only need to attach a callback to a signal once. output_slot()
> seems to attach the callback each and every time the timer fires. This
> is surely wrong.
>
> I'll give it some further study this evening.
Hmm, I hit a wall. There's no main.ui file. Can you rework your code
so that you have a single file (plus a separate ui file that's okay),
that simulates the url request, that I can execute easily.
Here's how you can simulate the web page load:
from PySide.QtCore import QObject, QThread, Signal
import random
import time
class Worker(QThread):
def __init__(self, url, *args, **kwargs):
super().__init__(*args, **kwargs)
self.trades = 'NODATA'
self.posts = 'NODATA'
self.url = url
self.start()
def run(self):
# simulate a web request by sleeping a random time and returning
# random strings.
time.sleep(random.random() * 2)
self.trades = str(random.random() * 25)
self.posts = str(random.random() * 100)
return self
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Fwd: Python Signal/Slot + QThred code analysis Michael Torrie <torriem@gmail.com> - 2014-11-26 21:11 -0700
csiph-web