Ask for confirmation before exiting

This commit is contained in:
2019-12-03 13:24:59 -06:00
parent 20dcb4a475
commit f3aeb9f61b
3 changed files with 13 additions and 1 deletions

View File

@@ -619,6 +619,7 @@ class Controller(object):
### GUI events
# These functions are connected to GUI elements such as menus, buttons and so on.
def connect_gui_events(self):
widgetUtils.connectExitFunction(self.exit_)
widgetUtils.connect_event(self.window, widgetUtils.CLOSE_EVENT, self.exit)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.update_buffer, menuitem=self.window.update_buffer)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.check_for_updates, menuitem=self.window.check_for_updates)
@@ -655,6 +656,11 @@ class Controller(object):
self.window.tb.Bind(wx.EVT_CONTEXT_MENU, self.on_context_menu)
def exit(self, *args, **kwargs):
answer = commonMessages.exit()
if answer == widgetUtils.YES:
self.exit_()
def exit_(self, *args, **kwargs):
""" Try to set offline in the current user's profile at VK, then closes the application. """
log.debug("Receibed an exit signal. closing...")
self.set_offline()