def close_database(filename, no_confirm=False, exit_=False): # Do not use nb_left.select_tab() to get the tree, use tree.dbs nbl = wx.GetApp().nb_left for item in tuple(editor.tabs.keys()): if editor.tabs[item].get_filename() == filename: if editor.tabs[item].close(ask='quiet' if no_confirm else 'apply' ) == False: return False if not no_confirm and core_api.check_pending_changes(filename): save = msgboxes.close_db_ask(filename).ShowModal() if save == wx.ID_YES: try: core_api.save_database(filename) except OutsplineError as err: warn_aborted_save(err) return False elif save == wx.ID_CANCEL: return False index = nbl.GetPageIndex(tree.dbs[filename]) tree.dbs[filename].close() nbl.close_page(index) core_api.close_database(filename) # Note that this event is also bound directly by the sessions and dbprops # modules close_database_event.signal(filename=filename, exit_=exit_) return True
def close_database(filename, no_confirm=False, exit_=False): # Do not use nb_left.select_tab() to get the tree, use tree.dbs nbl = wx.GetApp().nb_left for item in tuple(editor.tabs.keys()): if editor.tabs[item].get_filename() == filename: if editor.tabs[item].close( ask='quiet' if no_confirm else 'apply') == False: return False if not no_confirm and core_api.check_pending_changes(filename): save = msgboxes.close_db_ask(filename).ShowModal() if save == wx.ID_YES: try: core_api.save_database(filename) except OutsplineError as err: warn_aborted_save(err) return False elif save == wx.ID_CANCEL: return False index = nbl.GetPageIndex(tree.dbs[filename]) tree.dbs[filename].close() nbl.close_page(index) core_api.close_database(filename) # Note that this event is also bound directly by the sessions and dbprops # modules close_database_event.signal(filename=filename, exit_=exit_) return True
def save(self): if core_api.check_pending_changes(self.filename): try: core_api.save_database(self.filename) except OutsplineError as err: databases.warn_aborted_save(err) else: self.dbhistory.refresh()