def save_next_document(self): if len(self._docs_to_save) == 0: # The documents are saved, we can run the tool. run_external_tool(self._window, self._panel, self._node) else: next_doc = self._docs_to_save[0] self._docs_to_save.remove(next_doc) Gedit.commands_save_document_async(next_doc, self._window, None, self.on_document_saved, None)
def save_note(self): '''Save note to disk with GEdit async save, and write marks to memobook''' dprint(3, "\ngMemobook::save_note::") doc = self.__window.get_active_document() Gedit.commands_save_document_async(doc, self.__window, None, lambda x,y,z: self.__save_note_hook(x,y,z), None) return
def save_note_as(self): '''Save-as to disk with GEdit async save, and write marks to memobook''' dprint(3, "\ngMemobook::save_note::") doc = self.__window.get_active_document() f = doc.get_file() path = GtkSource.File.get_location(f).get_path() old_note = self.__get_note_ref(path) f.set_location(None) Gedit.commands_save_document_async(doc, self.__window, None, lambda x,y,z: self.__save_note_hook(x,y,z), old_note) return
def maybe_save(window): for document in window.get_unsaved_documents(): if document.get_file().is_readonly(): return False if document.is_untitled(): return False if not document.get_file().is_local(): return False if not document.get_modified(): return False Gedit.commands_save_document_async(document, window)