electrum

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

commit dd50259f68c3e35d8405e3cd059e93e27df5fb4e
parent 5ae5c81c487715f103e5ea1fecc433dc5f2fdaae
Author: ThomasV <thomasv@electrum.org>
Date:   Sat,  8 Jul 2017 15:35:48 +0200

network_dialog: do not use parent for signalling

Diffstat:
Mgui/qt/__init__.py | 4++--
Mgui/qt/main_window.py | 4++--
Mgui/qt/network_dialog.py | 15+++++++--------
3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py @@ -139,7 +139,7 @@ class ElectrumGui: # Use a signal as can be called from daemon thread self.app.emit(SIGNAL('new_window'), path, uri) - def show_network_dialog(self, parent): + def show_network_dialog(self): from network_dialog import NetworkDialog if not self.daemon.network: parent.show_warning(_('You are using Electrum in offline mode; restart Electrum if you want to get connected'), title=_('Offline')) @@ -148,7 +148,7 @@ class ElectrumGui: self.nd.show() self.nd.raise_() return - self.nd = NetworkDialog(self.daemon.network, self.config, parent) + self.nd = NetworkDialog(self.daemon.network, self.config) self.nd.show() def create_window_for_wallet(self, wallet): diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -478,7 +478,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): # Settings / Preferences are all reserved keywords in OSX using this as work around tools_menu.addAction(_("Electrum preferences") if sys.platform == 'darwin' else _("Preferences"), self.settings_dialog) - tools_menu.addAction(_("&Network"), lambda: self.gui_object.show_network_dialog(self)) + tools_menu.addAction(_("&Network"), self.gui_object.show_network_dialog) tools_menu.addAction(_("&Plugins"), self.plugins_dialog) tools_menu.addSeparator() tools_menu.addAction(_("&Sign/verify message"), self.sign_verify_message) @@ -1728,7 +1728,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): sb.addPermanentWidget(StatusBarButton(QIcon(":icons/preferences.png"), _("Preferences"), self.settings_dialog ) ) self.seed_button = StatusBarButton(QIcon(":icons/seed.png"), _("Seed"), self.show_seed_dialog ) sb.addPermanentWidget(self.seed_button) - self.status_button = StatusBarButton(QIcon(":icons/status_disconnected.png"), _("Network"), lambda: self.gui_object.show_network_dialog(self)) + self.status_button = StatusBarButton(QIcon(":icons/status_disconnected.png"), _("Network"), self.gui_object.show_network_dialog) sb.addPermanentWidget(self.status_button) run_hook('create_status_bar', sb) self.setStatusBar(sb) diff --git a/gui/qt/network_dialog.py b/gui/qt/network_dialog.py @@ -38,21 +38,20 @@ protocol_names = ['TCP', 'SSL'] protocol_letters = 'ts' class NetworkDialog(QDialog): - def __init__(self, network, config, parent): - QDialog.__init__(self, parent) + def __init__(self, network, config): + QDialog.__init__(self) self.setWindowTitle(_('Network')) self.setMinimumSize(400, 20) self.nlayout = NetworkChoiceLayout(network, config) vbox = QVBoxLayout(self) vbox.addLayout(self.nlayout.layout()) vbox.addLayout(Buttons(CloseButton(self))) - self.connect(parent, QtCore.SIGNAL('updated'), self.on_update) - def do_exec(self): - result = self.exec_() - #if result: - # self.nlayout.accept() - return result + self.connect(self, QtCore.SIGNAL('updated'), self.on_update) + network.register_callback(self.on_network, ['updated']) + + def on_network(self, event, *args): + self.emit(QtCore.SIGNAL('updated'), event, *args) def on_update(self): self.nlayout.update()