disconnect signals when the process is done
This commit is contained in:
parent
7233fca84d
commit
15f4167c81
1 changed files with 13 additions and 2 deletions
|
|
@ -82,8 +82,8 @@ class QtDo(QObject):
|
|||
self.cb = cb
|
||||
self.eb = eb
|
||||
|
||||
self.connect(self, SIGNAL('cb'), self.cb)
|
||||
self.connect(self, SIGNAL('eb'), self.eb)
|
||||
self.connect(self, SIGNAL('cb'), self.local_cb)
|
||||
self.connect(self, SIGNAL('eb'), self.local_eb)
|
||||
|
||||
def run_thread(func):
|
||||
def inner(self, *args, **kwargs):
|
||||
|
|
@ -108,6 +108,17 @@ class QtDo(QObject):
|
|||
print error
|
||||
print backtrace
|
||||
|
||||
def local_cb(self, backend, data):
|
||||
self.cb(backend, data)
|
||||
if not backend:
|
||||
self.disconnect(self, SIGNAL('cb'), self.local_cb)
|
||||
self.disconnect(self, SIGNAL('eb'), self.local_eb)
|
||||
|
||||
def local_eb(self, backend, error, backtrace):
|
||||
self.eb(backend, error, backtrace)
|
||||
self.disconnect(self, SIGNAL('cb'), self.local_cb)
|
||||
self.disconnect(self, SIGNAL('eb'), self.local_eb)
|
||||
|
||||
def thread_cb(self, backend, data):
|
||||
self.emit(SIGNAL('cb'), backend, data)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue