* src/EditPerson.py: Switch to Sort.py.

* src/FamilyView.py: Switch to Sort.py.
* src/RelLib.py: Remove unneeded import.
* src/plugins/DescendReport.py: Switch to Sort.py.


svn: r3128
This commit is contained in:
Alex Roitman 2004-05-05 02:21:47 +00:00
parent c7fa1403b3
commit 3adb17e2b1
4 changed files with 10 additions and 33 deletions

View File

@ -49,7 +49,7 @@ import const
import Utils import Utils
import GrampsCfg import GrampsCfg
import ImageSelect import ImageSelect
import sort import Sort
import AutoComp import AutoComp
import ListModel import ListModel
import RelLib import RelLib
@ -1738,7 +1738,7 @@ class EditPerson:
if child.get_birth_id(): if child.get_birth_id():
event = self.db.find_event_from_id(child.get_birth_id()) event = self.db.find_event_from_id(child.get_birth_id())
bday = event.get_date_object() bday = event.get_date_object()
child_date = sort.build_sort_date(bday) child_date = Sort.build_sort_date(bday)
else: else:
continue continue
if (prev_date <= child_date): # <= allows for twins if (prev_date <= child_date): # <= allows for twins
@ -1759,7 +1759,7 @@ class EditPerson:
event_id = person.get_birth_id() event_id = person.get_birth_id()
if event_id: if event_id:
event = self.db.find_event_from_id(event_id) event = self.db.find_event_from_id(event_id)
person_bday = sort.build_sort_date(event.get_date_object()) person_bday = Sort.build_sort_date(event.get_date_object())
else: else:
person_bday = "99999999" person_bday = "99999999"
@ -1771,7 +1771,7 @@ class EditPerson:
event_id = other.get_birth_id() event_id = other.get_birth_id()
if event_id: if event_id:
event = self.db.find_event_from_id(event_id) event = self.db.find_event_from_id(event_id)
other_bday = sort.build_sort_date(event.get_date_object()) other_bday = Sort.build_sort_date(event.get_date_object())
if (other_bday == "99999999"): if (other_bday == "99999999"):
continue; continue;
if (person_bday < other_bday): if (person_bday < other_bday):
@ -1786,7 +1786,7 @@ class EditPerson:
event_id = other.get_birth_id() event_id = other.get_birth_id()
if event_id: if event_id:
event = self.db.find_event_from_id(event_id) event = self.db.find_event_from_id(event_id)
other_bday = sort.build_sort_date(event.get_date_object()) other_bday = Sort.build_sort_date(event.get_date_object())
if (other_bday == "99999999"): if (other_bday == "99999999"):
continue; continue;
if (person_bday > other_bday): if (person_bday > other_bday):

View File

@ -36,7 +36,7 @@ from gtk.gdk import ACTION_COPY, BUTTON1_MASK
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import sort import Sort
import Utils import Utils
import GrampsCfg import GrampsCfg
import AddSpouse import AddSpouse
@ -1381,7 +1381,7 @@ class FamilyView:
if not birth: if not birth:
continue continue
bday = birth.get_date_object() bday = birth.get_date_object()
child_date = sort.build_sort_date(bday) child_date = Sort.build_sort_date(bday)
if (child_date == "99999999"): if (child_date == "99999999"):
continue continue
if (prev_date <= child_date): # <= allows for twins if (prev_date <= child_date): # <= allows for twins

View File

@ -42,7 +42,6 @@ import types
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from Date import Date, SingleDate, compare_dates, not_too_old from Date import Date, SingleDate, compare_dates, not_too_old
import GrampsCfg import GrampsCfg
import sort
import const import const
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -1246,8 +1245,6 @@ class Person(SourceNote):
bday, bday,
dday, dday,
self.get_primary_name().get_sort_name(), self.get_primary_name().get_sort_name(),
# sort.build_sort_date(bday),
# sort.build_sort_date(dday),
bday, dday, bday, dday,
GrampsCfg.display_surname(self.primary_name)] GrampsCfg.display_surname(self.primary_name)]

View File

@ -28,7 +28,6 @@
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import os import os
import sort
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -39,6 +38,7 @@ import Report
import BaseDoc import BaseDoc
import Errors import Errors
import Date import Date
import Sort
from Utils import get_xpm_image from Utils import get_xpm_image
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
from gettext import gettext as _ from gettext import gettext as _
@ -75,6 +75,8 @@ class DescendantReport:
self.doc.init() self.doc.init()
else: else:
self.standalone = 0 self.standalone = 0
sort = Sort.Sort(self.database)
self.by_birthdate = sort.by_birthdate
def dump_dates(self, person): def dump_dates(self, person):
birth_id = person.get_birth_id() birth_id = person.get_birth_id()
@ -136,28 +138,6 @@ class DescendantReport:
child = self.database.find_person_from_id(child_id) child = self.database.find_person_from_id(child_id)
self.dump(level+1,child) self.dump(level+1,child)
def by_birthdate(self, first_id, second_id) :
"""Sort routine for comparing two people by birth dates.
If the birth dates are equal, sorts by name"""
first = self.database.find_person_from_id(first_id)
second = self.database.find_person_from_id(second_id)
birth1_id = first.get_birth_id()
if birth1_id:
date1 = self.database.find_event_from_id(birth1_id).get_date_object()
else:
date1 = Date.Date()
birth2_id = second.get_birth_id()
if birth2_id:
date2 = self.database.find_event_from_id(birth2_id).get_date_object()
else:
date2 = Date.Date()
val = Date.compare_dates(date1,date2)
if val == 0:
return sort.by_last_name(first,second)
return val
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# DescendantReportDialog # DescendantReportDialog