From 65aef4214dcbba22dc2c24f0a5ddfd8414ea2622 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 3 Dec 2003 03:49:39 +0000 Subject: [PATCH] * src/edit_person.glade: Add completeness check button. * src/RelLib.py (Person.setComplete, Person.getComplete): Add functions. * src/WriteXML.py (write_id): Save completeness info. * src/GrampsParser.py (GrampsParser.start_person, GrampsImportParser.start_person, GrampsImportParser.start_family): Parse completeness. * src/EditPerson.py: Add support for completeness. svn: r2430 --- gramps2/ChangeLog | 7 +++++++ gramps2/src/EditPerson.py | 11 +++++++++++ gramps2/src/GrampsParser.py | 14 ++++++++++++++ gramps2/src/RelLib.py | 9 +++++++++ gramps2/src/WriteXML.py | 6 +++++- gramps2/src/edit_person.glade | 24 +++++++++++++++++++++++- 6 files changed, 69 insertions(+), 2 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 98fe57e27..35b54570b 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -13,6 +13,13 @@ doc/gramps-manual/C/mainwin.xml, doc/gramps-manual/C/getstart.xml, doc/gramps-manual/C/usage.xml: Add copyright info to header. + * src/edit_person.glade: Add completeness check button. + * src/RelLib.py (Person.setComplete, Person.getComplete): Add functions. + * src/WriteXML.py (write_id): Save completeness info. + * src/GrampsParser.py (GrampsParser.start_person, + GrampsImportParser.start_person, GrampsImportParser.start_family): + Parse completeness. + * src/EditPerson.py: Add support for completeness. 2003-12-02 Tim Waugh * gramps.spec.in: Add more docs. diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index 5b10151e2..0c6ab1e6a 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -106,6 +106,7 @@ class EditPerson: self.gallery = ImageSelect.Gallery(person, self.path, self.icon_list, self.db,self,self.window) + self.complete = self.get_widget('complete') self.name_delete_btn = self.top.get_widget('aka_delete') self.name_edit_btn = self.top.get_widget('aka_edit') self.web_delete_btn = self.top.get_widget('delete_url') @@ -382,6 +383,9 @@ class EditPerson: self.top.get_widget('edit_src'), self.top.get_widget('del_src')) + if self.person.getComplete(): + self.complete.set_active(1) + self.redraw_event_list() self.redraw_attr_list() self.redraw_addr_list() @@ -1016,6 +1020,9 @@ class EditPerson: changed = 0 name = self.person.getPrimaryName() + if self.complete.get_active() != self.person.getComplete(): + changed = 1 + if self.person.getId() != idval: changed = 1 if suffix != name.getSuffix(): @@ -1486,6 +1493,10 @@ class EditPerson: self.person.setNote(text) Utils.modified() + if self.complete.get_active() != self.person.getComplete(): + self.person.setComplete(self.complete.get_active()) + Utils.modified() + if self.lds_not_loaded == 0: self.check_lds() ord = RelLib.LdsOrd(self.person.getLdsBaptism()) diff --git a/gramps2/src/GrampsParser.py b/gramps2/src/GrampsParser.py index 44044388b..45999fe65 100644 --- a/gramps2/src/GrampsParser.py +++ b/gramps2/src/GrampsParser.py @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + import const import RelLib import Date @@ -335,6 +337,10 @@ class GrampsParser: self.callback(float(self.count)/float(self.entries)) self.count = self.count + 1 self.person = self.db.findPersonNoMap(attrs["id"]) + if attrs.has_key("complete"): + self.person.setComplete(int(attrs['complete'])) + else: + self.person.setComplete(0) def start_people(self,attrs): if attrs.has_key("default"): @@ -942,6 +948,10 @@ class GrampsImportParser(GrampsParser): self.callback(float(self.count)/float(self.entries)) self.count = self.count + 1 self.person = self.db.findPersonNoConflicts(attrs["id"],self.pmap) + if attrs.has_key("complete"): + self.person.setComplete(int(attrs['complete'])) + else: + self.person.setComplete(0) def start_father(self,attrs): self.family.Father = self.db.findPersonNoConflicts(attrs["ref"],self.pmap) @@ -959,6 +969,10 @@ class GrampsImportParser(GrampsParser): self.family = self.db.findFamilyNoConflicts(attrs["id"],self.fmap) if attrs.has_key("type"): self.family.setRelationship(const.save_frel(attrs["type"])) + if attrs.has_key("complete"): + self.family.setComplete(int(attrs['complete'])) + else: + self.family.setComplete(0) def start_source(self,attrs): self.source = self.db.findSourceNoConflicts(attrs["id"],self.smap) diff --git a/gramps2/src/RelLib.py b/gramps2/src/RelLib.py index 11933fdc1..a3a9e04e8 100644 --- a/gramps2/src/RelLib.py +++ b/gramps2/src/RelLib.py @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + """The core library of the GRAMPS database""" __author__ = "Donald N. Allingham" @@ -1035,12 +1037,19 @@ class Person(SourceNote): self.lds_bapt = None self.lds_endow = None self.lds_seal = None + self.complete = 0 # 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 setComplete(self,val): + self.complete = val + + def getComplete(self): + return self.complete + def getDisplayInfo(self): if self.gender == Person.male: gender = const.male diff --git a/gramps2/src/WriteXML.py b/gramps2/src/WriteXML.py index 4dd3ac123..d47fd7af0 100644 --- a/gramps2/src/WriteXML.py +++ b/gramps2/src/WriteXML.py @@ -483,7 +483,11 @@ class XmlWriter: def write_id(self,label,person,index=1): if person: - self.g.write('%s<%s id="%s">\n' % (" "*index,label,person.getId())) + self.g.write('%s<%s id="%s"' % (" "*index,label,person.getId())) + comp = person.getComplete() + if comp: + self.g.write(' complete="1"') + self.g.write('>\n') def write_family_id(self,family,index=1): if family: diff --git a/gramps2/src/edit_person.glade b/gramps2/src/edit_person.glade index cfe438140..0cb474933 100644 --- a/gramps2/src/edit_person.glade +++ b/gramps2/src/edit_person.glade @@ -119,7 +119,7 @@ True - 1 + 2 1 False 0 @@ -1188,6 +1188,28 @@ fill + + + + 6 + True + True + _Information is complete + True + GTK_RELIEF_NORMAL + False + False + True + + + 0 + 1 + 1 + 2 + shrink + + + 0