2006-09-03 Don Allingham <don@gramps-project.org>

* src/ScratchPad.py: add dnd support for MediaRefs (bug #417)
	* src/DdTargets.py: add dnd support for MediaRefs (bug #417)



svn: r7301
This commit is contained in:
Don Allingham 2006-09-03 22:14:47 +00:00
parent 3db3e8ed6a
commit 81e5d2a251
3 changed files with 30 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2006-09-03 Don Allingham <don@gramps-project.org>
* src/ScratchPad.py: add dnd support for MediaRefs (bug #417)
* src/DdTargets.py: add dnd support for MediaRefs (bug #417)
2006-09-02 Don Allingham <don@gramps-project.org>
* src/DisplayTabs/_EventEmbedList.py: Don't override event type on
a drag-n-drop (bug #420)

View File

@ -141,14 +141,14 @@ class _DdTargets(object):
self.NAME,
self.REPOREF,
self.MEDIAOBJ,
self.MEDIAREF,
self.REPO_LINK,
self.SOURCE_LINK,
self.PERSON_LINK,
self.PERSON_LINK_LIST]
self.CHILD = _DdType(self,'child')
self.SPOUSE = _DdType(self,'spouse')
self.CHILD = _DdType(self,'child')
self.SPOUSE = _DdType(self,'spouse')
self.TEXT = _DdType(self,'TEXT',0,1)
self.TEXT_MIME = _DdType(self,'text/plain',0,0)
self.STRING = _DdType(self,'STRING', 0, 2)

View File

@ -503,10 +503,13 @@ class ScratchMediaObj(ScratchPadWrapper):
def __init__(self, db, obj):
ScratchPadWrapper.__init__(self, db, obj)
(drag_type, idval, handle, val) = pickle.loads(obj)
self._type = _("Media Object")
self._title = ""
self._value = ""
obj = db.get_object_from_handle(handle)
self._title = obj.get_description()
self._value = obj.get_path()
def tooltip(self):
global escape
@ -514,6 +517,23 @@ class ScratchMediaObj(ScratchPadWrapper):
"%s" % (_("Media Object"),
escape(self._obj))
class ScratchPadMediaRef(ScratchPadGrampsTypeWrapper):
DROP_TARGETS = [DdTargets.MEDIAREF]
DRAG_TARGET = DdTargets.MEDIAREF
ICON = LINK_PIC
def __init__(self, db, obj):
ScratchPadGrampsTypeWrapper.__init__(self, db, obj)
self._type = _("Media Reference")
base = self._db.get_object_from_handle(self._obj.get_reference_handle())
self._title = base.get_description()
self._value = base.get_path()
def tooltip(self):
return ""
class ScratchPersonLink(ScratchPadWrapper):
DROP_TARGETS = [DdTargets.PERSON_LINK]
@ -765,6 +785,7 @@ class ScratchPadListView:
self.register_wrapper_class(ScratchPadName)
self.register_wrapper_class(ScratchRepositoryLink)
self.register_wrapper_class(ScratchMediaObj)
self.register_wrapper_class(ScratchPadMediaRef)
self.register_wrapper_class(ScratchSourceLink)
self.register_wrapper_class(ScratchPersonLink)
self.register_wrapper_class(ScratchPersonLinkList)