Handle not found when copying source from the (#1175)
Citation tree Fixes #12170
This commit is contained in:
parent
14c2d0e1b6
commit
b6fa5da8ee
@ -471,6 +471,7 @@ class ClipCitation(ClipHandleWrapper):
|
|||||||
|
|
||||||
def refresh(self):
|
def refresh(self):
|
||||||
if self._handle:
|
if self._handle:
|
||||||
|
try:
|
||||||
citation = clipdb.get_citation_from_handle(self._handle)
|
citation = clipdb.get_citation_from_handle(self._handle)
|
||||||
if citation:
|
if citation:
|
||||||
self._title = citation.get_gramps_id()
|
self._title = citation.get_gramps_id()
|
||||||
@ -489,9 +490,17 @@ class ClipCitation(ClipHandleWrapper):
|
|||||||
text = str(text)
|
text = str(text)
|
||||||
if len(text) > 60:
|
if len(text) > 60:
|
||||||
text = text[:60] + "..."
|
text = text[:60] + "..."
|
||||||
self._value = _("Volume/Page: %(pag)s -- %(sourcetext)s") % {
|
self._value = _("Volume/Page: %(pag)s -- %(sourcetext)s"
|
||||||
'pag' : page,
|
) % { 'pag' : page,
|
||||||
'sourcetext' : text}
|
'sourcetext' : text}
|
||||||
|
except:
|
||||||
|
# We are in the Source tree view. The shortcuts only
|
||||||
|
# work for citations.
|
||||||
|
print("We cannot copy the source from this view."
|
||||||
|
" Use drag and drop.")
|
||||||
|
self._title = self._value = ''
|
||||||
|
self._pickle = self._type = self._objclass = None
|
||||||
|
self._handle = self._dbid = self._dbname = None
|
||||||
|
|
||||||
|
|
||||||
class ClipRepoRef(ClipObjWrapper):
|
class ClipRepoRef(ClipObjWrapper):
|
||||||
@ -1281,6 +1290,14 @@ class ClipboardListView:
|
|||||||
model.insert_before(node, data)
|
model.insert_before(node, data)
|
||||||
else:
|
else:
|
||||||
model.insert_after(node, data)
|
model.insert_after(node, data)
|
||||||
|
elif isinstance(data[1], ClipCitation):
|
||||||
|
if data[3]:
|
||||||
|
# we have a real citation
|
||||||
|
model.append(data)
|
||||||
|
#else:
|
||||||
|
# We are in a Source treeview and trying
|
||||||
|
# to copy a source with a shortcut.
|
||||||
|
# Use drag and drop to do that.
|
||||||
else:
|
else:
|
||||||
model.append(data)
|
model.append(data)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user