diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 4c8a8fe7e..871d22a5b 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -13,7 +13,9 @@ self.person_ref_list because they link to persons and sources * src/DataViews/_PersonView.py (delete_person_response): Remove person from other persons as well because of PersonRef. - + * src/DisplayTabs/_PersonRefEmbedList.py, + * src/DdTargets.py, + * src/ScratchPad.py: Fix support of PersonRef DnD 2006-11-09 Alex Roitman * src/Filters/Rules/Person/_HasDeath.py (apply): Match any of the diff --git a/gramps2/src/DdTargets.py b/gramps2/src/DdTargets.py index b30ee33d3..4cb140441 100644 --- a/gramps2/src/DdTargets.py +++ b/gramps2/src/DdTargets.py @@ -123,6 +123,7 @@ class _DdTargets(object): self.PERSON_LINK = _DdType(self,'person-link') self.PERSON_LINK_LIST = _DdType(self,'person-link-list') + self.PERSONREF = _DdType(self,'personref') self.SOURCE_LINK = _DdType(self,'source-link') @@ -147,7 +148,8 @@ class _DdTargets(object): self.PLACE_LINK, self.SOURCE_LINK, self.PERSON_LINK, - self.PERSON_LINK_LIST] + self.PERSON_LINK_LIST, + self.PERSONREF] self.CHILD = _DdType(self,'child') self.SPOUSE = _DdType(self,'spouse') diff --git a/gramps2/src/DisplayTabs/_PersonRefEmbedList.py b/gramps2/src/DisplayTabs/_PersonRefEmbedList.py index 69a595856..8c2920fd2 100644 --- a/gramps2/src/DisplayTabs/_PersonRefEmbedList.py +++ b/gramps2/src/DisplayTabs/_PersonRefEmbedList.py @@ -46,7 +46,7 @@ from _EmbeddedList import EmbeddedList class PersonRefEmbedList(EmbeddedList): _HANDLE_COL = 3 - _DND_TYPE = DdTargets.PERSON_LINK + _DND_TYPE = DdTargets.PERSONREF _column_names = [ (_('Name'), 0, 250), @@ -106,8 +106,7 @@ class PersonRefEmbedList(EmbeddedList): """ try: from Editors import EditPersonRef - ref = RelLib.PersonRef() - ref.ref = obj + ref = RelLib.PersonRef(obj) ref.rel = _('Unknown') EditPersonRef( self.dbstate, self.uistate, self.track, diff --git a/gramps2/src/ScratchPad.py b/gramps2/src/ScratchPad.py index 07b25b2b2..f12f78c34 100644 --- a/gramps2/src/ScratchPad.py +++ b/gramps2/src/ScratchPad.py @@ -579,6 +579,24 @@ class ScratchPadMediaRef(ScratchPadGrampsTypeWrapper): def tooltip(self): return "" + +class ScratchPadPersonRef(ScratchPadGrampsTypeWrapper): + + DROP_TARGETS = [DdTargets.PERSONREF] + DRAG_TARGET = DdTargets.PERSONREF + ICON = LINK_PIC + + def __init__(self, dbstate, obj): + ScratchPadGrampsTypeWrapper.__init__(self, dbstate, obj) + self._type = _("Person Reference") + + person = self._db.get_person_from_handle(self._obj.get_reference_handle()) + self._title = self._obj.get_relation() + self._value = person.get_primary_name().get_name() + + def tooltip(self): + return "" + class ScratchPersonLink(ScratchPadWrapper): DROP_TARGETS = [DdTargets.PERSON_LINK] @@ -877,6 +895,7 @@ class ScratchPadListView: self.register_wrapper_class(ScratchSourceLink) self.register_wrapper_class(ScratchPersonLink) self.register_wrapper_class(ScratchPersonLinkList) + self.register_wrapper_class(ScratchPadPersonRef) self.register_wrapper_class(ScratchPadText) def register_wrapper_class(self,wrapper_class):