Fwd: Python Signal/Slot + QThred code analysis
juan0christian at gmail.com
Tue Nov 25 22:36:24 CET 2014
So guys, I had to change to approach, I read that using Qt I can't do
multiple inheritance. So my Outpost class can't be like 'Outpost(QObject,
QThred)'. I had to change the code a bit:
from PySide.QtCore import QObject, QThread, Signal
def __init__(self, url, *args, **kwargs):
self.trades = None
self.posts = None
self.url = url
soup = bs4.BeautifulSoup(requests.get(self.url).text)
self.trades = soup.select('div.stat_box
self.posts = soup.select('div.stat_box div.value').get_text()
received = Signal()
def __init__(self, id64, *args, **kwargs):
worker = Worker('http://www.myurl.com/' + id64)
So, what I see people doing is creating a 'Worker' class for thread related
stuff and another separate class for the main stuff.
So, let's see the problems:
Traceback (most recent call last):
File "D:/.../main.py", line 44, in output_slot
outpost = Outpost('12345')
File "D:\...\outpost.py", line 27, in __init__
TypeError: received() only accepts 0 arguments, 2 given!
The URL is OK, I externally checked, and return the expected.
So, what I'm trying to do here is call my Worker when outpost is
instantiated, then the Worker call the site in the run function, and then
set the variables and return itself.
Back to the main class, I have the init where I instantiate the Worker and
return it in the emit().
If I got it correctly, when I call the 'outpost.received.connect(IPSUM)',
IPSUM will be execute when, and only when I have all values set, because in
my Outpost class it will emit when it has everything done, did I get it
OFF-TOPIC: You guys said that my emails had some trash HTML and strange
stuffs, is it OK now?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list