def add_genera_callback(families): """ Family context menu callback """ session = db.Session() family = session.merge(families[0]) e = GenusEditor(model=Genus(family=family)) session.close() return e.start() != None
def add_genera_callback(families): """ Family context menu callback """ session = db.Session() family = session.merge(families[0]) e = GenusEditor(model=Genus(family=family)) session.close() return e.start() is not None
def test_editor(self): """ Interactively test the PlantEditor """ raise SkipTest("Not Implemented") # loc = self.create(Genus, name=u'some site') fam = Family(family=u"family") fam2 = Family(family=u"family2") fam2.synonyms.append(fam) self.session.add_all([fam, fam2]) self.session.commit() gen = Genus(genus="some genus") editor = GenusEditor(model=gen) editor.start() del editor assert utils.gc_objects_by_type("GenusEditor") == [], "GenusEditor not deleted" assert utils.gc_objects_by_type("GenusEditorPresenter") == [], "GenusEditorPresenter not deleted" assert utils.gc_objects_by_type("GenusEditorView") == [], "GenusEditorView not deleted"
return False elif (self.presenter.dirty() and utils.yes_no_dialog(not_ok_msg)) or \ not self.presenter.dirty(): self.session.rollback() return True else: return False # respond to responses more_committed = None if response == self.RESPONSE_NEXT: self.presenter.cleanup() e = FamilyEditor(parent=self.parent) more_committed = e.start() elif response == self.RESPONSE_OK_AND_ADD: e = GenusEditor(Genus(family=self.model), self.parent) more_committed = e.start() if more_committed is not None: if isinstance(more_committed, list): self._committed.extend(more_committed) else: self._committed.append(more_committed) return True def start(self): while True: response = self.presenter.start() self.presenter.view.save_state() if self.handle_response(response):