コード例 #1
0
ファイル: citationlistview.py プロジェクト: zradoslav/gramps
 def remove_object_from_handle(self, handle):
     the_lists = get_citation_referents(handle, self.dbstate.db)
     object = self.dbstate.db.get_citation_from_handle(handle)
     query = DeleteCitationQuery(self.dbstate, self.uistate, object,
                                 the_lists)
     is_used = any(the_lists)
     return (query, is_used, object)
コード例 #2
0
    def remove_object_from_handle(self, handle):
        # The handle will either be a Source handle or a Citation handle
        source, citation = self.get_source_or_citation(handle)
        if citation:
            the_lists = get_citation_referents(handle, self.dbstate.db)
            query = DeleteCitationQuery(self.dbstate, self.uistate, citation,
                                        the_lists)
            is_used = any(the_lists)
            return (query, is_used, citation)
        else:
            the_lists = get_source_and_citation_referents(
                handle, self.dbstate.db)
            LOG.debug('the_lists %s' % [the_lists])

            query = DeleteSrcQuery(self.dbstate, self.uistate, source,
                                   the_lists)
            is_used = any(the_lists)
            return (query, is_used, source)
コード例 #3
0
ファイル: citationtreeview.py プロジェクト: oluul/gramps
    def remove_object_from_handle(self, handle):
        # 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:
            the_lists = get_citation_referents(handle, self.dbstate.db)
            object = self.dbstate.db.get_citation_from_handle(handle)
            query = DeleteCitationQuery(self.dbstate, self.uistate, object,
                                        the_lists)
            is_used = any(the_lists)
            return (query, is_used, object)
        else:
            the_lists = get_source_and_citation_referents(handle,
                                                                self.dbstate.db)
            LOG.debug('the_lists %s' % [the_lists])

            object = self.dbstate.db.get_source_from_handle(handle)
            query = DeleteSrcQuery(self.dbstate, self.uistate, object,
                                   the_lists)
            is_used = any(the_lists)
            return (query, is_used, object)