* src/DisplayModels/_PeopleModel.py: Make fallbacks for birth and death work again.
* src/DataViews/_RelationView.py (write_title): Display fallbacks in case birth or death is not available * src/DataViews/_PedigreeView.py: Display fallbacks in case birth or death is not available svn: r7575
This commit is contained in:
parent
7716a5c6d1
commit
1995a4a74d
@ -1,3 +1,11 @@
|
|||||||
|
2006-11-07 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
|
* src/DisplayModels/_PeopleModel.py: Make fallbacks for birth and
|
||||||
|
death work again.
|
||||||
|
* src/DataViews/_RelationView.py (write_title): Display fallbacks
|
||||||
|
in case birth or death is not available
|
||||||
|
* src/DataViews/_PedigreeView.py: Display fallbacks in case birth
|
||||||
|
or death is not available
|
||||||
|
|
||||||
2006-11-06 Don Allingham <don@gramps-project.org>
|
2006-11-06 Don Allingham <don@gramps-project.org>
|
||||||
* src/glade/gramps.glade: add tooltips for place buttons
|
* src/glade/gramps.glade: add tooltips for place buttons
|
||||||
* src/GrampsWidgets.py: provide default instructions for place
|
* src/GrampsWidgets.py: provide default instructions for place
|
||||||
|
@ -133,7 +133,7 @@ class PersonBoxWidget_cairo( gtk.DrawingArea, _PersonWidget_base):
|
|||||||
self.connect("realize", self.realize)
|
self.connect("realize", self.realize)
|
||||||
self.text = ""
|
self.text = ""
|
||||||
if self.person:
|
if self.person:
|
||||||
self.text = self.fh.format_person(self.person,self.maxlines)
|
self.text = self.fh.format_person(self.person,self.maxlines,True)
|
||||||
alive = Utils.probably_alive(self.person,self.fh.dbstate.db)
|
alive = Utils.probably_alive(self.person,self.fh.dbstate.db)
|
||||||
if alive and self.person.get_gender() == RelLib.Person.MALE:
|
if alive and self.person.get_gender() == RelLib.Person.MALE:
|
||||||
self.bgcolor = (185/256.0, 207/256.0, 231/256.0)
|
self.bgcolor = (185/256.0, 207/256.0, 231/256.0)
|
||||||
@ -178,7 +178,7 @@ class PersonBoxWidget_cairo( gtk.DrawingArea, _PersonWidget_base):
|
|||||||
self.context = self.window.cairo_create()
|
self.context = self.window.cairo_create()
|
||||||
self.textlayout = self.context.create_layout()
|
self.textlayout = self.context.create_layout()
|
||||||
self.textlayout.set_font_description(self.get_style().font_desc)
|
self.textlayout.set_font_description(self.get_style().font_desc)
|
||||||
self.textlayout.set_text(self.text)
|
self.textlayout.set_markup(self.text)
|
||||||
s = self.textlayout.get_pixel_size()
|
s = self.textlayout.get_pixel_size()
|
||||||
xmin = s[0] + 12
|
xmin = s[0] + 12
|
||||||
ymin = s[1] + 11
|
ymin = s[1] + 11
|
||||||
@ -384,14 +384,58 @@ class FormattingHelper:
|
|||||||
text = place_title
|
text = place_title
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def format_person( self, person, line_count):
|
def format_person( self, person, line_count, use_markup=False):
|
||||||
if not person:
|
if not person:
|
||||||
return ""
|
return ""
|
||||||
name = NameDisplay.displayer.display(person)
|
name = NameDisplay.displayer.display(person)
|
||||||
if line_count < 3:
|
if line_count < 3:
|
||||||
return name
|
return name
|
||||||
bdate,bplace,bdate_full,bdate_mod,ddate,dplace,ddate_full,ddate_mod = \
|
|
||||||
ReportUtils.get_birth_death_strings(self.dbstate.db,person)
|
birth_ref = person.get_birth_ref()
|
||||||
|
birth = None
|
||||||
|
birth_fallback = False
|
||||||
|
if birth_ref:
|
||||||
|
birth = self.dbstate.db.get_event_from_handle(birth_ref.ref)
|
||||||
|
else:
|
||||||
|
for event_ref in person.get_event_ref_list():
|
||||||
|
event = self.dbstate.db.get_event_from_handle(event_ref.ref)
|
||||||
|
if event.get_type() in [RelLib.EventType.CHRISTEN, RelLib.EventType.BAPTISM]:
|
||||||
|
birth = event
|
||||||
|
birth_fallback = True
|
||||||
|
break
|
||||||
|
|
||||||
|
death_ref = person.get_death_ref()
|
||||||
|
death = None
|
||||||
|
death_fallback = False
|
||||||
|
if death_ref:
|
||||||
|
death = self.dbstate.db.get_event_from_handle(death_ref.ref)
|
||||||
|
else:
|
||||||
|
for event_ref in person.get_event_ref_list():
|
||||||
|
event = self.dbstate.db.get_event_from_handle(event_ref.ref)
|
||||||
|
if event.get_type() in [RelLib.EventType.BURIAL, RelLib.EventType.CREMATION]:
|
||||||
|
death = event
|
||||||
|
death_fallback = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if birth and birth_fallback and use_markup:
|
||||||
|
bdate = "<i>%s</i>" % birth.get_date_object()
|
||||||
|
bplace = "<i>%s</i>" % self.get_place_name(birth)
|
||||||
|
elif birth:
|
||||||
|
bdate = birth.get_date_object()
|
||||||
|
bplace = self.get_place_name(birth)
|
||||||
|
else:
|
||||||
|
bdate = ""
|
||||||
|
bplace = ""
|
||||||
|
if death and death_fallback and use_markup:
|
||||||
|
ddate = "<i>%s</i>" % death.get_date_object()
|
||||||
|
dplace = "<i>%s</i>" % self.get_place_name(death)
|
||||||
|
elif death:
|
||||||
|
ddate = death.get_date_object()
|
||||||
|
dplace = self.get_place_name(death)
|
||||||
|
else:
|
||||||
|
ddate = ""
|
||||||
|
dplace = ""
|
||||||
|
|
||||||
if line_count < 5:
|
if line_count < 5:
|
||||||
return "%s\n* %s\n+ %s" % (name,bdate,ddate)
|
return "%s\n* %s\n+ %s" % (name,bdate,ddate)
|
||||||
else:
|
else:
|
||||||
|
@ -442,23 +442,45 @@ class RelationshipView(PageView.PersonNavView):
|
|||||||
|
|
||||||
# Birth event.
|
# Birth event.
|
||||||
birth_ref = person.get_birth_ref()
|
birth_ref = person.get_birth_ref()
|
||||||
|
birth_title = _('Birth')
|
||||||
|
birth = None
|
||||||
if birth_ref:
|
if birth_ref:
|
||||||
birth = self.dbstate.db.get_event_from_handle(birth_ref.ref)
|
birth = self.dbstate.db.get_event_from_handle(birth_ref.ref)
|
||||||
else:
|
else:
|
||||||
birth = None
|
for event_ref in person.get_event_ref_list():
|
||||||
|
event = self.dbstate.db.get_event_from_handle(event_ref.ref)
|
||||||
|
if event.get_type() == RelLib.EventType.CHRISTEN:
|
||||||
|
birth_title = _('Christening')
|
||||||
|
birth = event
|
||||||
|
break
|
||||||
|
if event.get_type() == RelLib.EventType.BAPTISM:
|
||||||
|
birth_title = _('Baptism')
|
||||||
|
birth = event
|
||||||
|
break
|
||||||
|
|
||||||
subtbl.attach(GrampsWidgets.BasicLabel("%s:" % _('Birth')),
|
subtbl.attach(GrampsWidgets.BasicLabel("%s:" % birth_title),
|
||||||
1, 2, 1, 2, xoptions=gtk.FILL, yoptions=0)
|
1, 2, 1, 2, xoptions=gtk.FILL, yoptions=0)
|
||||||
subtbl.attach(GrampsWidgets.BasicLabel(self.format_event(birth)),
|
subtbl.attach(GrampsWidgets.BasicLabel(self.format_event(birth)),
|
||||||
2, 3, 1, 2, yoptions=0)
|
2, 3, 1, 2, yoptions=0)
|
||||||
|
|
||||||
death_ref = person.get_death_ref()
|
death_ref = person.get_death_ref()
|
||||||
|
death_title = _('Death')
|
||||||
|
death = None
|
||||||
if death_ref:
|
if death_ref:
|
||||||
death = self.dbstate.db.get_event_from_handle(death_ref.ref)
|
death = self.dbstate.db.get_event_from_handle(death_ref.ref)
|
||||||
else:
|
else:
|
||||||
death = None
|
for event_ref in person.get_event_ref_list():
|
||||||
|
event = self.dbstate.db.get_event_from_handle(event_ref.ref)
|
||||||
|
if event.get_type() == RelLib.EventType.BURIAL:
|
||||||
|
death_title = _('Burial')
|
||||||
|
death = event
|
||||||
|
break
|
||||||
|
if event.get_type() == RelLib.EventType.CREMATION:
|
||||||
|
death_title = _('Cremation')
|
||||||
|
death = event
|
||||||
|
break
|
||||||
|
|
||||||
subtbl.attach(GrampsWidgets.BasicLabel("%s:" % _('Death')),
|
subtbl.attach(GrampsWidgets.BasicLabel("%s:" % death_title),
|
||||||
1, 2, 2, 3, xoptions=gtk.FILL, yoptions=0)
|
1, 2, 2, 3, xoptions=gtk.FILL, yoptions=0)
|
||||||
subtbl.attach(GrampsWidgets.BasicLabel(self.format_event(death)),
|
subtbl.attach(GrampsWidgets.BasicLabel(self.format_event(death)),
|
||||||
2, 3, 2, 3, yoptions=0)
|
2, 3, 2, 3, yoptions=0)
|
||||||
@ -963,4 +985,3 @@ class RelationshipView(PageView.PersonNavView):
|
|||||||
self.dbstate.active.handle)
|
self.dbstate.active.handle)
|
||||||
except Errors.WindowActiveError:
|
except Errors.WindowActiveError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -452,7 +452,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
er = EventRef()
|
er = EventRef()
|
||||||
er.unserialize(event_ref)
|
er.unserialize(event_ref)
|
||||||
event = self.db.get_event_from_handle(er.ref)
|
event = self.db.get_event_from_handle(er.ref)
|
||||||
etype = event.get_type()[0]
|
etype = event.get_type()
|
||||||
date_str = DateHandler.get_date(event)
|
date_str = DateHandler.get_date(event)
|
||||||
if (etype in [EventType.BAPTISM, EventType.CHRISTEN]
|
if (etype in [EventType.BAPTISM, EventType.CHRISTEN]
|
||||||
and date_str != ""):
|
and date_str != ""):
|
||||||
@ -478,7 +478,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
er = EventRef()
|
er = EventRef()
|
||||||
er.unserialize(event_ref)
|
er.unserialize(event_ref)
|
||||||
event = self.db.get_event_from_handle(er.ref)
|
event = self.db.get_event_from_handle(er.ref)
|
||||||
etype = event.get_type()[0]
|
etype = event.get_type()
|
||||||
date_str = DateHandler.get_date(event)
|
date_str = DateHandler.get_date(event)
|
||||||
if (etype in [EventType.BURIAL, EventType.CREMATION]
|
if (etype in [EventType.BURIAL, EventType.CREMATION]
|
||||||
and date_str != ""):
|
and date_str != ""):
|
||||||
@ -508,7 +508,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
er = EventRef()
|
er = EventRef()
|
||||||
er.unserialize(event_ref)
|
er.unserialize(event_ref)
|
||||||
event = self.db.get_event_from_handle(er.ref)
|
event = self.db.get_event_from_handle(er.ref)
|
||||||
etype = event.get_type()[0]
|
etype = event.get_type()
|
||||||
if etype in [EventType.BAPTISM, EventType.CHRISTEN]:
|
if etype in [EventType.BAPTISM, EventType.CHRISTEN]:
|
||||||
place_handle = event.get_place_handle()
|
place_handle = event.get_place_handle()
|
||||||
if place_handle:
|
if place_handle:
|
||||||
@ -541,7 +541,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
er = EventRef()
|
er = EventRef()
|
||||||
er.unserialize(event_ref)
|
er.unserialize(event_ref)
|
||||||
event = self.db.get_event_from_handle(er.ref)
|
event = self.db.get_event_from_handle(er.ref)
|
||||||
etype = event.get_type()[0]
|
etype = event.get_type()
|
||||||
if etype in [EventType.BURIAL, EventType.CREMATION]:
|
if etype in [EventType.BURIAL, EventType.CREMATION]:
|
||||||
place_handle = event.get_place_handle()
|
place_handle = event.get_place_handle()
|
||||||
if place_handle:
|
if place_handle:
|
||||||
|
Loading…
Reference in New Issue
Block a user