family drag-n-drop support

svn: r6091
This commit is contained in:
Don Allingham 2006-03-06 20:59:00 +00:00
parent 913cdc4095
commit 84b995dd6a
2 changed files with 33 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2006-03-06 Don Allingham <don@gramps-project.org>
* src/Editors/_EditFamily.py: handle the fact that family
information is not a simple list.
2006-03-05 Don Allingham <don@gramps-project.org> 2006-03-05 Don Allingham <don@gramps-project.org>
* src/Editors/_EditEventRef.py: add vs. commit handling * src/Editors/_EditEventRef.py: add vs. commit handling
* src/Editors/_EditPerson.py: handle None as person * src/Editors/_EditPerson.py: handle None as person

View File

@ -106,6 +106,35 @@ class ChildEmbedList(EmbeddedList):
EmbeddedList.__init__(self, dbstate, uistate, track, EmbeddedList.__init__(self, dbstate, uistate, track,
_('Children'), ChildModel) _('Children'), ChildModel)
def find_index(self,obj):
"""
returns the index of the object within the associated data
"""
return self.family.get_child_handle_list().index(obj)
def _find_row(self,x,y):
row = self.tree.get_path_at_pos(x,y)
if row == None:
return len(self.family.get_child_handle_list())
else:
return row[0][0]
def _handle_drag(self, row, obj):
self.family.get_child_handle_list().insert(row,obj)
self.changed = True
self.rebuild()
def _move(self, row_from, row_to, obj):
dlist = self.family.get_child_handle_list()
if row_from < row_to:
dlist.insert(row_to,obj)
del dlist[row_from]
else:
del dlist[row_from]
dlist.insert(row_to-1,obj)
self.changed = True
self.rebuild()
def build_columns(self): def build_columns(self):
""" """
We can't use the default build_columns in the base class, because We can't use the default build_columns in the base class, because