electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 9c0bb13366bad67da4c5beb8d2c50d8eb4f702f0
parent d825578099e257d7b778ad1ebb4902fcf47249ac
Author: Amir Taaki <genjix@riseup.net>
Date:   Fri, 29 Jun 2012 02:33:21 +0200

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

Diffstat:
Mlib/gui_lite.py | 20+++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/lib/gui_lite.py b/lib/gui_lite.py @@ -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: