def edit(self, obj): for handle in self.selected_handles(): source = self.dbstate.db.get_source_from_handle(handle) try: EditSource(self.dbstate, self.uistate, [], source) except WindowActiveError: pass
def edit_source(self, handle): """ Edit the selected source. """ try: source = self.dbstate.db.get_source_from_handle(handle) EditSource(self.dbstate, self.uistate, [], source) except WindowActiveError: pass
def edit(self, obj): """ Edit either a Source or a Citation, depending on user selection """ for handle in self.selected_handles(): # The handle will either be a Source handle or a Citation handle source, citation = self.get_source_or_citation(handle) if citation: try: EditCitation(self.dbstate, self.uistate, [], citation) except WindowActiveError: pass else: try: EditSource(self.dbstate, self.uistate, [], source) except WindowActiveError: from gramps.gui.dialog import WarningDialog WarningDialog(_("Cannot share this reference"), self.__blocked_text2(), parent=self.uistate.window)
def add_source(self, obj): """ add_source: Add a new source (this is also available from the source view) Create a new Source instance and call the EditSource editor with the new source. Called when the Add_source button is clicked. If the window already exists (WindowActiveError), we ignore it. This prevents the dialog from coming up twice on the same object. However, since the window is identified by the Source object, and we have just created a new one, it seems to be impossible for the window to already exist, so this is just an extra safety measure. """ try: EditSource(self.dbstate, self.uistate, [], Source()) except WindowActiveError: pass
def edit(self, obj): """ Edit either a Source or a Citation, depending on user selection """ for handle in self.selected_handles(): # The handle will either be a Source handle or a Citation handle source = self.dbstate.db.get_source_from_handle(handle) citation = self.dbstate.db.get_citation_from_handle(handle) if (not source and not citation) or (source and citation): raise ValueError("selection must be either source or citation") if citation: try: EditCitation(self.dbstate, self.uistate, [], citation) except WindowActiveError: pass else: # FIXME need try block here try: EditSource(self.dbstate, self.uistate, [], source) except WindowActiveError: from gramps.gui.dialog import WarningDialog WarningDialog(_("Cannot share this reference"), self.__blocked_text2())
def add(self, obj): EditSource(self.dbstate, self.uistate, [], Source())