* 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
This commit is contained in:
parent
8ccb4cebe9
commit
72880d4599
@ -1,3 +1,8 @@
|
||||
2004-09-22 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* 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 <shura@alex.neuro.umn.edu>
|
||||
* src/GrampsInMemDB.py: Remove unused modules.
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
16
src/Sort.py
16
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
|
||||
|
Loading…
Reference in New Issue
Block a user