electrum

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

commit 835bc4e4aa5e938e9cd841de7d8bc38dfde7dc3d
parent bbd50ba83c310c5c36b7e6da8422b276635f0be6
Author: Neil Booth <kyuupichan@gmail.com>
Date:   Fri,  4 Sep 2015 18:29:52 +0900

More cleanup now self.window is gone

No need for self.main_window in gui object.
No need for hooks "init_qt" and "close_main_window".

Diffstat:
Mgui/qt/__init__.py | 23++++++++---------------
Mgui/qt/main_window.py | 1-
Mlib/plugins.py | 3---
3 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py @@ -228,7 +228,11 @@ class ElectrumGui: self.config.set_key('gui_last_wallet', path) # add to recently visited w.update_recently_visited(path) - w.show() + # initial configuration + if self.config.get('hide_gui') is True and self.tray.isVisible(): + w.hide() + else: + w.show() self.windows.append(w) self.build_tray_menu() self.plugins.on_new_window(w) @@ -251,20 +255,10 @@ class ElectrumGui: if os.path.exists(last_wallet): self.config.cmdline_options['default_wallet_path'] = last_wallet - # main window - self.main_window = self.start_new_window(self.config.get_wallet_path(), - self.config.get('url')) - if not self.main_window: + if not self.start_new_window(self.config.get_wallet_path(), + self.config.get('url')): return - # plugins interact with main window - run_hook('init_qt', self) - - # initial configuration - if self.config.get('hide_gui') is True and self.tray.isVisible(): - self.main_window.hide() - - signal.signal(signal.SIGINT, lambda *args: self.app.quit()) # main loop @@ -274,5 +268,4 @@ class ElectrumGui: event = QtCore.QEvent(QtCore.QEvent.Clipboard) self.app.sendEvent(self.app.clipboard(), event) - if self.tray: - self.tray.hide() + self.tray.hide() diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -2802,7 +2802,6 @@ class ElectrumWindow(QMainWindow): if self.qr_window: self.qr_window.close() self.close_wallet() - run_hook('close_main_window') self.gui_object.close_window(self) event.accept() diff --git a/lib/plugins.py b/lib/plugins.py @@ -149,9 +149,6 @@ def _run_hook(name, always, *args): for p, f in f_list: if name == 'load_wallet': p.wallet = args[0] - if name == 'init_qt': - gui = args[0] - p.window = gui.main_window if always or p.is_enabled(): try: r = f(*args)