def add_plants_callback(locations): # create a temporary session so that the temporary plant doesn't # get added to the accession session = db.Session() loc = session.merge(locations[0]) from bauble.plugins.garden.plant import Plant, PlantEditor e = PlantEditor(model=Plant(location=loc)) session.close() return e.start() is not None
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 = LocationEditor(parent=self.parent) more_committed = e.start() elif response == self.RESPONSE_OK_AND_ADD: from bauble.plugins.garden.plant import PlantEditor, Plant e = PlantEditor(Plant(location=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): """ Started the LocationEditor and return the committed Location objects. """ while True: response = self.presenter.start()