diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 81e3031bc..ad894bdab 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,9 @@ +2006-08-13 Don Allingham + * src/DataViews/_MediaView.py: fix drag-n-drop + * src/DisplayTabs/_GalleryTab.py: handle media obj and media ref + for drag-n-drop + * src/DdTargets.py: add media ref type + 2006-08-12 Brian Matherly * src/plugins/FamilyGroup.py: use family_id instead of spouse_id * src/gramps.py: catch logging error and ignore. diff --git a/gramps2/configure.in b/gramps2/configure.in index feee001d2..c63276eaa 100644 --- a/gramps2/configure.in +++ b/gramps2/configure.in @@ -4,15 +4,15 @@ dnl Process this file with autoconf to produce a configure script. dnl May need to run automake && aclocal first AC_PREREQ(2.57) -AC_INIT(gramps, 2.1.95, [gramps-bugs@lists.sourceforge.net]) +AC_INIT(gramps, 2.1.91, [gramps-bugs@lists.sourceforge.net]) AC_CONFIG_SRCDIR(configure.in) AM_INIT_AUTOMAKE(1.6.3) AC_CONFIG_MACRO_DIR([m4]) GNOME_DOC_INIT -RELEASE=0.SVN$(svnversion -n .) -dnl RELEASE=1 +dnl RELEASE=0.SVN$(svnversion -n .) +RELEASE=1 VERSIONSTRING=$VERSION if test x"$RELEASE" != "x" diff --git a/gramps2/src/DataViews/_MediaView.py b/gramps2/src/DataViews/_MediaView.py index 786065afb..7bfc36434 100644 --- a/gramps2/src/DataViews/_MediaView.py +++ b/gramps2/src/DataViews/_MediaView.py @@ -27,6 +27,7 @@ from gettext import gettext as _ import urlparse import os +import cPickle as pickle #------------------------------------------------------------------------- # @@ -128,17 +129,13 @@ class MediaView(PageView.ListView): of the object """ - # get the selected object, returning if not is defined - obj = self.get_selected() - if not obj: - return + selected_ids = self.selected_handles() - # pickle the data, and build the tuple to be passed - value = (self._DND_TYPE.drag_type, id(self), obj, self.find_index(obj)) - data = pickle.dumps(value) + data = (self.drag_info().drag_type, id(self), selected_ids[0], 0) + sel_data.set(sel_data.target, 8 ,pickle.dumps(data)) - # pass as a string (8 bits) - sel_data.set(sel_data.target, 8, data) + def drag_info(self): + return DdTargets.MEDIAOBJ def find_index(self, obj): """ diff --git a/gramps2/src/DdTargets.py b/gramps2/src/DdTargets.py index 91f5c31d8..272a56e15 100644 --- a/gramps2/src/DdTargets.py +++ b/gramps2/src/DdTargets.py @@ -117,6 +117,7 @@ class _DdTargets(object): self.REPO_LINK = _DdType(self,'repo-link') self.NAME = _DdType(self,'name') self.MEDIAOBJ = _DdType(self,'mediaobj') + self.MEDIAREF = _DdType(self,'mediaref') self.DATA = _DdType(self,'data_tuple') self.PERSON_LINK = _DdType(self,'person-link') diff --git a/gramps2/src/DisplayTabs/_GalleryTab.py b/gramps2/src/DisplayTabs/_GalleryTab.py index 4baced688..fdf5e3397 100644 --- a/gramps2/src/DisplayTabs/_GalleryTab.py +++ b/gramps2/src/DisplayTabs/_GalleryTab.py @@ -66,7 +66,7 @@ def make_launcher(prog, path): #------------------------------------------------------------------------- class GalleryTab(ButtonTab): - _DND_TYPE = DdTargets.MEDIAOBJ + _DND_TYPE = DdTargets.MEDIAREF _DND_EXTRA = DdTargets.URI_LIST def __init__(self, dbstate, uistate, track, media_list, update=None): @@ -276,10 +276,8 @@ class GalleryTab(ButtonTab): variable defined that points to an entry in DdTargets. """ - if self._DND_EXTRA: - dnd_types = [ self._DND_TYPE.target(), self._DND_EXTRA.target() ] - else: - dnd_types = [ self._DND_TYPE.target() ] + dnd_types = [ self._DND_TYPE.target(), self._DND_EXTRA.target(), + DdTargets.MEDIAOBJ.target()] self.iconlist.drag_dest_set(gtk.DEST_DEFAULT_ALL, dnd_types, gtk.gdk.ACTION_COPY) @@ -305,7 +303,10 @@ class GalleryTab(ButtonTab): """ # get the selected object, returning if not is defined - obj = self.get_selected() + + reflist = self.iconlist.get_selected_items() + obj = self.media_list[reflist[0][0]] + if not obj: return @@ -323,7 +324,6 @@ class GalleryTab(ButtonTab): If the selection data is define, extract the value from sel_data.data, and decide if this is a move or a reorder. """ - if sel_data and sel_data.data: try: (mytype, selfid, obj, row_from) = pickle.loads(sel_data.data) @@ -354,6 +354,12 @@ class GalleryTab(ButtonTab): else: self._handle_drag(row, obj) self.rebuild() + elif mytype == DdTargets.MEDIAOBJ.drag_type: + oref = RelLib.MediaRef() + oref.set_reference_handle(obj) + self.get_data().append(oref) + self.changed = True + self.rebuild() elif self._DND_EXTRA and mytype == self._DND_EXTRA.drag_type: self.handle_extra_type(mytype, obj) except pickle.UnpicklingError: