Workaround to avoid importing all of ReportUtils and gtk

svn: r13613
This commit is contained in:
Doug Blank 2009-11-17 23:28:04 +00:00
parent 8cfd607ed5
commit ac95f805ac

View File

@ -29,10 +29,23 @@ import DateHandler
import Utils import Utils
from BasicUtils import name_displayer from BasicUtils import name_displayer
from ReportBase import ReportUtils
from gen.lib import EventType from gen.lib import EventType
import config import config
#-------------------------------------------------------------------------
#
# Local functions
#
#-------------------------------------------------------------------------
# FIXME: this is copied from ReportBase._ReportUtils to avoid the gtk
# imports.
def place_name(db, place_handle):
if place_handle:
place = db.get_place_from_handle(place_handle).get_title()
else:
place = ""
return unicode(place)
class SimpleAccess(object): class SimpleAccess(object):
""" """
Provide a simplified database access system. This system has been designed to Provide a simplified database access system. This system has been designed to
@ -298,7 +311,7 @@ class SimpleAccess(object):
if event_handle: if event_handle:
event = self.dbase.get_event_from_handle(event_handle) event = self.dbase.get_event_from_handle(event_handle)
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
return ReportUtils.place_name(self.dbase, place_handle) return place_name(self.dbase, place_handle)
return u'' return u''
def spouse(self, person): def spouse(self, person):
@ -380,7 +393,7 @@ class SimpleAccess(object):
if event.type == EventType.MARRIAGE ] if event.type == EventType.MARRIAGE ]
if events: if events:
place_handle = events[0].get_place_handle() place_handle = events[0].get_place_handle()
return ReportUtils.place_name(self.dbase, place_handle) return place_name(self.dbase, place_handle)
return u'' return u''
def marriage_date(self, person): def marriage_date(self, person):
@ -567,7 +580,7 @@ class SimpleAccess(object):
if event: if event:
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
return ReportUtils.place_name(self.dbase, place_handle) return place_name(self.dbase, place_handle)
else: else:
return u'' return u''