parent
58fe42cea2
commit
f7b39f4952
|
@ -163,16 +163,13 @@ class ElectrumGui:
|
||||||
return w
|
return w
|
||||||
|
|
||||||
def close_window(self, window):
|
def close_window(self, window):
|
||||||
# It seems that in some cases this can be called before the
|
self.windows.remove(window)
|
||||||
# window is added to the windows list...
|
|
||||||
if window in self.windows:
|
|
||||||
self.windows.remove(window)
|
|
||||||
run_hook('on_close_window', window)
|
|
||||||
self.build_tray_menu()
|
self.build_tray_menu()
|
||||||
# save wallet path of last open window
|
# save wallet path of last open window
|
||||||
if self.config.get('wallet_path') is None and not self.windows:
|
if self.config.get('wallet_path') is None and not self.windows:
|
||||||
path = window.wallet.storage.path
|
path = window.wallet.storage.path
|
||||||
self.config.set_key('gui_last_wallet', path)
|
self.config.set_key('gui_last_wallet', path)
|
||||||
|
run_hook('on_close_window', window)
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
self.timer.start()
|
self.timer.start()
|
||||||
|
|
|
@ -113,6 +113,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
self.contacts = gui_object.contacts
|
self.contacts = gui_object.contacts
|
||||||
self.tray = gui_object.tray
|
self.tray = gui_object.tray
|
||||||
self.app = gui_object.app
|
self.app = gui_object.app
|
||||||
|
self.cleaned_up = False
|
||||||
|
|
||||||
self.create_status_bar()
|
self.create_status_bar()
|
||||||
self.need_update = threading.Event()
|
self.need_update = threading.Event()
|
||||||
|
@ -2818,19 +2819,26 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
NetworkDialog(self.wallet.network, self.config, self).do_exec()
|
NetworkDialog(self.wallet.network, self.config, self).do_exec()
|
||||||
|
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
|
# It seems in some rare cases this closeEvent() is called twice
|
||||||
|
if not self.cleaned_up:
|
||||||
|
self.cleaned_up = True
|
||||||
|
self.clean_up()
|
||||||
|
event.accept()
|
||||||
|
|
||||||
|
def clean_up(self):
|
||||||
if self.network:
|
if self.network:
|
||||||
self.network.unregister_callback(self.on_network)
|
self.network.unregister_callback(self.on_network)
|
||||||
self.config.set_key("is_maximized", self.isMaximized())
|
self.config.set_key("is_maximized", self.isMaximized())
|
||||||
if not self.isMaximized():
|
if not self.isMaximized():
|
||||||
g = self.geometry()
|
g = self.geometry()
|
||||||
self.wallet.storage.put("winpos-qt", [g.left(),g.top(),g.width(),g.height()])
|
self.wallet.storage.put("winpos-qt", [g.left(),g.top(),
|
||||||
self.config.set_key("console-history", self.console.history[-50:], True)
|
g.width(),g.height()])
|
||||||
|
self.config.set_key("console-history", self.console.history[-50:],
|
||||||
|
True)
|
||||||
if self.qr_window:
|
if self.qr_window:
|
||||||
self.qr_window.close()
|
self.qr_window.close()
|
||||||
self.close_wallet()
|
self.close_wallet()
|
||||||
self.gui_object.close_window(self)
|
self.gui_object.close_window(self)
|
||||||
event.accept()
|
|
||||||
|
|
||||||
|
|
||||||
def plugins_dialog(self):
|
def plugins_dialog(self):
|
||||||
self.pluginsdialog = d = WindowModalDialog(self, _('Electrum Plugins'))
|
self.pluginsdialog = d = WindowModalDialog(self, _('Electrum Plugins'))
|
||||||
|
|
Loading…
Reference in New Issue