From 6c0e2b86d694fa720ae954dd76937ba44fe4d33f Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 31 Mar 2006 04:19:06 +0000 Subject: [PATCH] handle to ref conversions svn: r6239 --- ChangeLog | 4 +++ src/BaseDoc.py | 7 +++-- src/DisplayModels.py | 2 +- src/DisplayTabs.py | 14 ++++------ src/GenericFilter.py | 43 +++++++++++++++-------------- src/MergePeople.py | 22 ++++++++------- src/PluginUtils/_ReportOptions.py | 9 +++--- src/PluginUtils/_ReportUtils.py | 46 ++++++++++++++++++------------- src/RelLib/_Person.py | 32 ++++++++++----------- src/plugins/Ancestors.py | 38 ++++++++++++------------- src/plugins/Calendar.py | 45 +++++++++++++----------------- src/plugins/Checkpoint.py | 4 +-- src/plugins/EventCmp.py | 30 ++++++++++---------- src/plugins/ExportVCalendar.py | 20 +++++++------- src/plugins/ExportVCard.py | 6 ++-- src/plugins/FilterEditor.py | 10 +++---- src/plugins/IndivSummary.py | 12 ++++---- src/plugins/NavWebPage.py | 6 ++-- src/plugins/WriteCD.py | 4 +-- 19 files changed, 179 insertions(+), 175 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ed67b1f6..dc1834e92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-03-30 Don Allingham + * various: convert get_birth_handle()/get_death_handle() to ref + calls + 2006-03-30 Brian Matherly * src/plugins/GraphViz.py: import const * src/plugins/DecendReport.py: use full dates instead of just year. diff --git a/src/BaseDoc.py b/src/BaseDoc.py index 55b34d4af..c2e3b55d3 100644 --- a/src/BaseDoc.py +++ b/src/BaseDoc.py @@ -893,9 +893,10 @@ class StyleSheetList: Loads the StyleSheets from the associated file, if it exists. """ try: - p = make_parser() - p.setContentHandler(SheetParser(self)) - p.parse(self.file) + if os.path.isfile(self.file): + p = make_parser() + p.setContentHandler(SheetParser(self)) + p.parse(self.file) except (IOError,OSError,SAXParseException): pass diff --git a/src/DisplayModels.py b/src/DisplayModels.py index 011452432..c0b9eb672 100644 --- a/src/DisplayModels.py +++ b/src/DisplayModels.py @@ -548,7 +548,7 @@ class MediaModel(BaseModel): _codeset) def column_tooltip(self,data): - if self.use_tips: + if const.use_tips: try: t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_object_from_handle(data[0])) diff --git a/src/DisplayTabs.py b/src/DisplayTabs.py index d268b89e6..79fd850e5 100644 --- a/src/DisplayTabs.py +++ b/src/DisplayTabs.py @@ -36,7 +36,6 @@ from gtk.gdk import ACTION_COPY, BUTTON1_MASK from TransUtils import sgettext as _ import pickle -import os try: set() @@ -73,7 +72,6 @@ from GrampsWidgets import SimpleButton # constants # #------------------------------------------------------------------------- -dnddata = None #------------------------------------------------------------------------- # @@ -125,6 +123,9 @@ class GrampsTab(gtk.HBox): self.share_btn = None self.build_interface() + def get_selected(self): + return None + def is_empty(self): """ Indicates if the tab contains any data. This is used to determine @@ -438,11 +439,7 @@ class EmbeddedList(ButtonTab): and decide if this is a move or a reorder. """ if sel_data and sel_data.data: - dnddata = pickle.loads(sel_data.data) - mytype = dnddata[0] - selfid = dnddata[1] - obj = dnddata[2] - row_from = dnddata[3] + (mytype, selfid, obj, row_from) = pickle.loads(sel_data.data) # make sure this is the correct DND type for this object if mytype == self._DND_TYPE.drag_type: @@ -1536,12 +1533,11 @@ class SourceEmbedList(EmbeddedList): sel = SelectSource.SelectSource(self.dbstate.db,"Source Select") src = sel.run() - sref = RelLib.SourceRef() if src: try: ref = RelLib.SourceRef() EditSourceRef(self.dbstate,self.uistate,self.track, - src, sref, self.add_callback) + src, ref, self.add_callback) except Errors.WindowActiveError: pass diff --git a/src/GenericFilter.py b/src/GenericFilter.py index 683627f6d..6b9ecbdad 100644 --- a/src/GenericFilter.py +++ b/src/GenericFilter.py @@ -1176,10 +1176,10 @@ class HasBirth(Rule): self.date = None def apply(self,db,person): - event_handle = person.get_birth_handle() - if not event_handle: + event_ref = person.get_birth_ref() + if not event_ref: return False - event = db.get_event_from_handle(event_handle) + event = db.get_event_from_handle(event_ref.ref) ed = event.get_description().upper() if self.list[2] \ and ed.find(self.list[2].upper())==-1: @@ -1519,10 +1519,10 @@ class NoBirthdate(Rule): category = _('General filters') def apply(self,db,person): - birth_handle = person.get_birth_handle() - if not birth_handle: + birth_ref = person.get_birth_ref() + if not birth_ref: return True - birth = db.get_event_from_handle(birth_handle) + birth = db.get_event_from_handle(birth_ref.ref) if not birth.get_date_object(): return True return False @@ -1538,9 +1538,10 @@ class PersonWithIncompleteEvent(Rule): category = _('Event filters') def apply(self,db,person): - for event_handle in person.get_event_list() + [person.get_birth_handle(), person.get_death_handle()]: - event = db.get_event_from_handle(event_handle) - if event: + for event_ref in person.get_event_ref_list() + \ + [person.get_birth_ref(), person.get_death_ref()]: + if event_ref: + event = db.get_event_from_handle(event_ref.ref) if not event.get_place_handle(): return True if not event.get_date_object(): @@ -1628,27 +1629,27 @@ class IsWitness(Rule): for person_handle in self.db.get_person_handles(): p = self.db.get_person_from_handle(person_handle) self.get_witness_of_events(self.list[0], - p.get_event_list()+ - [p.get_birth_handle(), - p.get_death_handle()] + p.get_event_ref_list()+ + [p.get_birth_ref(), + p.get_death_ref()] ) for family_handle in self.db.get_family_handles(): f = self.db.get_family_from_handle(family_handle) - self.get_witness_of_events(self.list[1],f.get_event_list()) + self.get_witness_of_events(self.list[1],f.get_event_ref_list()) def get_witness_of_events(self, event_type, event_list): if not event_list: return - for event_handle in event_list: - event = self.db.get_event_from_handle(event_handle) - if event: + for event_ref in event_list: + if event_reg: + event = self.db.get_event_from_handle(event_ref.ref) if event_type and not event.get_name() == event_type: continue wlist = event.get_witness_list() if wlist: for w in wlist: - if w.get_type() == RelLib.Event.ID: + if w.get_type()[0] == RelLib.Event.ID: self.map.append(w.get_value()) @@ -1705,8 +1706,8 @@ class HasTextMatchingSubstringOf(Rule): return self.person_map[person.handle] if self.match_object(person): # first match the person itself return True - for event_handle in person.get_event_list()+[person.get_birth_handle(), person.get_death_handle()]: - if self.search_event(event_handle): # match referenced events + for event_ref in person.get_event_ref_list()+[person.get_birth_ref(), person.get_death_ref()]: + if self.search_event(event_ref.ref): # match referenced events return True for family_handle in person.get_family_handle_list(): # match families if self.search_family(family_handle): @@ -1726,8 +1727,8 @@ class HasTextMatchingSubstringOf(Rule): if self.match_object(family): match = 1 else: - for event_handle in family.get_event_list(): - if self.search_event(event_handle): + for event_ref in family.get_event_ref_list(): + if self.search_event(event_ref.ref): match = 1 break for media_ref in family.get_media_list(): # match Media object diff --git a/src/MergePeople.py b/src/MergePeople.py index 6a8a68580..bc0a5d147 100644 --- a/src/MergePeople.py +++ b/src/MergePeople.py @@ -122,10 +122,12 @@ class Compare: self.add(tobj,title,NameDisplay.displayer.display(person)) self.add(tobj,normal,"%s:\t%s" % (_('ID'),person.get_gramps_id())) self.add(tobj,normal,"%s:\t%s" % (_('Gender'),sex[person.get_gender()])) - bhandle = person.get_birth_handle() - self.add(tobj,normal,"%s:\t%s" % (_('Birth'),self.get_event_info(bhandle))) - dhandle = person.get_death_handle() - self.add(tobj,normal,"%s:\t%s" % (_('Death'),self.get_event_info(dhandle))) + bref = person.get_birth_ref() + if bref: + self.add(tobj,normal,"%s:\t%s" % (_('Birth'),self.get_event_info(bref.ref))) + dref = person.get_death_ref() + if dref: + self.add(tobj,normal,"%s:\t%s" % (_('Death'),self.get_event_info(dref.ref))) nlist = person.get_alternate_names() if len(nlist) > 0: @@ -485,13 +487,13 @@ class MergePeople: birth event, and the secondary person's birth event is added as a 'Alternate Birth' event. """ - handle1 = self.p1.get_birth_handle() - handle2 = self.p2.get_birth_handle() + ref1 = self.p1.get_birth_ref() + ref2 = self.p2.get_birth_ref() - if handle1: - new.set_birth_handle(handle1) - if handle2: - event = self.db.get_event_from_handle(handle2) + if ref1: + new.set_birth_handle(ref1.ref) + if ref2: + event = self.db.get_event_from_handle(ref2.ref) event.set_name('Alternate Birth') self.db.add_event(event,trans) new.add_event_handle(event.get_handle()) diff --git a/src/PluginUtils/_ReportOptions.py b/src/PluginUtils/_ReportOptions.py index 2a8d3bd56..4e9ef82b0 100644 --- a/src/PluginUtils/_ReportOptions.py +++ b/src/PluginUtils/_ReportOptions.py @@ -31,7 +31,7 @@ Report option handling, including saving and parsing. # #------------------------------------------------------------------------- from TransUtils import sgettext as _ - +import os #------------------------------------------------------------------------- # # SAX interface @@ -274,9 +274,10 @@ class OptionListCollection(_Options.OptionListCollection): Loads the OptionList from the associated file, if it exists. """ try: - p = make_parser() - p.setContentHandler(OptionParser(self)) - p.parse(self.filename) + if os.path.isfile(self.filename): + p = make_parser() + p.setContentHandler(OptionParser(self)) + p.parse(self.filename) except (IOError,OSError,SAXParseException): pass diff --git a/src/PluginUtils/_ReportUtils.py b/src/PluginUtils/_ReportUtils.py index c5f022123..5b4f31320 100644 --- a/src/PluginUtils/_ReportUtils.py +++ b/src/PluginUtils/_ReportUtils.py @@ -1133,22 +1133,25 @@ def sanitize_person(db,person): new_person.set_complete_flag(person.get_complete_flag()) # copy birth event - event_handle = person.get_birth_handle() - event = db.get_event_from_handle(event_handle) - if event and not event.get_privacy(): - new_person.set_birth_handle(event_handle) + event_ref = person.get_birth_ref() + if event_ref: + event = db.get_event_from_handle(event_ref.ref) + if not event.get_privacy(): + new_person.set_birth_ref(event_ref) # copy death event - event_handle = person.get_death_handle() - event = db.get_event_from_handle(event_handle) - if event and not event.get_privacy(): - new_person.set_death_handle(event_handle) + event_ref = person.get_death_ref() + if event_ref: + event = db.get_event_from_handle(event_ref.ref) + if not event.get_privacy(): + new_person.set_death_ref(event_ref) # copy event list - for event_handle in person.get_event_list(): - event = db.get_event_from_handle(event_handle) - if event and not event.get_privacy(): - new_person.add_event_handle(event_handle) + for event_ref in person.get_event_ref_list(): + if event_ref: + event = db.get_event_from_handle(event_ref.ref) + if not event.get_privacy(): + new_person.add_event_handle(event_ref) # copy address list for address in person.get_address_list(): @@ -1317,9 +1320,8 @@ def get_birth_death_strings(database,person,empty_date="",empty_place=""): birth_ref = person.get_birth_ref() if birth_ref and birth_ref.ref: - birth_handle = birth_ref.ref - birth = database.get_event_from_handle(birth_handle) - if birth: + if birth_ref: + birth = database.get_event_from_handle(birth_ref.ref) bdate = DateHandler.get_date(birth) bplace_handle = birth.get_place_handle() if bplace_handle: @@ -1330,8 +1332,7 @@ def get_birth_death_strings(database,person,empty_date="",empty_place=""): death_ref = person.get_death_ref() if death_ref and death_ref.ref: - death_handle = death_ref.ref - death = database.get_event_from_handle(death_handle) + death = database.get_event_from_handle(death_ref.ref) if death: ddate = DateHandler.get_date(death) dplace_handle = death.get_place_handle() @@ -1385,8 +1386,15 @@ def born_died_str(database,person,endnotes=None,name_object=None,person_name=Non bdate,bplace,bdate_full,bdate_mod,ddate,dplace,ddate_full,ddate_mod = \ get_birth_death_strings(database,person) - birth = database.get_event_from_handle(person.get_birth_handle()) - death = database.get_event_from_handle(person.get_death_handle()) + birth = None + birth_ref = person.get_birth_ref() + if birth_ref: + birth = database.get_event_from_handle(birth_ref.ref) + + death = None + death_ref = person.get_death_ref() + if death_ref: + death = database.get_event_from_handle(death_ref.ref) values = { 'unknown_gender_name' : person_name, diff --git a/src/RelLib/_Person.py b/src/RelLib/_Person.py index 336168102..56e106d9a 100644 --- a/src/RelLib/_Person.py +++ b/src/RelLib/_Person.py @@ -483,14 +483,14 @@ class Person(PrimaryObject,SourceNote, raise ValueError("Expecting EventRef instance") self.death_ref = event_ref - def get_birth_handle(self): - warn( "Use get_birth_ref instead of get_birth_handle", DeprecationWarning, 2) - # Wrapper for old API - # remove when transitition done. - event_ref = self.get_birth_ref() - if event_ref: - return event_ref.get_reference_handle() - return "" +# def get_birth_handle(self): +# warn( "Use get_birth_ref instead of get_birth_handle", DeprecationWarning, 2) +# # Wrapper for old API +# # remove when transitition done. +# event_ref = self.get_birth_ref() +# if event_ref: +# return event_ref.get_reference_handle() +# return "" def get_birth_ref(self): """ @@ -503,14 +503,14 @@ class Person(PrimaryObject,SourceNote, """ return self.birth_ref - def get_death_handle(self): - warn( "Use get_death_ref instead of get_death_handle", DeprecationWarning, 2) - # Wrapper for old API - # remove when transitition done. - event_ref = self.get_death_ref() - if event_ref: - return event_ref.get_reference_handle() - return "" +# def get_death_handle(self): +# warn( "Use get_death_ref instead of get_death_handle", DeprecationWarning, 2) +# # Wrapper for old API +# # remove when transitition done. +# event_ref = self.get_death_ref() +# if event_ref: +# return event_ref.get_reference_handle() +# return "" def get_death_ref(self): """ diff --git a/src/plugins/Ancestors.py b/src/plugins/Ancestors.py index 677cab97d..110f42c67 100644 --- a/src/plugins/Ancestors.py +++ b/src/plugins/Ancestors.py @@ -517,17 +517,17 @@ class ComprehensiveAncestorsReport (Report.Report): def abbrev_born_died (self, person): ret = '' - birth_handle = person.get_birth_handle () - if birth_handle: - birth = self.database.get_event_from_handle(birth_handle) + birth_ref = person.get_birth_ref() + if birth_ref: + birth = self.database.get_event_from_handle(birth_ref.ref) date = birth.get_date () if date: ret += _(" b. %(birth_date)s") % {'birth_date': date} ret += self.cite_sources (birth.get_source_references ()) - death_handle = person.get_death_handle () - if death_handle: - death = self.database.get_event_from_handle(death_handle) + death_ref = person.get_death_ref() + if death_ref: + death = self.database.get_event_from_handle(death_ref.ref) date = death.get_date () if date: ret += _(" d. %(death_date)s") % {'death_date': date} @@ -538,16 +538,16 @@ class ComprehensiveAncestorsReport (Report.Report): def long_born_died (self, person): ret = '' born_info = None - birth_handle = person.get_birth_handle () - if birth_handle: - birth = self.database.get_event_from_handle(birth_handle) + birth_ref = person.get_birth_ref() + if birth_ref: + birth = self.database.get_event_from_handle(birth_ref.ref) born_info = self.event_info (birth) if born_info: ret = ", " + _("born") + born_info - death_handle = person.get_death_handle() - if death_handle: - death = self.database.get_event_from_handle(death_handle) + death_ref = person.get_death_ref() + if death_ref: + death = self.database.get_event_from_handle(death_ref.ref) died_info = self.event_info (death) if died_info: if born_info: @@ -803,7 +803,7 @@ class ComprehensiveAncestorsReport (Report.Report): paras = [] names = person.get_alternate_names () - event_handles = person.get_event_list () + event_ref = person.get_event_ref_list () addresses = person.get_address_list () if (len (event_handles) + len (addresses) + len (names)) > 0: paras.append ((self.doc.start_paragraph, ['AR-SubEntry'])) @@ -819,20 +819,20 @@ class ComprehensiveAncestorsReport (Report.Report): ': ' + name.get_regular_name ()])) paras.append ((self.doc.end_paragraph, [])) - for event_handle in [person.get_birth_handle (), person.get_death_handle ()]: - if not event_handle: + for event_ref in [person.get_birth_ref(), person.get_death_ref()]: + if not event_ref: continue - event = self.database.get_event_from_handle(event_handle) + event = self.database.get_event_from_handle(event_ref.ref) note = event.get_note () note_format = event.get_note_format () if note and (note_format != 0): paras.append ((self.doc.write_note, [note, format, 'AR-Details'])) - for event_handle in event_handles: - if not event_handle: + for event_ref in event_refs: + if not event_ref: continue - event = self.database.get_event_from_handle(event_handle) + event = self.database.get_event_from_handle(event_ref.ref) paras.append ((self.doc.start_paragraph, ['AR-Details'])) paras.append ((self.doc.write_text, [self.event_info (event)])) paras.append ((self.doc.end_paragraph, [])) diff --git a/src/plugins/Calendar.py b/src/plugins/Calendar.py index 102af603c..947dbada3 100644 --- a/src/plugins/Calendar.py +++ b/src/plugins/Calendar.py @@ -265,32 +265,25 @@ class Calendar(Report.Report): self.database.get_person_handles(sort_handles=False)) for person_handle in people: person = self.database.get_person_from_handle(person_handle) - birth_handle = person.get_birth_handle() + birth_ref = person.get_birth_ref() birth_date = None - if birth_handle: - birth_event = self.database.get_event_from_handle(birth_handle) - birth_date = birth_event.get_date() - if birth_date == "": - birth_date = None - else: - birth_date_obj = birth_event.get_date_object() - death_handle = person.get_death_handle() + if birth_ref: + birth_event = self.database.get_event_from_handle(birth_ref.ref) + birth_date = birth_event.get_date_object() + + death_ref = person.get_death_ref() death_date = None - if death_handle: - death_event = self.database.get_event_from_handle(death_handle) - death_date = death_event.get_date() - if death_date == "": # BUG: couldn't remove event - death_date = None - else: - death_date_obj = death_event.get_date_object() + if death_ref: + death_event = self.database.get_event_from_handle(death_ref.ref) + death_date = death_event.get_date_object() if death_date == None: alive = True # well, until we get probably_alive in here else: alive = False if self["birthdays"] and birth_date != None and ((self["alive"] and alive) or not self["alive"]): - year = birth_date_obj.get_year() - month = birth_date_obj.get_month() - day = birth_date_obj.get_day() + year = birth_date.get_year() + month = birth_date.get_month() + day = birth_date.get_day() age = self["year"] - year # add some things to handle maiden name: father_lastname = None # husband, actually @@ -325,16 +318,16 @@ class Calendar(Report.Report): spouse_name = self.get_short_name(spouse) short_name = self.get_short_name(person) if self["alive"]: - spouse_death_handle = spouse.get_death_handle() - if spouse_death_handle != None: + spouse_death_ref = spouse.get_death_ref() + if spouse_death_ref: # there is a death event, maybe empty though - spouse_death_event = self.database.get_event_from_handle(spouse_death_handle) + spouse_death_event = self.database.get_event_from_handle(spouse_death_ref.ref) if spouse_death_event != None: - spouse_death_date = spouse_death_event.get_date() - if spouse_death_date != "": # BUG: couldn't remove event + spouse_death_date = spouse_death_event.get_date_object() + if spouse_death_date: # BUG: couldn't remove event continue - for event_handle in fam.get_event_list(): - event = self.database.get_event_from_handle(event_handle) + for event_ref in fam.get_event_ref_list(): + event = self.database.get_event_from_handle(event_ref.ref) event_obj = event.get_date_object() year = event_obj.get_year() month = event_obj.get_month() diff --git a/src/plugins/Checkpoint.py b/src/plugins/Checkpoint.py index 93f569d79..d4e500bf1 100644 --- a/src/plugins/Checkpoint.py +++ b/src/plugins/Checkpoint.py @@ -47,7 +47,7 @@ import gtk.glade # #------------------------------------------------------------------------- from QuestionDialog import OkDialog, ErrorDialog -import WriteXML +import GrampsDb from PluginUtils import Tool, register_tool import Utils import GrampsDisplay @@ -245,7 +245,7 @@ class Checkpoint(Tool.Tool): """ proc = popen2.Popen3(cmd, True) if checkin: - xmlwrite = WriteXML.XmlWriter(self.db,self.callback,False,False) + xmlwrite = GrampsDb.XmlWriter(self.db,self.callback,False,False) xmlwrite.write_handle(proc.tochild) else: pass diff --git a/src/plugins/EventCmp.py b/src/plugins/EventCmp.py index d813b8cdc..24f62cb9b 100644 --- a/src/plugins/EventCmp.py +++ b/src/plugins/EventCmp.py @@ -332,35 +332,34 @@ class DisplayChart: for individual_id in self.my_list: individual = self.db.get_person_from_handle(individual_id) name = individual.get_primary_name().get_name() - birth_handle = individual.get_birth_handle() + birth_ref = individual.get_birth_ref() bdate = "" bplace = "" - if birth_handle: - birth = self.db.get_event_from_handle(birth_handle) + if birth_ref: + birth = self.db.get_event_from_handle(birth_ref.ref) bdate = DateHandler.get_date(birth) bplace_handle = birth.get_place_handle() if bplace_handle: bplace = self.db.get_place_from_handle(bplace_handle).get_title() - death_handle = individual.get_death_handle() + death_ref = individual.get_death_ref() ddate = "" dplace = "" - if death_handle: - death = self.db.get_event_from_handle(death_handle) + if death_ref: + death = self.db.get_event_from_handle(death_ref.ref) ddate = DateHandler.get_date(death) dplace_handle = death.get_place_handle() if dplace_handle: dplace = self.db.get_place_from_handle(dplace_handle).get_title() map = {} - elist = individual.get_event_list()[:] - for ievent_handle in elist: - if not ievent_handle: + for ievent_ref in individual.get_event_ref_list(): + if not ievent_ref: continue - ievent = self.db.get_event_from_handle(ievent_handle) + ievent = self.db.get_event_from_handle(ievent_ref.ref) event_name = ievent.get_name() if map.has_key(event_name): - map[event_name].append(ievent_handle) + map[event_name].append(ievent_ref.ref) else: - map[event_name] = [ievent_handle] + map[event_name] = [ievent_ref.ref] first = 1 done = 0 @@ -403,11 +402,10 @@ class DisplayChart: map = {} for individual_id in self.my_list: individual = self.db.get_person_from_handle(individual_id) - elist = individual.get_event_list() - for event_handle in elist: - if not event_handle: + for event_ref in individual.get_event_list(): + if not event_ref: continue - event = self.db.get_event_from_handle(event_handle) + event = self.db.get_event_from_handle(event_ref.ref) name = event.get_name() if not name: break diff --git a/src/plugins/ExportVCalendar.py b/src/plugins/ExportVCalendar.py index 79b809b4b..cb4247145 100644 --- a/src/plugins/ExportVCalendar.py +++ b/src/plugins/ExportVCalendar.py @@ -206,10 +206,9 @@ class CalendarWriter: def write_family(self,family_handle): family = self.db.get_family_from_handle(family_handle) if family: - event_list = family.get_event_list() - for event_handle in event_list: - event = self.db.get_event_from_handle(event_handle) - if event.get_name() == "Marriage": + for event_ref in family.get_event_ref_list(): + event = self.db.get_event_from_handle(event_ref.ref) + if event.get_type()[0] == RelLib.Event.MARRIAGE: m_date = event.get_date_object() place_handle = event.get_place_handle() text = _("Marriage of %s") % Utils.family_name(family,self.db) @@ -222,9 +221,9 @@ class CalendarWriter: def write_person(self, person_handle): person = self.db.get_person_from_handle(person_handle) if person: - birth_handle = person.get_birth_handle() - if birth_handle: - birth = self.db.get_event_from_handle(birth_handle) + birth_ref = person.get_birth_ref() + if birth_ref: + birth = self.db.get_event_from_handle(birth_ref.ref) if birth: b_date = birth.get_date_object() place_handle = birth.get_place_handle() @@ -233,9 +232,10 @@ class CalendarWriter: self.write_vevent(_("Birth of %s") % person.get_primary_name().get_name(), b_date, place.get_title()) else: self.write_vevent(_("Birth of %s") % person.get_primary_name().get_name(), b_date) - death_handle = person.get_death_handle() - if death_handle: - death = self.db.get_event_from_handle(death_handle) + + death_ref = person.get_death_ref() + if death_ref: + death = self.db.get_event_from_handle(death_ref.ref) if death: d_date = death.get_date_object() place_handle = death.get_place_handle() diff --git a/src/plugins/ExportVCard.py b/src/plugins/ExportVCard.py index 120a39358..2cada851d 100644 --- a/src/plugins/ExportVCard.py +++ b/src/plugins/ExportVCard.py @@ -186,9 +186,9 @@ class CardWriter: if prname.get_title(): self.writeln("TITLE:%s" % prname.get_title()) - birth_handle = person.get_birth_handle() - if birth_handle: - birth = self.db.get_event_from_handle(birth_handle) + birth_ref = person.get_birth_ref() + if birth_ref: + birth = self.db.get_event_from_handle(birth_ref.ref) if birth: b_date = birth.get_date_object() mod = b_date.get_modifier() diff --git a/src/plugins/FilterEditor.py b/src/plugins/FilterEditor.py index 0476cffad..9e999fcac 100644 --- a/src/plugins/FilterEditor.py +++ b/src/plugins/FilterEditor.py @@ -69,14 +69,14 @@ from PluginUtils import Tool, register_tool # #------------------------------------------------------------------------- _name2list = { - _('Personal event:') : const.personal_events, - _('Family event:') : const.family_events, - _('Personal attribute:') : const.personal_attributes, - _('Family attribute:') : const.family_attributes, + _('Personal event:') : Utils.personal_events.values(), + _('Family event:') : Utils.family_events.values(), + _('Personal attribute:') : Utils.personal_attributes.values(), + _('Family attribute:') : Utils.family_attributes.values(), } _menulist = { - _('Relationship type:') : const.family_relations, + _('Relationship type:') : Utils.family_relations.values(), } #------------------------------------------------------------------------- diff --git a/src/plugins/IndivSummary.py b/src/plugins/IndivSummary.py index f247336c9..88afd1bd8 100644 --- a/src/plugins/IndivSummary.py +++ b/src/plugins/IndivSummary.py @@ -310,12 +310,12 @@ class IndivSummary(Report.Report): self.doc.end_cell() self.doc.end_row() - event_list = [ self.start_person.get_birth_handle(), - self.start_person.get_death_handle() ] - event_list = event_list + self.start_person.get_event_list() - for event_handle in event_list: - if event_handle: - event = self.database.get_event_from_handle(event_handle) + event_ref_list = [ self.start_person.get_birth_ref(), + self.start_person.get_death_ref() ] + \ + self.start_person.get_event_list() + for event_ref in event_ref_list: + if event_ref: + event = self.database.get_event_from_handle(event_ref.ref) self.write_fact(event) self.doc.end_table() diff --git a/src/plugins/NavWebPage.py b/src/plugins/NavWebPage.py index 6a3804092..2846e2be7 100644 --- a/src/plugins/NavWebPage.py +++ b/src/plugins/NavWebPage.py @@ -1338,9 +1338,9 @@ class ContactPage(BasePage): class IndividualPage(BasePage): gender_map = { - RelLib.Person.MALE : const.male, - RelLib.Person.FEMALE : const.female, - RelLib.Person.UNKNOWN : const.unknown, + RelLib.Person.MALE : _('male'), + RelLib.Person.FEMALE : _('female'), + RelLib.Person.UNKNOWN : _('unknown'), } def __init__(self, db, person, title, ind_list, restrict_list, diff --git a/src/plugins/WriteCD.py b/src/plugins/WriteCD.py index 200c7b2de..eb3973632 100644 --- a/src/plugins/WriteCD.py +++ b/src/plugins/WriteCD.py @@ -58,7 +58,7 @@ except: # GRAMPS modules # #------------------------------------------------------------------------- -import WriteXML +import GrampsDb import Utils import Mime import const @@ -136,7 +136,7 @@ class PackageWriter: # Write XML now g = create('burn:///%s/data.gramps' % base,OPEN_WRITE ) - gfile = WriteXML.XmlWriter(self.db,None,1) + gfile = GrampsDb.XmlWriter(self.db,None,1) gfile.write_handle(g) g.close()