From 72880d459986ac272e3b456aca9ce2b775490a5f Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 23 Sep 2004 02:25:07 +0000 Subject: [PATCH] * src/EditPerson.py: change sort mechanism to new Date sort value * src/FamilyView.py: change sort mechanism to new Date sort valu * src/Sort.py: remove unused sorting functions svn: r3569 --- ChangeLog | 5 +++++ src/EditPerson.py | 22 ++++++++++------------ src/FamilyView.py | 14 ++++++-------- src/Sort.py | 16 ---------------- 4 files changed, 21 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2cffcc9dd..a0cff8a40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-09-22 Don Allingham + * src/EditPerson.py: change sort mechanism to new Date sort value + * src/FamilyView.py: change sort mechanism to new Date sort valu + * src/Sort.py: remove unused sorting functions + 2004-09-20 Alex Roitman * src/GrampsInMemDB.py: Remove unused modules. diff --git a/src/EditPerson.py b/src/EditPerson.py index ec196bd4f..4d7dd5d36 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -49,7 +49,6 @@ import const import Utils import GrampsCfg import ImageSelect -import Sort import AutoComp import ListModel import RelLib @@ -1777,14 +1776,13 @@ class EditPerson: """Check any *valid* birthdates in the list to insure that they are in numerically increasing order.""" inorder = True - prev_date = "00000000" + prev_date = 0 for i in range(len(list)): child_handle = list[i] child = self.db.get_person_from_handle(child_handle) if child.get_birth_handle(): event = self.db.get_event_from_handle(child.get_birth_handle()) - bday = event.get_date_object() - child_date = Sort.build_sort_date(bday) + child_date = event.get_date_object().get_sort_value() else: continue if (prev_date <= child_date): # <= allows for twins @@ -1805,9 +1803,9 @@ class EditPerson: event_handle = person.get_birth_handle() if event_handle: event = self.db.get_event_from_handle(event_handle) - person_bday = Sort.build_sort_date(event.get_date_object()) + person_bday = event.get_date_object().get_sort_value() else: - person_bday = "99999999" + person_bday = 0 # First, see if the person needs to be moved forward in the list @@ -1818,10 +1816,10 @@ class EditPerson: event_handle = other.get_birth_handle() if event_handle: event = self.db.get_event_from_handle(event_handle) - other_bday = Sort.build_sort_date(event.get_date_object()) - if (other_bday == "99999999"): + other_bday = event.get_date_object().get_sort_value() + if other_bday == 0: continue; - if (person_bday < other_bday): + if person_bday < other_bday: target = i else: continue @@ -1833,10 +1831,10 @@ class EditPerson: event_handle = other.get_birth_handle() if event_handle: event = self.db.get_event_from_handle(event_handle) - other_bday = Sort.build_sort_date(event.get_date_object()) - if (other_bday == "99999999"): + other_bday = event.get_date_object().get_sort_value() + if other_bday == "99999999": continue; - if (person_bday > other_bday): + if person_bday > other_bday: target = i else: continue diff --git a/src/FamilyView.py b/src/FamilyView.py index 99cf61fc2..6a03e2c31 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -36,7 +36,6 @@ from gobject import TYPE_STRING, TYPE_INT # #------------------------------------------------------------------------- import const -import Sort import Utils import GrampsCfg import AddSpouse @@ -1410,8 +1409,8 @@ class FamilyView: def birth_dates_in_order(self,list): """Check any *valid* birthdates in the list to insure that they are in numerically increasing order.""" - inorder = 1 - prev_date = "00000000" + inorder = True + prev_date = 0 for i in range(len(list)): child_handle = list[i] child = self.parent.db.get_person_from_handle(child_handle) @@ -1419,12 +1418,11 @@ class FamilyView: birth = self.parent.db.get_event_from_handle(birth_handle) if not birth: continue - bday = birth.get_date_object() - child_date = Sort.build_sort_date(bday) - if (child_date == "99999999"): + child_date = birth.get_date_object().get_sort_value() + if child_date == 0: continue - if (prev_date <= child_date): # <= allows for twins + if prev_date <= child_date: # <= allows for twins prev_date = child_date else: - inorder = 0 + inorder = False return inorder diff --git a/src/Sort.py b/src/Sort.py index 1a07fca02..4b91c0567 100644 --- a/src/Sort.py +++ b/src/Sort.py @@ -48,22 +48,6 @@ _prefix = {} for i in _plist: _prefix[i] = 1 -def build_sort_name(n): - """Builds a name from a RelLib.Name instance that is suitable for - use as a sort key in a GtkCList. The name is converted to upper case - to provide for case-insenstive sorting""" - if n.Surname: - return "%-25s%-30s%s" % (n.Surname.upper(),n.FirstName.upper(),n.Suffix.upper()) - else: - return "@" - -def build_sort_date(n): - """Builds a date from a Date.Date instance that is suitable for - use as a sort key in a GtkCList. The resultant string is in the format - of YYYYMMDD. Unknown values are given as all nines, so that the - appear at the end""" - return "%010d" % n.get_sort_value() - class Sort: def __init__(self,database): self.database = database