* src/PeopleModel.py: sort based of "group as" value
* src/GrampsInMem.py: used "group as" value for surname list * src/GrampsBSDDB.py: used "group as" value for surname list * src/GrampsDbBase.py: accept "" and None for empty id values svn: r3584
This commit is contained in:
parent
008ef2f5d2
commit
2367107d89
@ -6,6 +6,10 @@
|
|||||||
* src/NameEdit.py: support for patronymic names
|
* src/NameEdit.py: support for patronymic names
|
||||||
* src/gramps.glade: NameEditor and EditPerson changes for
|
* src/gramps.glade: NameEditor and EditPerson changes for
|
||||||
enhanced name support
|
enhanced name support
|
||||||
|
* src/PeopleModel.py: sort based of "group as" value
|
||||||
|
* src/GrampsInMem.py: used "group as" value for surname list
|
||||||
|
* src/GrampsBSDDB.py: used "group as" value for surname list
|
||||||
|
* src/GrampsDbBase.py: accept "" and None for empty id values
|
||||||
|
|
||||||
2004-09-27 Don Allingham <dallingham@users.sourceforge.net>
|
2004-09-27 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
* src/PeopleModel.py: remove unused map
|
* src/PeopleModel.py: remove unused map
|
||||||
|
@ -1618,10 +1618,13 @@ class EditPerson:
|
|||||||
self.person.set_source_reference_list(self.srcreflist)
|
self.person.set_source_reference_list(self.srcreflist)
|
||||||
self.update_lists()
|
self.update_lists()
|
||||||
|
|
||||||
if self.person.get_handle() == None:
|
if not self.person.get_handle():
|
||||||
self.db.add_person(self.person, trans)
|
self.db.add_person(self.person, trans)
|
||||||
else:
|
else:
|
||||||
|
if not self.person.get_gramps_id():
|
||||||
|
self.person.set_gramps_id(self.db.find_next_person_gramps_id())
|
||||||
self.db.commit_person(self.person, trans)
|
self.db.commit_person(self.person, trans)
|
||||||
|
print "id",self.person.get_gramps_id()
|
||||||
n = self.person.get_primary_name().get_regular_name()
|
n = self.person.get_primary_name().get_regular_name()
|
||||||
self.db.transaction_commit(trans,_("Edit Person (%s)") % n)
|
self.db.transaction_commit(trans,_("Edit Person (%s)") % n)
|
||||||
if self.callback:
|
if self.callback:
|
||||||
|
@ -29,7 +29,7 @@ from GrampsDbBase import *
|
|||||||
from bsddb import dbshelve, db
|
from bsddb import dbshelve, db
|
||||||
|
|
||||||
def find_surname(key,data):
|
def find_surname(key,data):
|
||||||
return str(data[3].get_surname())
|
return str(data[3].get_group_as())
|
||||||
|
|
||||||
def find_idmap(key,data):
|
def find_idmap(key,data):
|
||||||
return str(data[1])
|
return str(data[1])
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2004 Donald N. Allingham
|
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||||
@ -483,9 +483,9 @@ class GrampsDbBase:
|
|||||||
Adds a Person to the database, assigning internal IDs if they have
|
Adds a Person to the database, assigning internal IDs if they have
|
||||||
not already been defined.
|
not already been defined.
|
||||||
"""
|
"""
|
||||||
if person.get_gramps_id() == None:
|
if not person.get_gramps_id():
|
||||||
person.set_gramps_id(self.find_next_person_gramps_id())
|
person.set_gramps_id(self.find_next_person_gramps_id())
|
||||||
if person.get_handle() == None:
|
if not person.get_handle():
|
||||||
person.set_handle(Utils.create_id())
|
person.set_handle(Utils.create_id())
|
||||||
self.commit_person(person,transaction)
|
self.commit_person(person,transaction)
|
||||||
self.genderStats.count_person (person, self)
|
self.genderStats.count_person (person, self)
|
||||||
|
@ -61,7 +61,7 @@ class GrampsInMemDB(GrampsDbBase):
|
|||||||
a = {}
|
a = {}
|
||||||
for person_id in self.get_person_handles(sort_handles=False):
|
for person_id in self.get_person_handles(sort_handles=False):
|
||||||
p = self.get_person_from_handle(person_id)
|
p = self.get_person_from_handle(person_id)
|
||||||
a[p.get_primary_name().get_surname()] = 1
|
a[p.get_primary_name().get_group_as()] = 1
|
||||||
vals = a.keys()
|
vals = a.keys()
|
||||||
vals.sort()
|
vals.sort()
|
||||||
return vals
|
return vals
|
||||||
|
@ -244,7 +244,7 @@ class NameEditor:
|
|||||||
if self.name.get_group_as() != self.surname_field.get_text():
|
if self.name.get_group_as() != self.surname_field.get_text():
|
||||||
self.name.set_group_as("")
|
self.name.set_group_as("")
|
||||||
self.parent.lists_changed = 1
|
self.parent.lists_changed = 1
|
||||||
elif self.name.set_group_as() != self.group_as.get_text():
|
elif self.name.get_group_as() != self.group_as.get_text():
|
||||||
self.name.set_group_as(self.group_as.get_text())
|
self.name.set_group_as(self.group_as.get_text())
|
||||||
self.parent.lists_changed = 1
|
self.parent.lists_changed = 1
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
for person_handle in self.db.get_person_handles(sort_handles=False):
|
for person_handle in self.db.get_person_handles(sort_handles=False):
|
||||||
|
|
||||||
person = self.db.get_person_from_handle(person_handle)
|
person = self.db.get_person_from_handle(person_handle)
|
||||||
surname = unicode(person.get_primary_name().get_surname())
|
surname = unicode(person.get_primary_name().get_group_as())
|
||||||
|
|
||||||
if self.sname_sub.has_key(surname):
|
if self.sname_sub.has_key(surname):
|
||||||
self.sname_sub[surname].append(person_handle)
|
self.sname_sub[surname].append(person_handle)
|
||||||
|
@ -30,12 +30,13 @@ __version__ = "$Revision$"
|
|||||||
# standard python modules
|
# standard python modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
from gettext import gettext as _
|
||||||
from re import compile
|
from re import compile
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import time
|
import time
|
||||||
import types
|
import types
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -1855,34 +1856,70 @@ class Name(DataObj):
|
|||||||
self.sort_as = self.DEF
|
self.sort_as = self.DEF
|
||||||
self.display_as = self.DEF
|
self.display_as = self.DEF
|
||||||
|
|
||||||
def get_group_as(self):
|
|
||||||
if self.group_as:
|
|
||||||
return self.group_as
|
|
||||||
else:
|
|
||||||
return self.surname
|
|
||||||
|
|
||||||
def set_group_as(self,name):
|
def set_group_as(self,name):
|
||||||
|
"""
|
||||||
|
Sets the grouping name for a person. Normally, this is the person's
|
||||||
|
surname. However, some locales group equivalent names (e.g. Ivanova
|
||||||
|
and Ivanov in Russian are usually considered equivalent.
|
||||||
|
"""
|
||||||
if name == self.surname:
|
if name == self.surname:
|
||||||
self.group_as = ""
|
self.group_as = ""
|
||||||
else:
|
else:
|
||||||
self.group_as = name
|
self.group_as = name
|
||||||
|
|
||||||
|
def get_group_as(self):
|
||||||
|
"""
|
||||||
|
Returns the grouping name, which is used to group equivalent surnames.
|
||||||
|
"""
|
||||||
|
if self.group_as:
|
||||||
|
return self.group_as
|
||||||
|
else:
|
||||||
|
return self.surname
|
||||||
|
|
||||||
def set_sort_as(self,value):
|
def set_sort_as(self,value):
|
||||||
|
"""
|
||||||
|
Specifies the sorting method for the specified name. Typically the
|
||||||
|
locale's default should be used. However, there may be names where
|
||||||
|
a specific sorting structure is desired for a name.
|
||||||
|
"""
|
||||||
self.sort_as = value
|
self.sort_as = value
|
||||||
|
|
||||||
def get_sort_as(self):
|
def get_sort_as(self):
|
||||||
|
"""
|
||||||
|
Returns the selected sorting method for the name. The options are
|
||||||
|
DEF (default for the current locale), LNFN (last name, first name),
|
||||||
|
or FNLN (first name, last name).
|
||||||
|
"""
|
||||||
return self.sort_as
|
return self.sort_as
|
||||||
|
|
||||||
def set_display_as(self,value):
|
def set_display_as(self,value):
|
||||||
|
"""
|
||||||
|
Specifies the display format for the specified name. Typically the
|
||||||
|
locale's default should be used. However, there may be names where
|
||||||
|
a specific display format is desired for a name.
|
||||||
|
"""
|
||||||
self.display_as = value
|
self.display_as = value
|
||||||
|
|
||||||
def get_display_as(self):
|
def get_display_as(self):
|
||||||
|
"""
|
||||||
|
Returns the selected display format for the name. The options are
|
||||||
|
DEF (default for the current locale), LNFN (last name, first name),
|
||||||
|
or FNLN (first name, last name).
|
||||||
|
"""
|
||||||
return self.display_as
|
return self.display_as
|
||||||
|
|
||||||
def get_surname_prefix(self):
|
def get_surname_prefix(self):
|
||||||
|
"""
|
||||||
|
Returns the prefix (or article) of a surname. The prefix is not
|
||||||
|
used for sorting or grouping.
|
||||||
|
"""
|
||||||
return self.prefix
|
return self.prefix
|
||||||
|
|
||||||
def set_surname_prefix(self,val):
|
def set_surname_prefix(self,val):
|
||||||
|
"""
|
||||||
|
Sets the prefix (or article) of a surname. Examples of articles
|
||||||
|
would be 'de' or 'van'.
|
||||||
|
"""
|
||||||
self.prefix = val
|
self.prefix = val
|
||||||
|
|
||||||
def set_type(self,type):
|
def set_type(self,type):
|
||||||
@ -1945,59 +1982,75 @@ class Name(DataObj):
|
|||||||
"""returns a name string built from the components of the Name
|
"""returns a name string built from the components of the Name
|
||||||
instance, in the form of surname, Firstname"""
|
instance, in the form of surname, Firstname"""
|
||||||
|
|
||||||
|
if self.patronymic:
|
||||||
|
first = "%s %s" % (self.first_name, self.patronymic)
|
||||||
|
else:
|
||||||
|
first = self.first_name
|
||||||
if self.suffix:
|
if self.suffix:
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
return "%s %s, %s %s" % (self.prefix, self.surname, self.first_name, self.suffix)
|
return "%s %s, %s %s" % (self.prefix, self.surname, first, self.suffix)
|
||||||
else:
|
else:
|
||||||
return "%s, %s %s" % (self.surname, self.first_name, self.suffix)
|
return "%s, %s %s" % (self.surname, first, self.suffix)
|
||||||
else:
|
else:
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
return "%s %s, %s" % (self.prefix,self.surname, self.first_name)
|
return "%s %s, %s" % (self.prefix,self.surname, first)
|
||||||
else:
|
else:
|
||||||
return "%s, %s" % (self.surname, self.first_name)
|
return "%s, %s" % (self.surname, first)
|
||||||
|
|
||||||
def get_upper_name(self):
|
def get_upper_name(self):
|
||||||
"""returns a name string built from the components of the Name
|
"""returns a name string built from the components of the Name
|
||||||
instance, in the form of surname, Firstname"""
|
instance, in the form of surname, Firstname"""
|
||||||
|
|
||||||
|
if self.patronymic:
|
||||||
|
first = "%s %s" % (self.first_name, self.patronymic)
|
||||||
|
else:
|
||||||
|
first = self.first_name
|
||||||
if self.suffix:
|
if self.suffix:
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
return "%s %s, %s %s" % (self.prefix.upper(), self.surname.upper(), self.first_name, self.suffix)
|
return "%s %s, %s %s" % (self.prefix.upper(), self.surname.upper(), first, self.suffix)
|
||||||
else:
|
else:
|
||||||
return "%s, %s %s" % (self.surname.upper(), self.first_name, self.suffix)
|
return "%s, %s %s" % (self.surname.upper(), first, self.suffix)
|
||||||
else:
|
else:
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
return "%s %s, %s" % (self.prefix.upper(), self.surname.upper(), self.first_name)
|
return "%s %s, %s" % (self.prefix.upper(), self.surname.upper(), first)
|
||||||
else:
|
else:
|
||||||
return "%s, %s" % (self.surname.upper(), self.first_name)
|
return "%s, %s" % (self.surname.upper(), first)
|
||||||
|
|
||||||
def get_regular_name(self):
|
def get_regular_name(self):
|
||||||
"""returns a name string built from the components of the Name
|
"""returns a name string built from the components of the Name
|
||||||
instance, in the form of Firstname surname"""
|
instance, in the form of Firstname surname"""
|
||||||
|
if self.patronymic:
|
||||||
|
first = "%s %s" % (self.first_name, self.patronymic)
|
||||||
|
else:
|
||||||
|
first = self.first_name
|
||||||
if (self.suffix == ""):
|
if (self.suffix == ""):
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
return "%s %s %s" % (self.first_name, self.prefix, self.surname)
|
return "%s %s %s" % (first, self.prefix, self.surname)
|
||||||
else:
|
else:
|
||||||
return "%s %s" % (self.first_name, self.surname)
|
return "%s %s" % (first, self.surname)
|
||||||
else:
|
else:
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
return "%s %s %s, %s" % (self.first_name, self.prefix, self.surname, self.suffix)
|
return "%s %s %s, %s" % (first, self.prefix, self.surname, self.suffix)
|
||||||
else:
|
else:
|
||||||
return "%s %s, %s" % (self.first_name, self.surname, self.suffix)
|
return "%s %s, %s" % (first, self.surname, self.suffix)
|
||||||
|
|
||||||
def get_regular_upper_name(self):
|
def get_regular_upper_name(self):
|
||||||
"""returns a name string built from the components of the Name
|
"""returns a name string built from the components of the Name
|
||||||
instance, in the form of Firstname surname"""
|
instance, in the form of Firstname surname"""
|
||||||
|
if self.patronymic:
|
||||||
|
first = "%s %s" % (self.first_name, self.patronymic)
|
||||||
|
else:
|
||||||
|
first = self.first_name
|
||||||
if (self.suffix == ""):
|
if (self.suffix == ""):
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
return "%s %s %s" % (self.first_name, self.prefix.upper(), self.surname.upper())
|
return "%s %s %s" % (first, self.prefix.upper(), self.surname.upper())
|
||||||
else:
|
else:
|
||||||
return "%s %s" % (self.first_name, self.surname.upper())
|
return "%s %s" % (first, self.surname.upper())
|
||||||
else:
|
else:
|
||||||
if self.prefix:
|
if self.prefix:
|
||||||
return "%s %s %s, %s" % (self.first_name, self.prefix.upper(), self.surname.upper(), self.suffix)
|
return "%s %s %s, %s" % (first, self.prefix.upper(), self.surname.upper(), self.suffix)
|
||||||
else:
|
else:
|
||||||
return "%s %s, %s" % (self.first_name, self.surname.upper(), self.suffix)
|
return "%s %s, %s" % (first, self.surname.upper(), self.suffix)
|
||||||
|
|
||||||
def are_equal(self,other):
|
def are_equal(self,other):
|
||||||
"""compares to names to see if they are equal, return 0 if they
|
"""compares to names to see if they are equal, return 0 if they
|
||||||
|
Loading…
Reference in New Issue
Block a user