* src/GrampsDbBase.py: move gender stats handling to the commit_person
task, instead of trying to handle it in the Person() class * src/RelLib.py: removal of genderstats handling svn: r4890
This commit is contained in:
parent
5191d6bd11
commit
f1b13b49c5
@ -1,3 +1,8 @@
|
||||
2005-06-29 Don Allingham <don@gramps-project.org>
|
||||
* src/GrampsDbBase.py: move gender stats handling to the commit_person
|
||||
task, instead of trying to handle it in the Person() class
|
||||
* src/RelLib.py: removal of genderstats handling
|
||||
|
||||
2005-06-28 Don Allingham <don@gramps-project.org>
|
||||
* src/EditPerson.py: parse date correctly on edit
|
||||
* src/ReadGedcom.py: load previously used title properly into
|
||||
|
@ -279,6 +279,16 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
|
||||
old_data = self.person_map.get(handle)
|
||||
if transaction != None:
|
||||
transaction.add(PERSON_KEY,handle,old_data)
|
||||
|
||||
if old_data:
|
||||
old_person = Person(old_data)
|
||||
if (old_data[2] != person.gender or
|
||||
old_data[3].first_name != person.primary_name.first_name):
|
||||
self.genderStats.uncount_person(old_person)
|
||||
self.genderStats.count_person(person,self)
|
||||
else:
|
||||
self.genderStats.count_person(person,self)
|
||||
|
||||
self.person_map[handle] = person.serialize()
|
||||
if old_data:
|
||||
self.emit('person-update',([handle],))
|
||||
@ -462,8 +472,7 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
|
||||
|
||||
data = self.person_map.get(str(val))
|
||||
if data:
|
||||
person = Person()
|
||||
person.unserialize(data)
|
||||
person = Person(data)
|
||||
return person
|
||||
return None
|
||||
|
||||
|
@ -939,7 +939,6 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
|
||||
# We hold a reference to the GrampsDB so that we can maintain
|
||||
# its genderStats. It doesn't get set here, but from
|
||||
# GenderStats.count_person.
|
||||
self.db = None
|
||||
|
||||
def serialize(self):
|
||||
"""
|
||||
@ -1134,12 +1133,7 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
|
||||
@param name: L{Name} to be assigned to the person
|
||||
@type name: L{Name}
|
||||
"""
|
||||
db = self.db
|
||||
if db:
|
||||
db.genderStats.uncount_person (self)
|
||||
self.primary_name = name
|
||||
if db:
|
||||
db.genderStats.count_person (self, db)
|
||||
|
||||
def get_primary_name(self):
|
||||
"""
|
||||
@ -1233,13 +1227,7 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
|
||||
Person.UNKNOWN
|
||||
@type gender: int
|
||||
"""
|
||||
# if the db object has been assigned, update the
|
||||
# genderStats of the database
|
||||
if self.db:
|
||||
self.db.genderStats.uncount_person (self)
|
||||
self.gender = gender
|
||||
if self.db:
|
||||
self.db.genderStats.count_person (self, self.db)
|
||||
|
||||
def get_gender(self) :
|
||||
"""
|
||||
@ -4058,7 +4046,6 @@ class GenderStats:
|
||||
if not person:
|
||||
return
|
||||
# Let the Person do their own counting later
|
||||
person.db = db
|
||||
|
||||
name = self._get_key (person)
|
||||
if not name:
|
||||
|
Loading…
x
Reference in New Issue
Block a user