qt init: move Ctrl-C handling earlier
This commit is contained in:
@@ -393,6 +393,12 @@ class ElectrumGui(Logger):
|
|||||||
wizard.terminate()
|
wizard.terminate()
|
||||||
|
|
||||||
def main(self):
|
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:
|
try:
|
||||||
self.init_network()
|
self.init_network()
|
||||||
except UserCancelled:
|
except UserCancelled:
|
||||||
@@ -402,18 +408,11 @@ class ElectrumGui(Logger):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.exception('')
|
self.logger.exception('')
|
||||||
return
|
return
|
||||||
|
# start wizard to select/create wallet
|
||||||
self.timer.start()
|
self.timer.start()
|
||||||
|
|
||||||
path = self.config.get_wallet_path(use_gui_last_wallet=True)
|
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):
|
if not self.start_new_window(path, self.config.get('url'), app_is_starting=True):
|
||||||
return
|
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
|
# main loop
|
||||||
self.app.exec_()
|
self.app.exec_()
|
||||||
# on some platforms the exec_ call may not return, so use clean_up()
|
# on some platforms the exec_ call may not return, so use clean_up()
|
||||||
|
|||||||
Reference in New Issue
Block a user