1
0

qt init: move Ctrl-C handling earlier

This commit is contained in:
SomberNight
2021-04-06 18:27:28 +02:00
parent 94774c6ad2
commit c41cd4ae04

View File

@@ -393,6 +393,12 @@ class ElectrumGui(Logger):
wizard.terminate()
def main(self):
# setup Ctrl-C handling and tear-down code first, so that user can easily exit whenever
self.app.setQuitOnLastWindowClosed(False) # so _we_ can decide whether to quit
self.app.lastWindowClosed.connect(self._maybe_quit_if_no_windows_open)
self.app.aboutToQuit.connect(self._cleanup_before_exit)
signal.signal(signal.SIGINT, lambda *args: self.app.quit())
# first-start network-setup
try:
self.init_network()
except UserCancelled:
@@ -402,18 +408,11 @@ class ElectrumGui(Logger):
except Exception as e:
self.logger.exception('')
return
# start wizard to select/create wallet
self.timer.start()
path = self.config.get_wallet_path(use_gui_last_wallet=True)
if not self.start_new_window(path, self.config.get('url'), app_is_starting=True):
return
signal.signal(signal.SIGINT, lambda *args: self.app.quit())
self.app.setQuitOnLastWindowClosed(False) # so _we_ can decide whether to quit
self.app.lastWindowClosed.connect(self._maybe_quit_if_no_windows_open)
self.app.aboutToQuit.connect(self._cleanup_before_exit)
# main loop
self.app.exec_()
# on some platforms the exec_ call may not return, so use clean_up()