Proper quit sequence:

close MainWindow and quit the app instead of sys.exit()
This commit is contained in:
Dmitri Bogomolov 2018-11-14 12:16:11 +02:00
parent 08ff39e1ff
commit f3e432140c
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -2804,6 +2804,7 @@ class MyForm(settingsmixin.SMainWindow):
QtCore.QEventLoop.AllEvents, 1000 QtCore.QEventLoop.AllEvents, 1000
) )
shutdown.doCleanShutdown() shutdown.doCleanShutdown()
self.updateStatusBar(_translate( self.updateStatusBar(_translate(
"MainWindow", "Stopping notifications... %1%").arg(90)) "MainWindow", "Stopping notifications... %1%").arg(90))
self.tray.hide() self.tray.hide()
@ -2812,20 +2813,21 @@ class MyForm(settingsmixin.SMainWindow):
"MainWindow", "Shutdown imminent... %1%").arg(100)) "MainWindow", "Shutdown imminent... %1%").arg(100))
logger.info("Shutdown complete") logger.info("Shutdown complete")
super(MyForm, myapp).close() self.close()
# return # FIXME: rewrite loops with timer instead
sys.exit() if self.wait:
self.destroy()
app.quit()
# window close event
def closeEvent(self, event): def closeEvent(self, event):
self.appIndicatorHide() """window close event"""
event.ignore()
trayonclose = BMConfigParser().safeGetBoolean( trayonclose = BMConfigParser().safeGetBoolean(
'bitmessagesettings', 'trayonclose') 'bitmessagesettings', 'trayonclose')
if trayonclose:
event.ignore() self.appIndicatorHide()
if not trayonclose: else:
# quit the application # custom quit method
self.quit() self.quit()
def on_action_InboxMessageForceHtml(self): def on_action_InboxMessageForceHtml(self):
@ -4219,4 +4221,4 @@ def run():
if not BMConfigParser().getboolean('bitmessagesettings', 'startintray'): if not BMConfigParser().getboolean('bitmessagesettings', 'startintray'):
myapp.show() myapp.show()
sys.exit(app.exec_()) app.exec_()