* 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:
parent
e3f151a7a8
commit
1dc536fd60
@ -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>
|
2004-08-25 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
* src/gramps_main.py: update properly after an edit
|
* src/gramps_main.py: update properly after an edit
|
||||||
* src/Utils.py: generate correct path name, using gramps id
|
* src/Utils.py: generate correct path name, using gramps id
|
||||||
|
@ -358,14 +358,17 @@ class NewNativeDbPrompter:
|
|||||||
choose.set_current_folder(default_dir)
|
choose.set_current_folder(default_dir)
|
||||||
choose.set_current_name(os.path.split(new_filename)[1])
|
choose.set_current_name(os.path.split(new_filename)[1])
|
||||||
|
|
||||||
response = choose.run()
|
while (True):
|
||||||
if response == gtk.RESPONSE_OK:
|
response = choose.run()
|
||||||
filename = choose.get_filename()
|
if response == gtk.RESPONSE_OK:
|
||||||
if os.path.splitext(filename)[1] != ".grdb":
|
filename = choose.get_filename()
|
||||||
filename = filename + ".grdb"
|
if filename == None:
|
||||||
choose.destroy()
|
continue
|
||||||
self.parent.read_file(filename)
|
if os.path.splitext(filename)[1] != ".grdb":
|
||||||
return 1
|
filename = filename + ".grdb"
|
||||||
else:
|
choose.destroy()
|
||||||
choose.destroy()
|
self.parent.read_file(filename)
|
||||||
return 0
|
return 1
|
||||||
|
else:
|
||||||
|
choose.destroy()
|
||||||
|
return 0
|
||||||
|
@ -1099,6 +1099,8 @@ class EditPerson:
|
|||||||
self.notes_buffer.get_end_iter(),gtk.FALSE))
|
self.notes_buffer.get_end_iter(),gtk.FALSE))
|
||||||
format = self.preform.get_active()
|
format = self.preform.get_active()
|
||||||
idval = unicode(self.gid.get_text())
|
idval = unicode(self.gid.get_text())
|
||||||
|
if idval == "":
|
||||||
|
idval = None
|
||||||
|
|
||||||
changed = 0
|
changed = 0
|
||||||
name = self.person.get_primary_name()
|
name = self.person.get_primary_name()
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import locale
|
||||||
|
|
||||||
from RelLib import *
|
from RelLib import *
|
||||||
from GrampsDbBase import *
|
from GrampsDbBase import *
|
||||||
@ -158,7 +159,7 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
for name in names:
|
for name in names:
|
||||||
a[unicode(name)] = 1
|
a[unicode(name)] = 1
|
||||||
vals = a.keys()
|
vals = a.keys()
|
||||||
vals.sort(accent.sort_by_accent)
|
vals.sort(locale.strcoll)
|
||||||
return vals
|
return vals
|
||||||
|
|
||||||
def get_person_event_type_list(self):
|
def get_person_event_type_list(self):
|
||||||
|
@ -33,6 +33,7 @@ from this class.
|
|||||||
from RelLib import *
|
from RelLib import *
|
||||||
import cPickle
|
import cPickle
|
||||||
import time
|
import time
|
||||||
|
import locale
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -968,21 +969,21 @@ class GrampsDbBase:
|
|||||||
def _sortbyname(self,f,s):
|
def _sortbyname(self,f,s):
|
||||||
n1 = self.person_map.get(str(f))[2].sname
|
n1 = self.person_map.get(str(f))[2].sname
|
||||||
n2 = self.person_map.get(str(s))[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):
|
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())
|
self.place_map.get(str(s))[2].upper())
|
||||||
|
|
||||||
def _sortbysource(self,f,s):
|
def _sortbysource(self,f,s):
|
||||||
fp = self.source_map[str(f)][2].upper()
|
fp = self.source_map[str(f)][2].upper()
|
||||||
sp = self.source_map[str(s)][2].upper()
|
sp = self.source_map[str(s)][2].upper()
|
||||||
return cmp(fp,sp)
|
return locale.strcoll(fp,sp)
|
||||||
|
|
||||||
def _sortbymedia(self,f,s):
|
def _sortbymedia(self,f,s):
|
||||||
fp = self.media_map[str(f)][4].upper()
|
fp = self.media_map[str(f)][4].upper()
|
||||||
sp = self.media_map[str(s)][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):
|
def set_person_column_order(self,list):
|
||||||
"""
|
"""
|
||||||
|
@ -523,6 +523,8 @@ class Marriage:
|
|||||||
changed = 1
|
changed = 1
|
||||||
|
|
||||||
idval = unicode(self.gid.get_text())
|
idval = unicode(self.gid.get_text())
|
||||||
|
if idval == "":
|
||||||
|
idval = None
|
||||||
if self.family.get_handle() != idval:
|
if self.family.get_handle() != idval:
|
||||||
changed = 1
|
changed = 1
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
import time
|
import time
|
||||||
|
import locale
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -130,7 +131,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
def byname(self,f,s):
|
def byname(self,f,s):
|
||||||
n1 = self.db.person_map.get(str(f))[_NAME_COL].get_sort_name()
|
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()
|
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):
|
def on_get_flags(self):
|
||||||
'''returns the GtkTreeModelFlags for this particular type of model'''
|
'''returns the GtkTreeModelFlags for this particular type of model'''
|
||||||
|
@ -35,7 +35,6 @@ import os
|
|||||||
import os.path
|
import os.path
|
||||||
import time
|
import time
|
||||||
import types
|
import types
|
||||||
import accent
|
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -1848,7 +1847,9 @@ class Name(DataObj):
|
|||||||
|
|
||||||
def build_sort_name(self):
|
def build_sort_name(self):
|
||||||
if self.surname:
|
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:
|
else:
|
||||||
self.sname = "@"
|
self.sname = "@"
|
||||||
|
|
||||||
|
@ -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.
|
to make sure these remain in sync with the rest of the design.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import locale
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Imported Modules
|
# Imported Modules
|
||||||
@ -92,11 +94,11 @@ class Sort:
|
|||||||
ffn = name1.get_first_name().upper()
|
ffn = name1.get_first_name().upper()
|
||||||
sfn = name2.get_first_name().upper()
|
sfn = name2.get_first_name().upper()
|
||||||
if ffn == sfn:
|
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:
|
else:
|
||||||
return cmp(ffn, sfn)
|
return locale.strcoll(ffn, sfn)
|
||||||
else:
|
else:
|
||||||
return cmp(fsn, ssn)
|
return locale.strcoll(fsn, ssn)
|
||||||
|
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user