def _update_context_menu(self): if core_api.preview_undo_tree(self.filename): self.undo.Enable() else: self.undo.Enable(False) if core_api.preview_redo_tree(self.filename): self.redo.Enable() else: self.redo.Enable(False)
def update(self): if core_api.preview_undo_tree(self.filename): self.undo.Enable() else: self.undo.Enable(False) if core_api.preview_redo_tree(self.filename): self.redo.Enable() else: self.redo.Enable(False) if core_api.check_pending_changes(self.filename): self.save.Enable() else: self.save.Enable(False)
def undo(self, no_confirm=False): if core_api.block_databases(): read = core_api.preview_undo_tree(self.filename) if read: for id_ in read: item = editor.Editor.make_tabid(self.filename, id_) if item in editor.tabs and not editor.tabs[item].close( ask='quiet' if no_confirm else 'discard'): break else: core_api.undo_tree(self.filename) self.dbhistory.refresh() undo_tree_event.signal(filename=self.filename) core_api.release_databases()