* 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:
@@ -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>
|
2005-06-28 Don Allingham <don@gramps-project.org>
|
||||||
* src/EditPerson.py: parse date correctly on edit
|
* src/EditPerson.py: parse date correctly on edit
|
||||||
* src/ReadGedcom.py: load previously used title properly into
|
* src/ReadGedcom.py: load previously used title properly into
|
||||||
|
@@ -279,6 +279,16 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
|
|||||||
old_data = self.person_map.get(handle)
|
old_data = self.person_map.get(handle)
|
||||||
if transaction != None:
|
if transaction != None:
|
||||||
transaction.add(PERSON_KEY,handle,old_data)
|
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()
|
self.person_map[handle] = person.serialize()
|
||||||
if old_data:
|
if old_data:
|
||||||
self.emit('person-update',([handle],))
|
self.emit('person-update',([handle],))
|
||||||
@@ -462,8 +472,7 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
|
|||||||
|
|
||||||
data = self.person_map.get(str(val))
|
data = self.person_map.get(str(val))
|
||||||
if data:
|
if data:
|
||||||
person = Person()
|
person = Person(data)
|
||||||
person.unserialize(data)
|
|
||||||
return person
|
return person
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@@ -939,7 +939,6 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
|
|||||||
# We hold a reference to the GrampsDB so that we can maintain
|
# We hold a reference to the GrampsDB so that we can maintain
|
||||||
# its genderStats. It doesn't get set here, but from
|
# its genderStats. It doesn't get set here, but from
|
||||||
# GenderStats.count_person.
|
# GenderStats.count_person.
|
||||||
self.db = None
|
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
"""
|
"""
|
||||||
@@ -1134,12 +1133,7 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
|
|||||||
@param name: L{Name} to be assigned to the person
|
@param name: L{Name} to be assigned to the person
|
||||||
@type name: L{Name}
|
@type name: L{Name}
|
||||||
"""
|
"""
|
||||||
db = self.db
|
|
||||||
if db:
|
|
||||||
db.genderStats.uncount_person (self)
|
|
||||||
self.primary_name = name
|
self.primary_name = name
|
||||||
if db:
|
|
||||||
db.genderStats.count_person (self, db)
|
|
||||||
|
|
||||||
def get_primary_name(self):
|
def get_primary_name(self):
|
||||||
"""
|
"""
|
||||||
@@ -1233,13 +1227,7 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
|
|||||||
Person.UNKNOWN
|
Person.UNKNOWN
|
||||||
@type gender: int
|
@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
|
self.gender = gender
|
||||||
if self.db:
|
|
||||||
self.db.genderStats.count_person (self, self.db)
|
|
||||||
|
|
||||||
def get_gender(self) :
|
def get_gender(self) :
|
||||||
"""
|
"""
|
||||||
@@ -4058,7 +4046,6 @@ class GenderStats:
|
|||||||
if not person:
|
if not person:
|
||||||
return
|
return
|
||||||
# Let the Person do their own counting later
|
# Let the Person do their own counting later
|
||||||
person.db = db
|
|
||||||
|
|
||||||
name = self._get_key (person)
|
name = self._get_key (person)
|
||||||
if not name:
|
if not name:
|
||||||
|
Reference in New Issue
Block a user