The thread is created, but QTimer seems to do nothing ('checkIt' is never called).
What am I doing wrong?
- Code: Select all
from PyQt4 import QtCore
class JobThread(QtCore.QThread):
def __init__(self, app):
QtCore.QThread.__init__(self)
self.app = app
self.app.logger_async.warning('INIT')
def __del__(self):
self.wait()
def run(self):
self.app.logger_async.warning('RUN')
# call checkIt every 1000ms
self.job_timer = QtCore.QTimer()
self.job_timer.singleShot(False)
self.job_timer.start(1000)
self.job_timer.timeout.connect(self.checkIt)
self.app.logger_async.warning('TIMER STARTED')
def checkIt(self):
# do smth
self.app.processEvents() # required??
self.app.logger_async.warning('CHECK')
def load(app):
jobThread = JobThread(app)
jobThread.start()
def unload(app):
pass