close wallet when window is closed
This commit is contained in:
@@ -69,7 +69,7 @@ class ElectrumGui:
|
|||||||
set_language(config.get('language'))
|
set_language(config.get('language'))
|
||||||
self.network = network
|
self.network = network
|
||||||
self.config = config
|
self.config = config
|
||||||
self.windows = {}
|
self.windows = []
|
||||||
self.efilter = OpenFileEventFilter(self.windows)
|
self.efilter = OpenFileEventFilter(self.windows)
|
||||||
self.app = QApplication(sys.argv)
|
self.app = QApplication(sys.argv)
|
||||||
self.app.installEventFilter(self.efilter)
|
self.app.installEventFilter(self.efilter)
|
||||||
@@ -111,14 +111,16 @@ class ElectrumGui:
|
|||||||
|
|
||||||
def start_new_window(self, config):
|
def start_new_window(self, config):
|
||||||
path = config.get_wallet_path()
|
path = config.get_wallet_path()
|
||||||
if path not in self.windows:
|
for w in self.windows:
|
||||||
|
if w.config.get_wallet_path() == path:
|
||||||
|
break
|
||||||
|
else:
|
||||||
w = ElectrumWindow(config, self.network, self)
|
w = ElectrumWindow(config, self.network, self)
|
||||||
w.connect_slots(self.timer)
|
w.connect_slots(self.timer)
|
||||||
w.load_wallet_file(path)
|
w.load_wallet_file(path)
|
||||||
w.show()
|
w.show()
|
||||||
self.windows[path] = w
|
self.windows.append(w)
|
||||||
|
|
||||||
w = self.windows[path]
|
|
||||||
url = config.get('url')
|
url = config.get('url')
|
||||||
if url:
|
if url:
|
||||||
w.pay_to_URI(url)
|
w.pay_to_URI(url)
|
||||||
@@ -162,8 +164,5 @@ class ElectrumGui:
|
|||||||
event = QtCore.QEvent(QtCore.QEvent.Clipboard)
|
event = QtCore.QEvent(QtCore.QEvent.Clipboard)
|
||||||
self.app.sendEvent(self.app.clipboard(), event)
|
self.app.sendEvent(self.app.clipboard(), event)
|
||||||
|
|
||||||
for window in self.windows.values():
|
|
||||||
window.close_wallet()
|
|
||||||
|
|
||||||
if self.tray:
|
if self.tray:
|
||||||
self.tray.hide()
|
self.tray.hide()
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ class ElectrumWindow(QMainWindow):
|
|||||||
self.account_selector.hide()
|
self.account_selector.hide()
|
||||||
|
|
||||||
def close_wallet(self):
|
def close_wallet(self):
|
||||||
|
print_error('close_wallet', self.config.get_wallet_path())
|
||||||
if self.wallet:
|
if self.wallet:
|
||||||
self.wallet.storage.put('accounts_expanded', self.accounts_expanded)
|
self.wallet.storage.put('accounts_expanded', self.accounts_expanded)
|
||||||
self.wallet.stop_threads()
|
self.wallet.stop_threads()
|
||||||
@@ -551,7 +552,9 @@ class ElectrumWindow(QMainWindow):
|
|||||||
if self.qr_window:
|
if self.qr_window:
|
||||||
self.qr_window.close()
|
self.qr_window.close()
|
||||||
QMainWindow.close(self)
|
QMainWindow.close(self)
|
||||||
|
self.close_wallet()
|
||||||
run_hook('close_main_window')
|
run_hook('close_main_window')
|
||||||
|
self.gui_object.windows.remove(self)
|
||||||
|
|
||||||
def connect_slots(self, sender):
|
def connect_slots(self, sender):
|
||||||
self.connect(sender, QtCore.SIGNAL('timersignal'), self.timer_actions)
|
self.connect(sender, QtCore.SIGNAL('timersignal'), self.timer_actions)
|
||||||
|
|||||||
Reference in New Issue
Block a user