示例#1
0
 def edit(self, *obj):
     """
     Edit a Citation
     """
     for handle in self.selected_handles():
         citation = self.dbstate.db.get_citation_from_handle(handle)
         try:
             EditCitation(self.dbstate, self.uistate, [], citation)
         except WindowActiveError:
             pass
示例#2
0
 def edit_citation(self, handle):
     """
     Edit the selected citation.
     """
     try:
         citation = self.dbstate.db.get_citation_from_handle(handle)
         source_handle = citation.get_reference_handle()
         source = self.dbstate.db.get_source_from_handle(source_handle)
         EditCitation(self.dbstate, self.uistate, [], citation, source)
     except WindowActiveError:
         pass
示例#3
0
 def share(self, obj):
     """
     share:      Add a new citation to an existing source (when a source is
                   selected)
     """
     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 not source:
             source = self.dbstate.db.get_source_from_handle(
                 citation.get_reference_handle())
         try:
             EditCitation(self.dbstate, self.uistate, [], Citation(),
                          source)
         except WindowActiveError:
             from gramps.gui.dialog import WarningDialog
             WarningDialog(_("Cannot share this reference"),
                           self.__blocked_text(),
                           parent=self.uistate.window)
示例#4
0
 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)
示例#5
0
    def add(self, obj):
        """
        add:        Add a new citation and a new source (this can also be done
                      by source view add a source, then citation view add a new
                      citation to an existing source)

        Create a new Source instance and Citation instance and call the
        EditSource editor with the new source.

        Called when the Add 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:
            EditCitation(self.dbstate, self.uistate, [], Citation(), Source())
        except WindowActiveError:
            pass
示例#6
0
 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())
示例#7
0
 def share(self, obj):
     """
     share:      Add a new citation to an existing source (when a source is
                   selected)
     """
     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 source:
             try:
                 EditCitation(self.dbstate, self.uistate, [], Citation(),
                              source)
             except WindowActiveError:
                 from gramps.gui.dialog import WarningDialog
                 WarningDialog(_("Cannot share this reference"),
                               self.__blocked_text())
         else:
             msg = _("Cannot add citation.")
             msg2 = _("In order to add a citation to an existing source, "
                      " you must select a source.")
             ErrorDialog(msg, msg2)