* src/plugins/NarrativeWeb.py: fix name sorting in Windows (bug #236)

svn: r7037
This commit is contained in:
Brian Matherly 2006-07-18 02:59:18 +00:00
parent c24c9c1d94
commit 9200e01c56
2 changed files with 15 additions and 2 deletions

View File

@ -1,5 +1,6 @@
2006-07-17 Brian Matherly <brian@gramps-project.org>
* src/plugins/NarrativeWeb.py: typo
* src/plugins/NarrativeWeb.py: fix name sorting in Windows (bug #236)
2006-07-16 Alex Roitman <shura@gramps-project.org>
* src/DisplayTabs/_GalleryTab.py (GalleryTab.build_interface):

View File

@ -2734,14 +2734,26 @@ def sort_people(db,handle_list):
sorted_lists = []
temp_list = sname_sub.keys()
temp_list.sort(locale.strcoll)
temp_list.sort(strcoll_case_sensitive)
for name in temp_list:
slist = map(lambda x: (sortnames[x],x),sname_sub[name])
slist.sort(lambda x,y: locale.strcoll(x[0],y[0]))
slist.sort(lambda x,y: strcoll_case_sensitive(x[0],y[0]))
entries = map(lambda x: x[1], slist)
sorted_lists.append((name,entries))
return sorted_lists
def strcoll_case_sensitive(string1,string2):
""" This function was written because string comparisons in Windows
seem to be case insensitive if the string is longer than
one character. """
# First, compare the first character
diff = locale.strcoll(string1[0],string2[0])
if diff == 0:
# If the first character is the same, compare the rest
diff = locale.strcoll(string1,string2)
return diff
#------------------------------------------------------------------------
#
#