* 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 a90191199e
commit df37c5296f
4 changed files with 10 additions and 33 deletions

View File

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

View File

@ -36,7 +36,7 @@ from gtk.gdk import ACTION_COPY, BUTTON1_MASK
#
#-------------------------------------------------------------------------
import const
import sort
import Sort
import Utils
import GrampsCfg
import AddSpouse
@ -1381,7 +1381,7 @@ class FamilyView:
if not birth:
continue
bday = birth.get_date_object()
child_date = sort.build_sort_date(bday)
child_date = Sort.build_sort_date(bday)
if (child_date == "99999999"):
continue
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
import GrampsCfg
import sort
import const
#-------------------------------------------------------------------------
@ -1246,8 +1245,6 @@ class Person(SourceNote):
bday,
dday,
self.get_primary_name().get_sort_name(),
# sort.build_sort_date(bday),
# sort.build_sort_date(dday),
bday, dday,
GrampsCfg.display_surname(self.primary_name)]

View File

@ -28,7 +28,6 @@
#
#------------------------------------------------------------------------
import os
import sort
#------------------------------------------------------------------------
#
@ -39,6 +38,7 @@ import Report
import BaseDoc
import Errors
import Date
import Sort
from Utils import get_xpm_image
from QuestionDialog import ErrorDialog
from gettext import gettext as _
@ -75,6 +75,8 @@ class DescendantReport:
self.doc.init()
else:
self.standalone = 0
sort = Sort.Sort(self.database)
self.by_birthdate = sort.by_birthdate
def dump_dates(self, person):
birth_id = person.get_birth_id()
@ -136,28 +138,6 @@ class DescendantReport:
child = self.database.find_person_from_id(child_id)
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