Browse Source

network_dialog: do not use parent for signalling

2.9.x
ThomasV 8 years ago
parent
commit
dd50259f68
  1. 4
      gui/qt/__init__.py
  2. 4
      gui/qt/main_window.py
  3. 15
      gui/qt/network_dialog.py

4
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):

4
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)

15
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()

Loading…
Cancel
Save