handle to ref conversions
svn: r6239
This commit is contained in:
parent
97ee7bdc17
commit
6c0e2b86d6
@ -1,3 +1,7 @@
|
||||
2006-03-30 Don Allingham <don@gramps-project.org>
|
||||
* various: convert get_birth_handle()/get_death_handle() to ref
|
||||
calls
|
||||
|
||||
2006-03-30 Brian Matherly <pez4brian@users.sourceforge.net>
|
||||
* src/plugins/GraphViz.py: import const
|
||||
* src/plugins/DecendReport.py: use full dates instead of just year.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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]))
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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())
|
||||
|
@ -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
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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, []))
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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(),
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user