From 84b18e0949055e6e668f27e95d307bba137f4544 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sat, 5 Dec 2015 16:53:56 +0100 Subject: [PATCH] qt: save last active window, not last opened window --- gui/qt/__init__.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py index 7348ebe2..14fb0100 100644 --- a/gui/qt/__init__.py +++ b/gui/qt/__init__.py @@ -203,9 +203,6 @@ class ElectrumGui: return w = ElectrumWindow(self, wallet) w.connect_slots(self.timer) - # save path - if self.config.get('wallet_path') is None: - self.config.set_key('gui_last_wallet', path) # add to recently visited w.update_recently_visited(path) # initial configuration @@ -225,14 +222,18 @@ class ElectrumGui: def close_window(self, window): self.windows.remove(window) self.build_tray_menu() + # save wallet path of last open window + if self.config.get('wallet_path') is None and not self.windows: + path = window.wallet.storage.path + self.config.set_key('gui_last_wallet', path) run_hook('on_close_window', window) def main(self): self.timer.start() - - last_wallet = self.config.get('gui_last_wallet') - if last_wallet is not None and self.config.get('wallet_path') is None: - if os.path.exists(last_wallet): + # open last wallet + if self.config.get('wallet_path') is None: + last_wallet = self.config.get('gui_last_wallet') + if last_wallet is not None and os.path.exists(last_wallet): self.config.cmdline_options['default_wallet_path'] = last_wallet if not self.start_new_window(self.config.get_wallet_path(),