* src/Editors/_EditFamily.py: handle drag-n-drop for childrefs
separately svn: r6927
This commit is contained in:
parent
fe75f503e0
commit
fcd6deacd0
@ -1,4 +1,6 @@
|
|||||||
2006-06-20 Don Allingham <don@gramps-project.org>
|
2006-06-20 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/Editors/_EditFamily.py: handle drag-n-drop for childrefs
|
||||||
|
separately
|
||||||
* src/Editors/_EditEvent.py: focus on date on open
|
* src/Editors/_EditEvent.py: focus on date on open
|
||||||
* src/Editors/_EditEventRef.py: focus on date on open
|
* src/Editors/_EditEventRef.py: focus on date on open
|
||||||
* src/UndoHistory.py: don't attempt to unregister with the window
|
* src/UndoHistory.py: don't attempt to unregister with the window
|
||||||
|
@ -169,7 +169,7 @@ class EmbeddedList(ButtonTab):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# pickle the data, and build the tuple to be passed
|
# pickle the data, and build the tuple to be passed
|
||||||
value = (self._DND_TYPE.drag_type, id(self), obj,self.find_index(obj))
|
value = (self._DND_TYPE.drag_type, id(self), obj, self.find_index(obj))
|
||||||
data = pickle.dumps(value)
|
data = pickle.dumps(value)
|
||||||
|
|
||||||
# pass as a string (8 bits)
|
# pass as a string (8 bits)
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
import pickle
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -124,7 +125,8 @@ class ChildEmbedList(EmbeddedList):
|
|||||||
"""
|
"""
|
||||||
returns the index of the object within the associated data
|
returns the index of the object within the associated data
|
||||||
"""
|
"""
|
||||||
return self.family.get_child_ref_list().index(obj)
|
reflist = [ref.ref for ref in self.family.get_child_ref_list()]
|
||||||
|
return reflist.index(obj)
|
||||||
|
|
||||||
def _find_row(self,x,y):
|
def _find_row(self,x,y):
|
||||||
row = self.tree.get_path_at_pos(x,y)
|
row = self.tree.get_path_at_pos(x,y)
|
||||||
@ -259,6 +261,37 @@ class ChildEmbedList(EmbeddedList):
|
|||||||
ref, self.child_ref_edited)
|
ref, self.child_ref_edited)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
def drag_data_received(self, widget, context, x, y, sel_data, info, time):
|
||||||
|
"""
|
||||||
|
Handle the standard gtk interface for drag_data_received.
|
||||||
|
|
||||||
|
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:
|
||||||
|
(mytype, selfid, obj, row_from) = pickle.loads(sel_data.data)
|
||||||
|
|
||||||
|
# make sure this is the correct DND type for this object
|
||||||
|
if mytype == self._DND_TYPE.drag_type:
|
||||||
|
|
||||||
|
# determine the destination row
|
||||||
|
row = self._find_row(x, y)
|
||||||
|
|
||||||
|
# if the is same object, we have a move, otherwise,
|
||||||
|
# it is a standard drag-n-drop
|
||||||
|
|
||||||
|
if id(self) == selfid:
|
||||||
|
obj = self.get_data().get_child_ref_list()[row_from]
|
||||||
|
self._move(row_from, row, obj)
|
||||||
|
else:
|
||||||
|
handle = obj
|
||||||
|
obj = RelLib.ChildRef()
|
||||||
|
obj.ref = handle
|
||||||
|
self._handle_drag(row, obj)
|
||||||
|
self.rebuild()
|
||||||
|
elif self._DND_EXTRA and mytype == self._DND_EXTRA.drag_type:
|
||||||
|
self.handle_extra_type(mytype, obj)
|
||||||
|
|
||||||
def north_american(self):
|
def north_american(self):
|
||||||
father_handle = self.family.get_father_handle()
|
father_handle = self.family.get_father_handle()
|
||||||
if father_handle:
|
if father_handle:
|
||||||
|
Loading…
Reference in New Issue
Block a user