def iter_dirty_docs(): for proj in self.projects: eds = app.find_editors_with_project(proj) if eds == [self]: for dv in proj.dirty_documents(): doc = dv.document editors = app.iter_editors_with_view_of_document(doc) if list(editors) == [self]: yield dv yield proj
def perform_close(self, editor): from editxt.application import DocumentSavingDelegate if app.find_editors_with_project(self) == [editor]: def dirty_docs(): for dv in self.dirty_documents(): itr = app.iter_editors_with_view_of_document(dv.document) if list(itr) == [editor]: yield dv yield self def callback(should_close): if should_close: editor.discard_and_focus_recent(self) saver = DocumentSavingDelegate.alloc().\ init_callback_(dirty_docs(), callback) saver.save_next_document() else: editor.discard_and_focus_recent(self)