* src/Sort.py: use locale.strcoll for sorting

* src/RelLib.py: don't use accent for sort name
* src/EditPerson.py: compare edited ID value properly
* src/Marriage.py: compare edited ID value properly
* src/PeopleModel.py: use locale.strcoll for comparing
* src/GrampsBSDDB.py: use locale.strcoll for comparing/sorting
* src/GrampsDbBase.py: use locale.strcoll for comparing/sorting
* src/DbPrompter.py: handle bad filenames a bit better


svn: r3514
This commit is contained in:
Don Allingham 2004-08-26 21:54:14 +00:00
parent e3f151a7a8
commit 1dc536fd60
9 changed files with 46 additions and 23 deletions

View File

@ -1,3 +1,13 @@
2004-08-26 Don Allingham <dallingham@users.sourceforge.net>
* src/Sort.py: use locale.strcoll for sorting
* src/RelLib.py: don't use accent for sort name
* src/EditPerson.py: compare edited ID value properly
* src/Marriage.py: compare edited ID value properly
* src/PeopleModel.py: use locale.strcoll for comparing
* src/GrampsBSDDB.py: use locale.strcoll for comparing/sorting
* src/GrampsDbBase.py: use locale.strcoll for comparing/sorting
* src/DbPrompter.py: handle bad filenames a bit better
2004-08-25 Don Allingham <dallingham@users.sourceforge.net>
* src/gramps_main.py: update properly after an edit
* src/Utils.py: generate correct path name, using gramps id

View File

@ -358,9 +358,12 @@ class NewNativeDbPrompter:
choose.set_current_folder(default_dir)
choose.set_current_name(os.path.split(new_filename)[1])
while (True):
response = choose.run()
if response == gtk.RESPONSE_OK:
filename = choose.get_filename()
if filename == None:
continue
if os.path.splitext(filename)[1] != ".grdb":
filename = filename + ".grdb"
choose.destroy()

View File

@ -1099,6 +1099,8 @@ class EditPerson:
self.notes_buffer.get_end_iter(),gtk.FALSE))
format = self.preform.get_active()
idval = unicode(self.gid.get_text())
if idval == "":
idval = None
changed = 0
name = self.person.get_primary_name()

View File

@ -22,6 +22,7 @@
import os
import time
import locale
from RelLib import *
from GrampsDbBase import *
@ -158,7 +159,7 @@ class GrampsBSDDB(GrampsDbBase):
for name in names:
a[unicode(name)] = 1
vals = a.keys()
vals.sort(accent.sort_by_accent)
vals.sort(locale.strcoll)
return vals
def get_person_event_type_list(self):

View File

@ -33,6 +33,7 @@ from this class.
from RelLib import *
import cPickle
import time
import locale
from gettext import gettext as _
#-------------------------------------------------------------------------
@ -968,21 +969,21 @@ class GrampsDbBase:
def _sortbyname(self,f,s):
n1 = self.person_map.get(str(f))[2].sname
n2 = self.person_map.get(str(s))[2].sname
return cmp(n1,n2)
return locale.strcoll(n1,n2)
def _sortbyplace(self,f,s):
return cmp(self.place_map.get(str(f))[2].upper(),
return locale.strcoll(self.place_map.get(str(f))[2].upper(),
self.place_map.get(str(s))[2].upper())
def _sortbysource(self,f,s):
fp = self.source_map[str(f)][2].upper()
sp = self.source_map[str(s)][2].upper()
return cmp(fp,sp)
return locale.strcoll(fp,sp)
def _sortbymedia(self,f,s):
fp = self.media_map[str(f)][4].upper()
sp = self.media_map[str(s)][4].upper()
return cmp(fp,sp)
return locale.strcoll(fp,sp)
def set_person_column_order(self,list):
"""

View File

@ -523,6 +523,8 @@ class Marriage:
changed = 1
idval = unicode(self.gid.get_text())
if idval == "":
idval = None
if self.family.get_handle() != idval:
changed = 1

View File

@ -27,6 +27,7 @@
#-------------------------------------------------------------------------
from gettext import gettext as _
import time
import locale
#-------------------------------------------------------------------------
#
@ -130,7 +131,7 @@ class PeopleModel(gtk.GenericTreeModel):
def byname(self,f,s):
n1 = self.db.person_map.get(str(f))[_NAME_COL].get_sort_name()
n2 = self.db.person_map.get(str(s))[_NAME_COL].get_sort_name()
return cmp(n1,n2)
return locale.strcoll(n1,n2)
def on_get_flags(self):
'''returns the GtkTreeModelFlags for this particular type of model'''

View File

@ -35,7 +35,6 @@ import os
import os.path
import time
import types
import accent
from gettext import gettext as _
#-------------------------------------------------------------------------
@ -1848,7 +1847,9 @@ class Name(DataObj):
def build_sort_name(self):
if self.surname:
self.sname = accent.deaccent("%-25s%-30s%s" % (self.surname.upper(),self.first_name.upper(),self.suffix.upper()))
self.sname = "%-25s%-30s%s" % (self.surname.upper(),
self.first_name.upper(),
self.suffix.upper())
else:
self.sname = "@"

View File

@ -27,6 +27,8 @@ 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.
"""
import locale
#-------------------------------------------------------------------------
#
# Imported Modules
@ -92,11 +94,11 @@ class Sort:
ffn = name1.get_first_name().upper()
sfn = name2.get_first_name().upper()
if ffn == sfn:
return cmp(name1.get_suffix().upper(), name2.get_suffix().upper())
return locale.strcoll(name1.get_suffix().upper(), name2.get_suffix().upper())
else:
return cmp(ffn, sfn)
return locale.strcoll(ffn, sfn)
else:
return cmp(fsn, ssn)
return locale.strcoll(fsn, ssn)
def by_birthdate(self,first_id,second_id):
"""Sort routine for comparing two people by birth dates. If the birth dates