* src/NameDisplay.py (sorted): Use sorted name, not display name flag.
* src/Sort.py (by_sorted_name): Add method. * src/WebPage (dump_index): Proper sorting, for both last name sections and the names within each section. svn: r4679
This commit is contained in:
@ -1,6 +1,11 @@
|
|||||||
2005-05-25 Alex Roitman <shura@gramps-project.org>
|
2005-05-25 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/WriteGedcom.py (write_person): Typo.
|
* src/WriteGedcom.py (write_person): Typo.
|
||||||
|
|
||||||
|
* src/NameDisplay.py (sorted): Use sorted name, not display name flag.
|
||||||
|
* src/Sort.py (by_sorted_name): Add method.
|
||||||
|
* src/WebPage (dump_index): Proper sorting, for both last name
|
||||||
|
sections and the names within each section.
|
||||||
|
|
||||||
2005-05-25 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
2005-05-25 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
* src/plugins/ScratchPad.py: disabled search because it does not do
|
* src/plugins/ScratchPad.py: disabled search because it does not do
|
||||||
what the user expects.
|
what the user expects.
|
||||||
|
@ -83,7 +83,7 @@ class NameDisplay:
|
|||||||
@rtype: str
|
@rtype: str
|
||||||
"""
|
"""
|
||||||
name = person.get_primary_name()
|
name = person.get_primary_name()
|
||||||
if name.display_as == RelLib.Name.FNLN:
|
if name.get_sort_as() == RelLib.Name.FNLN:
|
||||||
return self._fnln(name)
|
return self._fnln(name)
|
||||||
else:
|
else:
|
||||||
return self._lnfn(name)
|
return self._lnfn(name)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2004 Donald N. Allingham
|
# Copyright (C) 2000-2005 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -27,18 +27,24 @@ and directly use class members. For this reason, care needs to be taken
|
|||||||
to make sure these remain in sync with the rest of the design.
|
to make sure these remain in sync with the rest of the design.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Standard python modules
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Imported Modules
|
# GRAMPS Modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import Date
|
import Date
|
||||||
|
from NameDisplay import displayer as _nd
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Functions
|
# Constants
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -52,7 +58,6 @@ class Sort:
|
|||||||
def __init__(self,database):
|
def __init__(self,database):
|
||||||
self.database = database
|
self.database = database
|
||||||
|
|
||||||
|
|
||||||
def by_last_name(self,first_id,second_id):
|
def by_last_name(self,first_id,second_id):
|
||||||
"""Sort routine for comparing two last names. If last names are equal,
|
"""Sort routine for comparing two last names. If last names are equal,
|
||||||
uses the given name and suffix"""
|
uses the given name and suffix"""
|
||||||
@ -75,6 +80,19 @@ class Sort:
|
|||||||
else:
|
else:
|
||||||
return locale.strcoll(fsn, ssn)
|
return locale.strcoll(fsn, ssn)
|
||||||
|
|
||||||
|
def by_sorted_name(self,first_id,second_id):
|
||||||
|
"""
|
||||||
|
Sort routine for comparing two displayed names.
|
||||||
|
"""
|
||||||
|
|
||||||
|
first = self.database.get_person_from_handle(first_id)
|
||||||
|
second = self.database.get_person_from_handle(second_id)
|
||||||
|
|
||||||
|
name1 = _nd.sorted(first)
|
||||||
|
name2 = _nd.sorted(second)
|
||||||
|
|
||||||
|
return locale.strcoll(name1,name2)
|
||||||
|
|
||||||
def by_birthdate(self,first_id,second_id):
|
def by_birthdate(self,first_id,second_id):
|
||||||
"""Sort routine for comparing two people by birth dates. If the birth dates
|
"""Sort routine for comparing two people by birth dates. If the birth dates
|
||||||
are equal, sorts by name"""
|
are equal, sorts by name"""
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import locale
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
@ -57,6 +58,7 @@ import Errors
|
|||||||
import Utils
|
import Utils
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
import ReportOptions
|
import ReportOptions
|
||||||
|
from NameDisplay import displayer as _nd
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -943,8 +945,6 @@ class WebReport(Report.Report):
|
|||||||
doc.write_text(_("Family Tree Index"))
|
doc.write_text(_("Family Tree Index"))
|
||||||
doc.end_paragraph()
|
doc.end_paragraph()
|
||||||
|
|
||||||
person_handle_list.sort(self.sort.by_last_name)
|
|
||||||
|
|
||||||
a = {}
|
a = {}
|
||||||
for person_handle in person_handle_list:
|
for person_handle in person_handle_list:
|
||||||
person = self.database.get_person_from_handle(person_handle)
|
person = self.database.get_person_from_handle(person_handle)
|
||||||
@ -956,7 +956,7 @@ class WebReport(Report.Report):
|
|||||||
|
|
||||||
section_number = 1
|
section_number = 1
|
||||||
link_keys = a.keys()
|
link_keys = a.keys()
|
||||||
link_keys.sort()
|
link_keys.sort(locale.strcoll)
|
||||||
for n in link_keys:
|
for n in link_keys:
|
||||||
a[n] = section_number
|
a[n] = section_number
|
||||||
section_number = section_number + 1
|
section_number = section_number + 1
|
||||||
@ -980,6 +980,7 @@ class WebReport(Report.Report):
|
|||||||
p_id_list = [ p_id for p_id in person_handle_list if \
|
p_id_list = [ p_id for p_id in person_handle_list if \
|
||||||
(self.database.get_person_from_handle(p_id).get_primary_name().get_surname() \
|
(self.database.get_person_from_handle(p_id).get_primary_name().get_surname() \
|
||||||
and (self.database.get_person_from_handle(p_id).get_primary_name().get_surname()[0] == n) ) ]
|
and (self.database.get_person_from_handle(p_id).get_primary_name().get_surname()[0] == n) ) ]
|
||||||
|
p_id_list.sort(self.sort.by_sorted_name)
|
||||||
doc = HtmlLinkDoc(self.selected_style,None,template,None)
|
doc = HtmlLinkDoc(self.selected_style,None,template,None)
|
||||||
doc.set_extension(self.ext)
|
doc.set_extension(self.ext)
|
||||||
doc.set_title(_("Section %s") % n)
|
doc.set_title(_("Section %s") % n)
|
||||||
@ -998,7 +999,7 @@ class WebReport(Report.Report):
|
|||||||
|
|
||||||
for person_handle in p_id_list:
|
for person_handle in p_id_list:
|
||||||
the_person = self.database.get_person_from_handle(person_handle)
|
the_person = self.database.get_person_from_handle(person_handle)
|
||||||
name = the_person.get_primary_name().get_name()
|
name = _nd.sorted(the_person)
|
||||||
|
|
||||||
if self.birth_dates:
|
if self.birth_dates:
|
||||||
birth_handle = self.database.get_person_from_handle(person_handle).get_birth_handle()
|
birth_handle = self.database.get_person_from_handle(person_handle).get_birth_handle()
|
||||||
@ -1040,6 +1041,7 @@ class WebReport(Report.Report):
|
|||||||
p_id_list = [ p_id for p_id in person_handle_list if \
|
p_id_list = [ p_id for p_id in person_handle_list if \
|
||||||
(self.database.get_person_from_handle(p_id).get_primary_name().get_surname() \
|
(self.database.get_person_from_handle(p_id).get_primary_name().get_surname() \
|
||||||
and (self.database.get_person_from_handle(p_id).get_primary_name().get_surname()[0] == n) ) ]
|
and (self.database.get_person_from_handle(p_id).get_primary_name().get_surname()[0] == n) ) ]
|
||||||
|
p_id_list.sort(self.sort.by_sorted_name)
|
||||||
doc.start_paragraph('IndexLabel')
|
doc.start_paragraph('IndexLabel')
|
||||||
if self.include_alpha_links:
|
if self.include_alpha_links:
|
||||||
doc.write_linktarget("%03d" % a[n])
|
doc.write_linktarget("%03d" % a[n])
|
||||||
@ -1049,7 +1051,7 @@ class WebReport(Report.Report):
|
|||||||
|
|
||||||
for person_handle in p_id_list:
|
for person_handle in p_id_list:
|
||||||
the_person = self.database.get_person_from_handle(person_handle)
|
the_person = self.database.get_person_from_handle(person_handle)
|
||||||
name = the_person.get_primary_name().get_name()
|
name = _nd.sorted(the_person)
|
||||||
|
|
||||||
if self.birth_dates:
|
if self.birth_dates:
|
||||||
birth_handle = self.database.get_person_from_handle(person_handle).get_birth_handle()
|
birth_handle = self.database.get_person_from_handle(person_handle).get_birth_handle()
|
||||||
|
Reference in New Issue
Block a user