bugfix for "QObject: Cannot create children for a parent that is in a different thread."

This commit is contained in:
Amir Taaki 2012-06-29 02:33:21 +02:00
parent d825578099
commit 9c0bb13366
1 changed files with 13 additions and 7 deletions

View File

@ -50,10 +50,6 @@ class MiniWindow(QDialog):
expand_button.setObjectName("expand_button")
self.balance_label = BalanceLabel()
# WTF?!
# TODO: Fix this!
import time
time.sleep(0.1)
self.balance_label.setObjectName("balance_label")
copy_button = QPushButton(_("&Copy Address"))
@ -252,7 +248,7 @@ class MiniActuator:
def is_valid(self, address):
return self.wallet.is_valid(address)
class MiniDriver:
class MiniDriver(QObject):
INITIALIZING = 0
CONNECTING = 1
@ -260,13 +256,23 @@ class MiniDriver:
READY = 3
def __init__(self, wallet, window):
super(QObject, self).__init__()
self.wallet = wallet
self.window = window
self.wallet.gui_callback = self.update
self.wallet.gui_callback = self.update_callback
self.state = None
self.update()
self.initializing()
self.connect(self, SIGNAL("updatesignal"), self.update)
# This is a hack to workaround that Qt does not like changing the
# window properties from this other thread before the runloop has
# been called from.
def update_callback(self):
self.emit(SIGNAL("updatesignal"))
def update(self):
if not self.wallet.interface: