Implement drag and drop for citations

svn: r18438
This commit is contained in:
Tim G L Lyons
2011-11-12 22:34:18 +00:00
parent c4c64557d5
commit 7ebf8de20a
3 changed files with 42 additions and 17 deletions

View File

@@ -196,7 +196,20 @@ class CitationTreeView(ListView):
return self.dbstate.db.get_citation_bookmarks()
def drag_info(self):
return DdTargets.SOURCE_LINK
selection = self.selected_handles()
if len(selection) == 1:
handle = selection[0]
# 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:
return DdTargets.SOURCE_LINK
else:
return DdTargets.CITATION_LINK
else:
return DdTargets.CITATION_LINK
def type_list(self):
"""