pychecker fixes, GEDCOM import/export improvements, calendar improvements

svn: r1250
This commit is contained in:
Don Allingham
2003-01-10 05:21:32 +00:00
parent 711323177a
commit 7f514dac82
48 changed files with 489 additions and 480 deletions

View File

@@ -922,70 +922,6 @@ class Gramps:
self.status_text(name)
return 0
def on_child_list_row_move(self,clist,fm,to):
"""Validate whether or not this child can be moved within the clist.
This routine is called in the middle of the clist's callbacks, so
the state can be confusing. If the code is being debugged, the
display at this point shows that the list has been reordered when in
actuality it hasn't. All accesses to the clist data structure
reference the state just prior to the move.
This routine must keep/compute its own list indices as the functions
list.remove(), list.insert(), list.reverse() etc. do not affect the
values returned from the list.index() routine."""
family = clist.get_data("f")
# Create a list based upon the current order of the clist
clist_order = []
for i in range(clist.rows):
clist_order = clist_order + [clist.get_row_data(i)]
child = clist_order[fm]
# This function deals with ascending order lists. Convert if
# necessary.
if (self.child_sort.sort_direction() == GTK.SORT_DESCENDING):
clist_order.reverse()
max_index = len(clist_order) - 1
fm = max_index - fm
to = max_index - to
# Create a new list to match the requested order
desired_order = clist_order[:fm] + clist_order[fm+1:]
desired_order = desired_order[:to] + [child] + desired_order[to:]
# Check birth date order in the new list
if (EditPerson.birth_dates_in_order(desired_order) == 0):
clist.emit_stop_by_name("row_move")
msg = _("Invalid move. Children must be ordered by birth date.")
WarningDialog(msg)
return
# OK, this birth order works too. Update the family data structures.
family.setChildList(desired_order)
# Build a mapping of child item to list position. This would not
# be necessary if indices worked properly
i = 0
new_order = {}
for tmp in desired_order:
new_order[tmp] = i
i = i + 1
# Convert the original list back to whatever ordering is being
# used by the clist itself.
if self.child_sort.sort_direction() == GTK.SORT_DESCENDING:
clist_order.reverse()
# Update the clist indices so any change of sorting works
i = 0
for tmp in clist_order:
clist.set_text(i,0,"%2d"%(new_order[tmp]+1))
i = i + 1
# Need to save the changed order
Utils.modified()
def on_open_activate(self,obj):
wFs = gtk.glade.XML(const.revisionFile, "dbopen")
wFs.signal_autoconnect({