From f3e432140cfe0f76a3150492d66e9d4408c59a72 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Wed, 14 Nov 2018 12:16:11 +0200 Subject: [PATCH] Proper quit sequence: close MainWindow and quit the app instead of sys.exit() --- src/bitmessageqt/__init__.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index f2e93ad3..f6dc39bf 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2804,6 +2804,7 @@ class MyForm(settingsmixin.SMainWindow): QtCore.QEventLoop.AllEvents, 1000 ) shutdown.doCleanShutdown() + self.updateStatusBar(_translate( "MainWindow", "Stopping notifications... %1%").arg(90)) self.tray.hide() @@ -2812,20 +2813,21 @@ class MyForm(settingsmixin.SMainWindow): "MainWindow", "Shutdown imminent... %1%").arg(100)) logger.info("Shutdown complete") - super(MyForm, myapp).close() - # return - sys.exit() + self.close() + # FIXME: rewrite loops with timer instead + if self.wait: + self.destroy() + app.quit() - # window close event def closeEvent(self, event): - self.appIndicatorHide() - + """window close event""" + event.ignore() trayonclose = BMConfigParser().safeGetBoolean( 'bitmessagesettings', 'trayonclose') - - event.ignore() - if not trayonclose: - # quit the application + if trayonclose: + self.appIndicatorHide() + else: + # custom quit method self.quit() def on_action_InboxMessageForceHtml(self): @@ -4219,4 +4221,4 @@ def run(): if not BMConfigParser().getboolean('bitmessagesettings', 'startintray'): myapp.show() - sys.exit(app.exec_()) + app.exec_()