Moved fallback functions from Db to gen.utils
svn: r13876
This commit is contained in:
parent
c01fa3c174
commit
3a8b4d7e40
@ -166,30 +166,6 @@ def find_marriage(database, family):
|
|||||||
return event
|
return event
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_birth_or_fallback(database, person):
|
|
||||||
birth_ref = person.get_birth_ref()
|
|
||||||
if birth_ref: # regular birth found
|
|
||||||
return database.get_event_from_handle(birth_ref.ref)
|
|
||||||
# now search the event list for fallbacks
|
|
||||||
for event_ref in person.get_primary_event_ref_list():
|
|
||||||
event = database.get_event_from_handle(event_ref.ref)
|
|
||||||
if (event.type.is_birth_fallback() and
|
|
||||||
event_ref.role.is_primary()):
|
|
||||||
return event
|
|
||||||
return None
|
|
||||||
|
|
||||||
def get_death_or_fallback(database, person):
|
|
||||||
death_ref = person.get_death_ref()
|
|
||||||
if death_ref: # regular death found
|
|
||||||
return database.get_event_from_handle(death_ref.ref)
|
|
||||||
# now search the event list for fallbacks
|
|
||||||
for event_ref in person.get_primary_event_ref_list():
|
|
||||||
event = database.get_event_from_handle(event_ref.ref)
|
|
||||||
if (event.type.is_death_fallback() and
|
|
||||||
event_ref.role.is_primary()):
|
|
||||||
return event
|
|
||||||
return None
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Indexing function
|
# Indexing function
|
||||||
|
@ -40,8 +40,8 @@ import locale
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gen.lib import Date
|
from gen.lib import Date
|
||||||
|
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||||
from BasicUtils import name_displayer as _nd
|
from BasicUtils import name_displayer as _nd
|
||||||
from ReportBase import ReportUtils
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -118,13 +118,13 @@ class Sort(object):
|
|||||||
first = self.database.get_person_from_handle(first_id)
|
first = self.database.get_person_from_handle(first_id)
|
||||||
second = self.database.get_person_from_handle(second_id)
|
second = self.database.get_person_from_handle(second_id)
|
||||||
|
|
||||||
birth1 = ReportUtils.get_birth_or_fallback(self.database, first)
|
birth1 = get_birth_or_fallback(self.database, first)
|
||||||
if birth1:
|
if birth1:
|
||||||
date1 = birth1.get_date_object()
|
date1 = birth1.get_date_object()
|
||||||
else:
|
else:
|
||||||
date1 = Date()
|
date1 = Date()
|
||||||
|
|
||||||
birth2 = ReportUtils.get_birth_or_fallback(self.database, second)
|
birth2 = get_birth_or_fallback(self.database, second)
|
||||||
if birth2:
|
if birth2:
|
||||||
date2 = birth2.get_date_object()
|
date2 = birth2.get_date_object()
|
||||||
else:
|
else:
|
||||||
@ -143,7 +143,7 @@ class Sort(object):
|
|||||||
are equal, sorts by name"""
|
are equal, sorts by name"""
|
||||||
first = self.database.get_person_from_handle(first_id)
|
first = self.database.get_person_from_handle(first_id)
|
||||||
|
|
||||||
birth1 = ReportUtils.get_birth_or_fallback(self.database, first)
|
birth1 = get_birth_or_fallback(self.database, first)
|
||||||
if birth1:
|
if birth1:
|
||||||
date1 = birth1.get_date_object()
|
date1 = birth1.get_date_object()
|
||||||
else:
|
else:
|
||||||
|
@ -39,9 +39,9 @@ Mary Smith was born on 3/28/1923.
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
|
||||||
from BasicUtils import name_displayer
|
from BasicUtils import name_displayer
|
||||||
from ReportBase import ReportUtils
|
|
||||||
import DateHandler
|
import DateHandler
|
||||||
import gen.lib
|
import gen.lib
|
||||||
|
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -81,13 +81,13 @@ class SubstKeywords(object):
|
|||||||
self.m = ""
|
self.m = ""
|
||||||
self.M = ""
|
self.M = ""
|
||||||
|
|
||||||
birth = ReportUtils.get_birth_or_fallback(database, person)
|
birth = get_birth_or_fallback(database, person)
|
||||||
if birth:
|
if birth:
|
||||||
self.b = DateHandler.get_date(birth)
|
self.b = DateHandler.get_date(birth)
|
||||||
bplace_handle = birth.get_place_handle()
|
bplace_handle = birth.get_place_handle()
|
||||||
if bplace_handle:
|
if bplace_handle:
|
||||||
self.B = database.get_place_from_handle(bplace_handle).get_title()
|
self.B = database.get_place_from_handle(bplace_handle).get_title()
|
||||||
death = ReportUtils.get_death_or_fallback(database, person)
|
death = get_death_or_fallback(database, person)
|
||||||
if death:
|
if death:
|
||||||
self.d = DateHandler.get_date(death)
|
self.d = DateHandler.get_date(death)
|
||||||
dplace_handle = death.get_place_handle()
|
dplace_handle = death.get_place_handle()
|
||||||
|
@ -1520,46 +1520,6 @@ class GrampsDbBase(object):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def get_birth_or_fallback(self, person):
|
|
||||||
"""
|
|
||||||
Get BIRTH event from a person, or fallback to an event around
|
|
||||||
the time of birth.
|
|
||||||
"""
|
|
||||||
birth_ref = person.get_birth_ref()
|
|
||||||
if birth_ref: # regular birth found
|
|
||||||
event = self.get_event_from_handle(birth_ref.ref)
|
|
||||||
if event:
|
|
||||||
return event
|
|
||||||
# now search the event list for fallbacks
|
|
||||||
for event_ref in person.get_primary_event_ref_list():
|
|
||||||
if event_ref:
|
|
||||||
event = self.get_event_from_handle(event_ref.ref)
|
|
||||||
if (event
|
|
||||||
and event.type.is_birth_fallback()
|
|
||||||
and event_ref.role.is_primary()):
|
|
||||||
return event
|
|
||||||
return None
|
|
||||||
|
|
||||||
def get_death_or_fallback(self, person):
|
|
||||||
"""
|
|
||||||
Get a DEATH event from a person, or fallback to an
|
|
||||||
event around the time of death.
|
|
||||||
"""
|
|
||||||
death_ref = person.get_death_ref()
|
|
||||||
if death_ref: # regular death found
|
|
||||||
event = self.get_event_from_handle(death_ref.ref)
|
|
||||||
if event:
|
|
||||||
return event
|
|
||||||
# now search the event list for fallbacks
|
|
||||||
for event_ref in person.get_primary_event_ref_list():
|
|
||||||
if event_ref:
|
|
||||||
event = self.get_event_from_handle(event_ref.ref)
|
|
||||||
if (event
|
|
||||||
and event.type.is_death_fallback()
|
|
||||||
and event_ref.role.is_primary()):
|
|
||||||
return event
|
|
||||||
return None
|
|
||||||
|
|
||||||
def add_child_to_family(self, family, child,
|
def add_child_to_family(self, family, child,
|
||||||
mrel=gen.lib.ChildRefType(),
|
mrel=gen.lib.ChildRefType(),
|
||||||
frel=gen.lib.ChildRefType(),
|
frel=gen.lib.ChildRefType(),
|
||||||
|
@ -10,6 +10,7 @@ pkgdata_PYTHON = \
|
|||||||
callback.py \
|
callback.py \
|
||||||
callman.py \
|
callman.py \
|
||||||
configmanager.py \
|
configmanager.py \
|
||||||
|
fallback.py \
|
||||||
progressmon.py \
|
progressmon.py \
|
||||||
longop.py
|
longop.py
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
Generic utilities useful for users of the gen package
|
Generic utilities useful for users of the gen package
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from fallback import *
|
||||||
from configmanager import ConfigManager
|
from configmanager import ConfigManager
|
||||||
from progressmon import ProgressMonitor
|
from progressmon import ProgressMonitor
|
||||||
from longop import LongOpStatus
|
from longop import LongOpStatus
|
||||||
|
@ -36,8 +36,8 @@ import cgi
|
|||||||
import DateHandler
|
import DateHandler
|
||||||
from BasicUtils import name_displayer
|
from BasicUtils import name_displayer
|
||||||
import Utils
|
import Utils
|
||||||
from ReportBase import ReportUtils
|
|
||||||
import gen.lib
|
import gen.lib
|
||||||
|
from gen.utils import get_birth_or_fallback
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -78,7 +78,7 @@ class ChildModel(gtk.ListStore):
|
|||||||
return self.family.get_child_ref_list()
|
return self.family.get_child_ref_list()
|
||||||
|
|
||||||
def column_birth_day(self, data):
|
def column_birth_day(self, data):
|
||||||
birth = ReportUtils.get_birth_or_fallback(self.db, data)
|
birth = get_birth_or_fallback(self.db, data)
|
||||||
if birth:
|
if birth:
|
||||||
if birth.get_type() == gen.lib.EventType.BIRTH:
|
if birth.get_type() == gen.lib.EventType.BIRTH:
|
||||||
return DateHandler.get_date(birth)
|
return DateHandler.get_date(birth)
|
||||||
|
@ -64,7 +64,6 @@ from glade import Glade
|
|||||||
from editprimary import EditPrimary
|
from editprimary import EditPrimary
|
||||||
from editchildref import EditChildRef
|
from editchildref import EditChildRef
|
||||||
from editperson import EditPerson
|
from editperson import EditPerson
|
||||||
from ReportBase import ReportUtils
|
|
||||||
from displaytabs import (EmbeddedList, EventEmbedList, SourceEmbedList,
|
from displaytabs import (EmbeddedList, EventEmbedList, SourceEmbedList,
|
||||||
FamilyAttrEmbedList, NoteTab, GalleryTab,
|
FamilyAttrEmbedList, NoteTab, GalleryTab,
|
||||||
FamilyLdsEmbedList, ChildModel)
|
FamilyLdsEmbedList, ChildModel)
|
||||||
@ -72,8 +71,9 @@ from gui.widgets import (PrivacyButton, MonitoredEntry, MonitoredDataType)
|
|||||||
from gen.plug import CATEGORY_QR_FAMILY
|
from gen.plug import CATEGORY_QR_FAMILY
|
||||||
from QuestionDialog import (ErrorDialog, RunDatabaseRepair, WarningDialog,
|
from QuestionDialog import (ErrorDialog, RunDatabaseRepair, WarningDialog,
|
||||||
MessageHideDialog)
|
MessageHideDialog)
|
||||||
|
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||||
from gui.selectors import SelectorFactory
|
from gui.selectors import SelectorFactory
|
||||||
|
|
||||||
SelectPerson = SelectorFactory('Person')
|
SelectPerson = SelectorFactory('Person')
|
||||||
|
|
||||||
_RETURN = gdk.keyval_from_name("Return")
|
_RETURN = gdk.keyval_from_name("Return")
|
||||||
@ -898,7 +898,7 @@ class EditFamily(EditPrimary):
|
|||||||
person = db.get_person_from_handle(handle)
|
person = db.get_person_from_handle(handle)
|
||||||
name = "%s [%s]" % (name_displayer.display(person),
|
name = "%s [%s]" % (name_displayer.display(person),
|
||||||
person.gramps_id)
|
person.gramps_id)
|
||||||
birth = ReportUtils.get_birth_or_fallback(db, person)
|
birth = get_birth_or_fallback(db, person)
|
||||||
self.callman.register_handles({'person': [handle]})
|
self.callman.register_handles({'person': [handle]})
|
||||||
if birth:
|
if birth:
|
||||||
#if event changes it view needs to update
|
#if event changes it view needs to update
|
||||||
@ -906,7 +906,7 @@ class EditFamily(EditPrimary):
|
|||||||
if birth and birth.get_type() == gen.lib.EventType.BAPTISM:
|
if birth and birth.get_type() == gen.lib.EventType.BAPTISM:
|
||||||
birth_label.set_label(_("Baptism:"))
|
birth_label.set_label(_("Baptism:"))
|
||||||
|
|
||||||
death = ReportUtils.get_death_or_fallback(db, person)
|
death = get_death_or_fallback(db, person)
|
||||||
if death:
|
if death:
|
||||||
#if event changes it view needs to update
|
#if event changes it view needs to update
|
||||||
self.callman.register_handles({'event': [death.get_handle()]})
|
self.callman.register_handles({'event': [death.get_handle()]})
|
||||||
|
@ -48,6 +48,7 @@ from BasicUtils import name_displayer
|
|||||||
from Utils import probably_alive
|
from Utils import probably_alive
|
||||||
from gui.utils import ProgressMeter
|
from gui.utils import ProgressMeter
|
||||||
import gen.lib
|
import gen.lib
|
||||||
|
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -139,13 +140,13 @@ class TimeLine(Report):
|
|||||||
for p_id in self.plist:
|
for p_id in self.plist:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
p = self.database.get_person_from_handle(p_id)
|
p = self.database.get_person_from_handle(p_id)
|
||||||
birth = ReportUtils.get_birth_or_fallback(self.database, p)
|
birth = get_birth_or_fallback(self.database, p)
|
||||||
if birth:
|
if birth:
|
||||||
b = birth.get_date_object().to_calendar(self.calendar).get_year()
|
b = birth.get_date_object().to_calendar(self.calendar).get_year()
|
||||||
else:
|
else:
|
||||||
b = None
|
b = None
|
||||||
|
|
||||||
death = ReportUtils.get_death_or_fallback(self.database, p)
|
death = get_death_or_fallback(self.database, p)
|
||||||
if death:
|
if death:
|
||||||
d = death.get_date_object().to_calendar(self.calendar).get_year()
|
d = death.get_date_object().to_calendar(self.calendar).get_year()
|
||||||
else:
|
else:
|
||||||
@ -242,13 +243,13 @@ class TimeLine(Report):
|
|||||||
|
|
||||||
for p_id in self.plist:
|
for p_id in self.plist:
|
||||||
p = self.database.get_person_from_handle(p_id)
|
p = self.database.get_person_from_handle(p_id)
|
||||||
birth = ReportUtils.get_birth_or_fallback(self.database, p)
|
birth = get_birth_or_fallback(self.database, p)
|
||||||
if birth:
|
if birth:
|
||||||
b = birth.get_date_object().to_calendar(self.calendar).get_year()
|
b = birth.get_date_object().to_calendar(self.calendar).get_year()
|
||||||
else:
|
else:
|
||||||
b = None
|
b = None
|
||||||
|
|
||||||
death = ReportUtils.get_death_or_fallback(self.database, p)
|
death = get_death_or_fallback(self.database, p)
|
||||||
if death:
|
if death:
|
||||||
d = death.get_date_object().to_calendar(self.calendar).get_year()
|
d = death.get_date_object().to_calendar(self.calendar).get_year()
|
||||||
else:
|
else:
|
||||||
|
@ -36,9 +36,9 @@ from gen.plug import Gramplet
|
|||||||
from TransUtils import sgettext as _
|
from TransUtils import sgettext as _
|
||||||
from gettext import ngettext
|
from gettext import ngettext
|
||||||
from BasicUtils import name_displayer
|
from BasicUtils import name_displayer
|
||||||
from ReportBase import ReportUtils
|
|
||||||
import DateHandler
|
import DateHandler
|
||||||
import gen
|
import gen
|
||||||
|
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -185,7 +185,7 @@ class PedigreeGramplet(Gramplet):
|
|||||||
self.set_box(generation, 0) # regardless, turn off line if on
|
self.set_box(generation, 0) # regardless, turn off line if on
|
||||||
|
|
||||||
def info_string(self, person):
|
def info_string(self, person):
|
||||||
birth = ReportUtils.get_birth_or_fallback(self.dbstate.db, person)
|
birth = get_birth_or_fallback(self.dbstate.db, person)
|
||||||
if birth and birth.get_type() != gen.lib.EventType.BIRTH:
|
if birth and birth.get_type() != gen.lib.EventType.BIRTH:
|
||||||
sdate = DateHandler.get_date(birth)
|
sdate = DateHandler.get_date(birth)
|
||||||
if sdate:
|
if sdate:
|
||||||
@ -197,7 +197,7 @@ class PedigreeGramplet(Gramplet):
|
|||||||
else:
|
else:
|
||||||
bdate = ""
|
bdate = ""
|
||||||
|
|
||||||
death = ReportUtils.get_death_or_fallback(self.dbstate.db, person)
|
death = get_death_or_fallback(self.dbstate.db, person)
|
||||||
if death and death.get_type() != gen.lib.EventType.DEATH:
|
if death and death.get_type() != gen.lib.EventType.DEATH:
|
||||||
sdate = DateHandler.get_date(death)
|
sdate = DateHandler.get_date(death)
|
||||||
if sdate:
|
if sdate:
|
||||||
|
@ -56,6 +56,7 @@ from ReportBase import Report, ReportUtils, MenuReportOptions
|
|||||||
from gen.plug.menu import NumberOption, ColorOption, BooleanOption, \
|
from gen.plug.menu import NumberOption, ColorOption, BooleanOption, \
|
||||||
EnumeratedListOption, PersonListOption, \
|
EnumeratedListOption, PersonListOption, \
|
||||||
SurnameColorOption
|
SurnameColorOption
|
||||||
|
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -780,8 +781,8 @@ class FamilyLinesReport(Report):
|
|||||||
|
|
||||||
# see if we have a birth/death or fallback dates we can use
|
# see if we have a birth/death or fallback dates we can use
|
||||||
if self._incdates or self._incplaces:
|
if self._incdates or self._incplaces:
|
||||||
bth_event = ReportUtils.get_birth_or_fallback(self._db, person)
|
bth_event = get_birth_or_fallback(self._db, person)
|
||||||
dth_event = ReportUtils.get_death_or_fallback(self._db, person)
|
dth_event = get_death_or_fallback(self._db, person)
|
||||||
else:
|
else:
|
||||||
bth_event = None
|
bth_event = None
|
||||||
dth_event = None
|
dth_event = None
|
||||||
|
@ -43,6 +43,7 @@ from gen.plug.menu import (PersonOption, BooleanOption, NumberOption,
|
|||||||
EnumeratedListOption)
|
EnumeratedListOption)
|
||||||
from ReportBase import Report, ReportUtils, MenuReportOptions
|
from ReportBase import Report, ReportUtils, MenuReportOptions
|
||||||
import DateHandler
|
import DateHandler
|
||||||
|
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -169,13 +170,13 @@ class HourGlassReport(Report):
|
|||||||
p_id = person.get_gramps_id()
|
p_id = person.get_gramps_id()
|
||||||
name = name_displayer.display_formal(person)
|
name = name_displayer.display_formal(person)
|
||||||
|
|
||||||
birth_evt = ReportUtils.get_birth_or_fallback(self.__db, person)
|
birth_evt = get_birth_or_fallback(self.__db, person)
|
||||||
if birth_evt:
|
if birth_evt:
|
||||||
birth = DateHandler.get_date(birth_evt)
|
birth = DateHandler.get_date(birth_evt)
|
||||||
else:
|
else:
|
||||||
birth = ""
|
birth = ""
|
||||||
|
|
||||||
death_evt = ReportUtils.get_death_or_fallback(self.__db, person)
|
death_evt = get_death_or_fallback(self.__db, person)
|
||||||
if death_evt:
|
if death_evt:
|
||||||
death = DateHandler.get_date(death_evt)
|
death = DateHandler.get_date(death_evt)
|
||||||
else:
|
else:
|
||||||
|
@ -53,6 +53,7 @@ import DateHandler
|
|||||||
import gen.lib
|
import gen.lib
|
||||||
import Utils
|
import Utils
|
||||||
import ThumbNails
|
import ThumbNails
|
||||||
|
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -403,13 +404,13 @@ class RelGraphReport(Report):
|
|||||||
|
|
||||||
def get_date_strings(self, person):
|
def get_date_strings(self, person):
|
||||||
"returns tuple of birth/christening and death/burying date strings"
|
"returns tuple of birth/christening and death/burying date strings"
|
||||||
birth_event = ReportUtils.get_birth_or_fallback(self.database, person)
|
birth_event = get_birth_or_fallback(self.database, person)
|
||||||
if birth_event:
|
if birth_event:
|
||||||
birth = self.get_event_string(birth_event)
|
birth = self.get_event_string(birth_event)
|
||||||
else:
|
else:
|
||||||
birth = ""
|
birth = ""
|
||||||
|
|
||||||
death_event = ReportUtils.get_death_or_fallback(self.database, person)
|
death_event = get_death_or_fallback(self.database, person)
|
||||||
if death_event:
|
if death_event:
|
||||||
death = self.get_event_string(death_event)
|
death = self.get_event_string(death_event)
|
||||||
else:
|
else:
|
||||||
|
@ -40,7 +40,7 @@ from cgi import escape
|
|||||||
import gen.lib
|
import gen.lib
|
||||||
import DateHandler
|
import DateHandler
|
||||||
from BasicUtils import name_displayer
|
from BasicUtils import name_displayer
|
||||||
from ReportBase import ReportUtils
|
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -111,7 +111,7 @@ class FormattingHelper(object):
|
|||||||
name = name_displayer.display(person)
|
name = name_displayer.display(person)
|
||||||
text = name
|
text = name
|
||||||
if line_count >= 3:
|
if line_count >= 3:
|
||||||
birth = ReportUtils.get_birth_or_fallback(self.dbstate.db, person)
|
birth = get_birth_or_fallback(self.dbstate.db, person)
|
||||||
if birth and use_markup and birth.get_type() != \
|
if birth and use_markup and birth.get_type() != \
|
||||||
gen.lib.EventType.BIRTH:
|
gen.lib.EventType.BIRTH:
|
||||||
bdate = "<i>%s</i>" % escape(DateHandler.get_date(birth))
|
bdate = "<i>%s</i>" % escape(DateHandler.get_date(birth))
|
||||||
@ -126,7 +126,7 @@ class FormattingHelper(object):
|
|||||||
else:
|
else:
|
||||||
bdate = ""
|
bdate = ""
|
||||||
bplace = ""
|
bplace = ""
|
||||||
death = ReportUtils.get_death_or_fallback(self.dbstate.db, person)
|
death = get_death_or_fallback(self.dbstate.db, person)
|
||||||
if death and use_markup and death.get_type() != \
|
if death and use_markup and death.get_type() != \
|
||||||
gen.lib.EventType.DEATH:
|
gen.lib.EventType.DEATH:
|
||||||
ddate = "<i>%s</i>" % escape(DateHandler.get_date(death))
|
ddate = "<i>%s</i>" % escape(DateHandler.get_date(death))
|
||||||
|
@ -46,6 +46,7 @@ from Errors import ReportError
|
|||||||
from ReportBase import Report, ReportUtils, MenuReportOptions
|
from ReportBase import Report, ReportUtils, MenuReportOptions
|
||||||
import DateHandler
|
import DateHandler
|
||||||
import Sort
|
import Sort
|
||||||
|
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||||
|
|
||||||
_BORN = _('b.')
|
_BORN = _('b.')
|
||||||
_DIED = _('d.')
|
_DIED = _('d.')
|
||||||
@ -85,8 +86,8 @@ class DescendantReport(Report):
|
|||||||
self.by_birthdate = sort.by_birthdate
|
self.by_birthdate = sort.by_birthdate
|
||||||
|
|
||||||
def dump_dates(self, person):
|
def dump_dates(self, person):
|
||||||
birth = ReportUtils.get_birth_or_fallback(self.database, person)
|
birth = get_birth_or_fallback(self.database, person)
|
||||||
death = ReportUtils.get_death_or_fallback(self.database, person)
|
death = get_death_or_fallback(self.database, person)
|
||||||
|
|
||||||
if birth or death:
|
if birth or death:
|
||||||
self.doc.write_text(' (')
|
self.doc.write_text(' (')
|
||||||
|
@ -44,6 +44,7 @@ from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle,
|
|||||||
from gen.plug.menu import NumberOption, BooleanOption, PersonOption
|
from gen.plug.menu import NumberOption, BooleanOption, PersonOption
|
||||||
from ReportBase import Report, ReportUtils, MenuReportOptions
|
from ReportBase import Report, ReportUtils, MenuReportOptions
|
||||||
import DateHandler
|
import DateHandler
|
||||||
|
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -283,12 +284,12 @@ class KinshipReport(Report):
|
|||||||
name = name_displayer.display(person)
|
name = name_displayer.display(person)
|
||||||
mark = ReportUtils.get_person_mark(self.database, person)
|
mark = ReportUtils.get_person_mark(self.database, person)
|
||||||
birth_date = ""
|
birth_date = ""
|
||||||
birth = ReportUtils.get_birth_or_fallback(self.database, person)
|
birth = get_birth_or_fallback(self.database, person)
|
||||||
if birth:
|
if birth:
|
||||||
birth_date = DateHandler.get_date(birth)
|
birth_date = DateHandler.get_date(birth)
|
||||||
|
|
||||||
death_date = ""
|
death_date = ""
|
||||||
death = ReportUtils.get_death_or_fallback(self.database, person)
|
death = get_death_or_fallback(self.database, person)
|
||||||
if death:
|
if death:
|
||||||
death_date = DateHandler.get_date(death)
|
death_date = DateHandler.get_date(death)
|
||||||
dates = _(" (%(birth_date)s - %(death_date)s)") % {
|
dates = _(" (%(birth_date)s - %(death_date)s)") % {
|
||||||
|
@ -61,7 +61,7 @@ import Errors
|
|||||||
import Bookmarks
|
import Bookmarks
|
||||||
import const
|
import const
|
||||||
|
|
||||||
from ReportBase import ReportUtils
|
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||||
|
|
||||||
_GenderCode = {
|
_GenderCode = {
|
||||||
gen.lib.Person.MALE : u'\u2642',
|
gen.lib.Person.MALE : u'\u2642',
|
||||||
@ -582,7 +582,7 @@ class RelationshipView(NavigationView):
|
|||||||
2, 3, 0, 1, yoptions=0)
|
2, 3, 0, 1, yoptions=0)
|
||||||
|
|
||||||
# Birth event.
|
# Birth event.
|
||||||
birth = ReportUtils.get_birth_or_fallback(self.dbstate.db, person)
|
birth = get_birth_or_fallback(self.dbstate.db, person)
|
||||||
if birth:
|
if birth:
|
||||||
birth_title = birth.get_type()
|
birth_title = birth.get_type()
|
||||||
else:
|
else:
|
||||||
@ -593,7 +593,7 @@ class RelationshipView(NavigationView):
|
|||||||
subtbl.attach(widgets.BasicLabel(self.format_event(birth)),
|
subtbl.attach(widgets.BasicLabel(self.format_event(birth)),
|
||||||
2, 3, 1, 2, yoptions=0)
|
2, 3, 1, 2, yoptions=0)
|
||||||
|
|
||||||
death = ReportUtils.get_death_or_fallback(self.dbstate.db, person)
|
death = get_death_or_fallback(self.dbstate.db, person)
|
||||||
if death:
|
if death:
|
||||||
death_title = death.get_type()
|
death_title = death.get_type()
|
||||||
else:
|
else:
|
||||||
@ -1121,7 +1121,7 @@ class RelationshipView(NavigationView):
|
|||||||
if not person:
|
if not person:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
birth = ReportUtils.get_birth_or_fallback(self.dbstate.db, person)
|
birth = get_birth_or_fallback(self.dbstate.db, person)
|
||||||
if birth and birth.get_type() != gen.lib.EventType.BIRTH:
|
if birth and birth.get_type() != gen.lib.EventType.BIRTH:
|
||||||
sdate = DateHandler.get_date(birth)
|
sdate = DateHandler.get_date(birth)
|
||||||
if sdate:
|
if sdate:
|
||||||
@ -1133,7 +1133,7 @@ class RelationshipView(NavigationView):
|
|||||||
else:
|
else:
|
||||||
bdate = ""
|
bdate = ""
|
||||||
|
|
||||||
death = ReportUtils.get_death_or_fallback(self.dbstate.db, person)
|
death = get_death_or_fallback(self.dbstate.db, person)
|
||||||
if death and death.get_type() != gen.lib.EventType.DEATH:
|
if death and death.get_type() != gen.lib.EventType.DEATH:
|
||||||
sdate = DateHandler.get_date(death)
|
sdate = DateHandler.get_date(death)
|
||||||
if sdate:
|
if sdate:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user