def do_shutdown(self): """When shutdown, finalize database and logging systems.""" self.logger.info('Shutting down database...') SQLSession.commit() SQLSession.close() self._daemon.terminate() self.logger.info('Application quit normally.') logging.shutdown() Gtk.Application.do_shutdown(self)
def ui_manager(self): """Get the UI Manager of L{yaner}.""" if self._ui_manager is None: self.logger.info('Initializing UI Manager...') ui_manager = Gtk.UIManager() ui_manager.insert_action_group(self.action_group) try: ui_manager.add_ui_from_file(self._UI_FILE) except GObject.GError: self.logger.exception("Failed to add ui file to UIManager.") SQLSession.close() logging.shutdown() sys.exit(1) else: self.logger.info('UI Manager initialized.') self._ui_manager = ui_manager return self._ui_manager