* src/DisplayState.py (remove_item): Add code to adjust other

item's tracks after deleting an item; (move_item_down):
Recursively walk the items under a given item and lower the track
entry.


svn: r5603
This commit is contained in:
Alex Roitman 2005-12-21 18:24:38 +00:00
parent cf2827bbf1
commit aa11938737
2 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2005-12-21 Alex Roitman <shura@gramps-project.org>
* src/DisplayState.py (remove_item): Add code to adjust other
item's tracks after deleting an item; (move_item_down):
Recursively walk the items under a given item and lower the track
entry.
2005-12-21 Richard Taylor <rjt-gramps@thegrindstone.me.uk> 2005-12-21 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/EditSource.py: fixed small mistake in display_references * src/EditSource.py: fixed small mistake in display_references

View File

@ -242,10 +242,28 @@ class GrampsWindowManager:
parent_item.pop(child_in_parent) parent_item.pop(child_in_parent)
# Adjust each item following the removed one # Adjust each item following the removed one
# so that it's track is down by one on this level # so that it's track is down by one on this level
# MISSING CODE HERE for ix in range(child_in_parent,len(parent_item)):
item = parent_item[ix]
self.move_item_down(item,len(track)-1)
# Rebuild menu # Rebuild menu
self.build_windows_menu() self.build_windows_menu()
def move_item_down(self,item,index):
# This function calls children's move_item_down() method
# to subtract 1 from the children's track component given by index.
if type(item) == list:
# If this item is a branch
# move down the children except for the first one
for sub_item in item[1:]:
self.move_item_down(sub_item,index)
# return the first child
last_item = item[0]
else:
# This item is a leaf -- no children to move down
# return itself
last_item = item
last_item.track[index] -= 1
def add_item(self,track,item): def add_item(self,track,item):
# if the item is identifiable then we need to remember # if the item is identifiable then we need to remember
# its id so that in the future we recall this window # its id so that in the future we recall this window