Refactoring the report system: reports no longer require dbstate.
svn: r9924
This commit is contained in:
parent
c43c200c5d
commit
77af7ed092
27
ChangeLog
27
ChangeLog
@ -1,3 +1,30 @@
|
||||
2008-01-24 Brian Matherly <brian@gramps-project.org>
|
||||
* src/ReportBase/_CommandLineReport.py:
|
||||
* src/ReportBase/_ReportOptions.py:
|
||||
* src/plugins/DescendReport.py:
|
||||
* src/plugins/DetDescendantReport.py:
|
||||
* src/plugins/KinshipReport.py:
|
||||
* src/plugins/IndivComplete.py:
|
||||
* src/plugins/CalculateEstimatedDates.py:
|
||||
* src/plugins/BookReport.py:
|
||||
* src/plugins/TimeLine.py:
|
||||
* src/plugins/Calendar.py:
|
||||
* src/plugins/GVFamilyLines.py:
|
||||
* src/plugins/AncestorReport.py:
|
||||
* src/plugins/MarkerReport.py:
|
||||
* src/plugins/DescendChart.py:
|
||||
* src/plugins/EndOfLineReport.py:
|
||||
* src/plugins/AncestorChart.py:
|
||||
* src/plugins/DetAncestralReport.py:
|
||||
* src/plugins/CustomBookText.py:
|
||||
* src/plugins/FamilyGroup.py:
|
||||
* src/plugins/GVRelGraph.py:
|
||||
* src/plugins/GVHourGlass.py:
|
||||
* src/plugins/StatisticsChart.py:
|
||||
* src/plugins/FanChart.py:
|
||||
* src/PluginUtils/_GuiOptions.py:
|
||||
Refactoring the report system: reports no longer require dbstate.
|
||||
|
||||
2008-01-23 Gary Burton <gary.burton@zen.co.uk>
|
||||
* src/plugins/GVFamilyLines.py: Use fallback events e.g. baptism/burial
|
||||
when no birth or death events are available.
|
||||
|
@ -17,7 +17,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# $Id: $
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
Specific option handling for a GUI.
|
||||
@ -861,7 +861,7 @@ class GuiMenuOptions:
|
||||
self.options_dict = {}
|
||||
self.options_help = {}
|
||||
self.__tooltips = gtk.Tooltips()
|
||||
self.add_menu_options(self.menu, dbstate)
|
||||
self.add_menu_options(self.menu)
|
||||
for name in self.menu.get_all_option_names():
|
||||
option = self.menu.get_option_by_name(name)
|
||||
self.options_dict[name] = option.get_value()
|
||||
@ -873,7 +873,7 @@ class GuiMenuOptions:
|
||||
"""
|
||||
pass
|
||||
|
||||
def add_menu_options(self, menu, dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
"""
|
||||
Add the user defined options to the menu.
|
||||
|
||||
|
@ -48,7 +48,8 @@ class CommandLineReport:
|
||||
noopt=False):
|
||||
self.database = database
|
||||
self.category = category
|
||||
self.option_class = option_class(name)
|
||||
self.option_class = option_class(name, database)
|
||||
self.option_class.load_previous_values()
|
||||
self.show = options_str_dict.pop('show',None)
|
||||
self.options_str_dict = options_str_dict
|
||||
self.init_options(noopt)
|
||||
|
@ -782,13 +782,9 @@ class MenuReportOptions(GuiMenuOptions,ReportOptions):
|
||||
MenuReportOptions class will worry about setting up the GUI.
|
||||
|
||||
"""
|
||||
def __init__(self,name,dbstate=None):
|
||||
if dbstate:
|
||||
active_person = dbstate.get_active_person().get_gramps_id()
|
||||
else:
|
||||
active_person = None
|
||||
ReportOptions.__init__(self,name,active_person)
|
||||
GuiMenuOptions.__init__(self,dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
ReportOptions.__init__(self, name, None)
|
||||
GuiMenuOptions.__init__(self, dbase)
|
||||
|
||||
def load_previous_values(self):
|
||||
ReportOptions.load_previous_values(self)
|
||||
|
@ -450,10 +450,10 @@ class AncestorChartOptions(MenuReportOptions):
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
|
||||
def __init__(self,name,dbstate=None):
|
||||
MenuReportOptions.__init__(self,name,dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self,menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
|
||||
category_name = _("Report Options")
|
||||
|
||||
|
@ -236,10 +236,10 @@ class AncestorOptions(MenuReportOptions):
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
|
||||
def __init__(self, name, dbstate=None):
|
||||
MenuReportOptions.__init__(self, name, dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self, menu, dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
"""
|
||||
Add options to the menu for the ancestor report.
|
||||
"""
|
||||
|
@ -177,14 +177,14 @@ class BookItem:
|
||||
Interface into the book item -- a smallest element of the book.
|
||||
"""
|
||||
|
||||
def __init__(self, dbstate, name=None):
|
||||
def __init__(self, dbase, name=None):
|
||||
"""
|
||||
Creates a new empty BookItem.
|
||||
|
||||
name: if not None then the book item is retreived
|
||||
from the book item registry using name for lookup
|
||||
"""
|
||||
self.dbstate = dbstate
|
||||
self.dbase = dbase
|
||||
if name:
|
||||
self.get_registered_item(name)
|
||||
else:
|
||||
@ -222,7 +222,7 @@ class BookItem:
|
||||
self.category = item[1]
|
||||
self.write_item = item[2]
|
||||
self.name = item[4]
|
||||
self.option_class = item[3](self.name, self.dbstate)
|
||||
self.option_class = item[3](self.name, self.dbase)
|
||||
self.option_class.load_previous_values()
|
||||
|
||||
def get_name(self):
|
||||
@ -394,14 +394,14 @@ class BookList:
|
||||
BookList is loaded from a specified XML file if it exists.
|
||||
"""
|
||||
|
||||
def __init__(self, filename, dbstate):
|
||||
def __init__(self, filename, dbase):
|
||||
"""
|
||||
Creates a new BookList from the books that may be defined in the
|
||||
specified file.
|
||||
|
||||
file: XML file that contains book items definitions
|
||||
"""
|
||||
self.dbstate = dbstate
|
||||
self.dbase = dbase
|
||||
self.bookmap = {}
|
||||
self.file = os.path.join(const.HOME_DIR, filename)
|
||||
self.parse()
|
||||
@ -487,7 +487,7 @@ class BookList:
|
||||
"""
|
||||
try:
|
||||
p = make_parser()
|
||||
p.setContentHandler(BookParser(self, self.dbstate))
|
||||
p.setContentHandler(BookParser(self, self.dbase))
|
||||
the_file = open(self.file)
|
||||
p.parse(the_file)
|
||||
the_file.close()
|
||||
@ -505,14 +505,14 @@ class BookParser(handler.ContentHandler):
|
||||
SAX parsing class for the Books XML file.
|
||||
"""
|
||||
|
||||
def __init__(self, booklist, dbstate):
|
||||
def __init__(self, booklist, dbase):
|
||||
"""
|
||||
Creates a BookParser class that populates the passed booklist.
|
||||
|
||||
booklist: BookList to be loaded from the file.
|
||||
"""
|
||||
handler.ContentHandler.__init__(self)
|
||||
self.dbstate = dbstate
|
||||
self.dbase = dbase
|
||||
self.booklist = booklist
|
||||
self.b = None
|
||||
self.i = None
|
||||
@ -535,7 +535,7 @@ class BookParser(handler.ContentHandler):
|
||||
self.dbname = attrs['database']
|
||||
self.b.set_dbname(self.dbname)
|
||||
elif tag == "item":
|
||||
self.i = BookItem(self.dbstate, attrs['name'])
|
||||
self.i = BookItem(self.dbase, attrs['name'])
|
||||
self.o = {}
|
||||
elif tag == "option":
|
||||
self.an_o_name = attrs['name']
|
||||
@ -809,7 +809,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
||||
self.bk_model.clear()
|
||||
for saved_item in book.get_item_list():
|
||||
name = saved_item.get_name()
|
||||
item = BookItem(self.dbstate, name)
|
||||
item = BookItem(self.dbase, name)
|
||||
item.option_class = saved_item.option_class
|
||||
_initialize_options(item.option_class, self.dbstate)
|
||||
item.set_style_name(saved_item.get_style_name())
|
||||
@ -831,7 +831,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
||||
if not the_iter:
|
||||
return
|
||||
data = self.av_model.get_data(the_iter, range(self.av_ncols))
|
||||
item = BookItem(self.dbstate, data[2])
|
||||
item = BookItem(self.db, data[2])
|
||||
_initialize_options(item.option_class, self.dbstate)
|
||||
data[2] = _get_subject(item.option_class, self.db)
|
||||
self.bk_model.add(data)
|
||||
@ -993,7 +993,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
||||
"""
|
||||
Save the current book in the xml booklist file.
|
||||
"""
|
||||
self.book_list = BookList(self.file, self.dbstate)
|
||||
self.book_list = BookList(self.file, self.db)
|
||||
name = unicode(self.name_entry.get_text())
|
||||
self.book.set_name(name)
|
||||
self.book.set_dbname(self.db.get_save_path())
|
||||
@ -1004,7 +1004,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
||||
"""
|
||||
Run the BookListDisplay dialog to present the choice of books to open.
|
||||
"""
|
||||
self.book_list = BookList(self.file, self.dbstate)
|
||||
self.book_list = BookList(self.file, self.db)
|
||||
booklistdisplay = BookListDisplay(self.book_list, 1, 0)
|
||||
booklistdisplay.top.destroy()
|
||||
book = booklistdisplay.selection
|
||||
@ -1016,7 +1016,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
||||
"""
|
||||
Run the BookListDisplay dialog to present the choice of books to delete.
|
||||
"""
|
||||
self.book_list = BookList(self.file, self.dbstate)
|
||||
self.book_list = BookList(self.file, self.db)
|
||||
booklistdisplay = BookListDisplay(self.book_list, 0, 1)
|
||||
booklistdisplay.top.destroy()
|
||||
|
||||
@ -1180,7 +1180,7 @@ def cl_report(database, name, category, options_str_dict):
|
||||
if clr.show:
|
||||
return
|
||||
|
||||
book_list = BookList('books.xml', None)
|
||||
book_list = BookList('books.xml', database)
|
||||
book_name = clr.options_dict['bookname']
|
||||
book = book_list.get_book(book_name)
|
||||
selected_style = BaseDoc.StyleSheet()
|
||||
|
@ -52,9 +52,11 @@ from ReportBase import ReportUtils
|
||||
#------------------------------------------------------------------------
|
||||
class CalcEstDateOptions(MenuToolOptions):
|
||||
""" Calculate Estimated Date options """
|
||||
|
||||
def add_menu_options(self, menu, dbstate):
|
||||
def __init__(self, name, person_id=None, dbstate=None):
|
||||
self.__db = dbstate.get_database()
|
||||
MenuToolOptions.__init__(self, name, person_id, dbstate)
|
||||
|
||||
def add_menu_options(self, menu):
|
||||
|
||||
""" Adds the options """
|
||||
category_name = _("Options")
|
||||
|
@ -475,13 +475,13 @@ class CalendarReport(Calendar):
|
||||
|
||||
class CalendarOptions(MenuReportOptions):
|
||||
""" Calendar options for graphic calendar """
|
||||
def __init__(self, name, dbstate=None):
|
||||
self.__dbstate = dbstate
|
||||
def __init__(self, name, dbase):
|
||||
self.__db = dbase
|
||||
self.__pid = None
|
||||
self.__filter = None
|
||||
MenuReportOptions.__init__(self, name, dbstate)
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self, menu, dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
""" Adds the options for the graphical calendar """
|
||||
category_name = _("Report Options")
|
||||
|
||||
@ -561,9 +561,8 @@ class CalendarOptions(MenuReportOptions):
|
||||
"""
|
||||
Update the filter list based on the selected person
|
||||
"""
|
||||
_db = self.__dbstate.get_database()
|
||||
gid = self.__pid.get_value()
|
||||
person = _db.get_person_from_gramps_id(gid)
|
||||
person = self.__db.get_person_from_gramps_id(gid)
|
||||
filter_list = ReportUtils.get_person_filters(person, False)
|
||||
self.__filter.set_filters(filter_list)
|
||||
|
||||
@ -648,14 +647,14 @@ class CalendarReportOptions(CalendarOptions):
|
||||
def __init__(self, name, dbstate=None):
|
||||
CalendarOptions.__init__(self, name, dbstate)
|
||||
|
||||
def add_menu_options(self, menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
""" Adds the options for the graphical calendar """
|
||||
category_name = _("Text Options")
|
||||
titletext = StringOption(_("Title text"),
|
||||
_("Birthday and Anniversary Report"))
|
||||
titletext.set_help(_("Title of calendar"))
|
||||
menu.add_option(category_name,"titletext", titletext)
|
||||
CalendarOptions.add_menu_options(self, menu, dbstate)
|
||||
CalendarOptions.add_menu_options(self, menu)
|
||||
category_name = _("Report Options")
|
||||
option = BooleanOption(_("Include relationships to center person (slower)"),
|
||||
False)
|
||||
|
@ -106,10 +106,10 @@ class CustomTextOptions(MenuReportOptions):
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
|
||||
def __init__(self,name,dbstate=None):
|
||||
MenuReportOptions.__init__(self,name,dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self,menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
|
||||
category_name = _("Text")
|
||||
|
||||
|
@ -403,10 +403,10 @@ class DescendChartOptions(MenuReportOptions):
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
|
||||
def __init__(self,name,dbstate=None):
|
||||
MenuReportOptions.__init__(self,name,dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self,menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
"""
|
||||
Add options to the menu for the descendant report.
|
||||
"""
|
||||
|
@ -188,10 +188,10 @@ class DescendantOptions(MenuReportOptions):
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
|
||||
def __init__(self,name,dbstate=None):
|
||||
MenuReportOptions.__init__(self,name,dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self,menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
category_name = _("Report Options")
|
||||
|
||||
pid = PersonOption(_("Center Person"))
|
||||
|
@ -671,10 +671,10 @@ class DetAncestorOptions(MenuReportOptions):
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
|
||||
def __init__(self,name,dbstate=None):
|
||||
MenuReportOptions.__init__(self,name,dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self,menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
category_name = _("Report Options")
|
||||
|
||||
pid = PersonOption(_("Center Person"))
|
||||
|
@ -629,10 +629,10 @@ class DetDescendantOptions(MenuReportOptions):
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
|
||||
def __init__(self,name,dbstate=None):
|
||||
MenuReportOptions.__init__(self,name,dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self,menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
"""
|
||||
Add options to the menu for the detailed descendant report.
|
||||
"""
|
||||
|
@ -222,10 +222,10 @@ class EndOfLineOptions(MenuReportOptions):
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
|
||||
def __init__(self, name, dbstate=None):
|
||||
MenuReportOptions.__init__(self, name, dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self, menu, dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
"""
|
||||
Add options to the menu for the End of Line report.
|
||||
"""
|
||||
|
@ -574,10 +574,10 @@ class FamilyGroupOptions(MenuReportOptions):
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
|
||||
def __init__(self,name,dbstate=None):
|
||||
MenuReportOptions.__init__(self,name,dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self,menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
|
||||
##########################
|
||||
category_name = _("Report Options")
|
||||
|
@ -318,12 +318,12 @@ class FanChart(Report):
|
||||
#------------------------------------------------------------------------
|
||||
class FanChartOptions(MenuReportOptions):
|
||||
|
||||
def __init__(self,name,dbstate=None):
|
||||
def __init__(self, name, dbase):
|
||||
self.MAX_GENERATIONS = 8
|
||||
|
||||
MenuReportOptions.__init__(self,name,dbstate)
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self,menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
"""
|
||||
Add options to the menu for the fan chart.
|
||||
"""
|
||||
|
@ -80,10 +80,10 @@ class FamilyLinesOptions(MenuReportOptions):
|
||||
Defines all of the controls necessary
|
||||
to configure the FamilyLines reports.
|
||||
"""
|
||||
def __init__(self, name, dbstate=None):
|
||||
MenuReportOptions.__init__(self, name, dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self, menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
|
||||
# --------------------------------
|
||||
category = _('People of Interest')
|
||||
|
@ -164,10 +164,10 @@ class HourGlassOptions(MenuReportOptions):
|
||||
"""
|
||||
Defines options for the HourGlass report.
|
||||
"""
|
||||
def __init__(self, name, dbstate=None):
|
||||
MenuReportOptions.__init__(self, name, dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self, menu, dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
"""
|
||||
Create all the menu options for this report.
|
||||
"""
|
||||
|
@ -415,15 +415,15 @@ class RelGraphOptions(MenuReportOptions):
|
||||
"""
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
def __init__(self, name, dbstate=None):
|
||||
def __init__(self, name, dbase):
|
||||
self.__pid = None
|
||||
self.__filter = None
|
||||
self.__include_images = None
|
||||
self.__image_on_side = None
|
||||
self.__dbstate = dbstate
|
||||
MenuReportOptions.__init__(self, name, dbstate)
|
||||
self.__db = dbase
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self, menu, dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
################################
|
||||
category_name = _("Report Options")
|
||||
################################
|
||||
@ -519,9 +519,8 @@ class RelGraphOptions(MenuReportOptions):
|
||||
"""
|
||||
Update the filter list based on the selected person
|
||||
"""
|
||||
_db = self.__dbstate.get_database()
|
||||
gid = self.__pid.get_value()
|
||||
person = _db.get_person_from_gramps_id(gid)
|
||||
person = self.__db.get_person_from_gramps_id(gid)
|
||||
filter_list = ReportUtils.get_person_filters(person, False)
|
||||
self.__filter.set_filters(filter_list)
|
||||
|
||||
|
@ -501,13 +501,13 @@ class IndivCompleteOptions(MenuReportOptions):
|
||||
"""
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
def __init__(self, name, dbstate=None):
|
||||
self.__dbstate = dbstate
|
||||
def __init__(self, name, dbase):
|
||||
self.__db = dbase
|
||||
self.__pid = None
|
||||
self.__filter = None
|
||||
MenuReportOptions.__init__(self, name, dbstate)
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self, menu, dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
################################
|
||||
category_name = _("Report Options")
|
||||
################################
|
||||
@ -533,9 +533,8 @@ class IndivCompleteOptions(MenuReportOptions):
|
||||
"""
|
||||
Update the filter list based on the selected person
|
||||
"""
|
||||
_db = self.__dbstate.get_database()
|
||||
gid = self.__pid.get_value()
|
||||
person = _db.get_person_from_gramps_id(gid)
|
||||
person = self.__db.get_person_from_gramps_id(gid)
|
||||
filter_list = ReportUtils.get_person_filters(person, True)
|
||||
self.__filter.set_filters(filter_list)
|
||||
|
||||
|
@ -324,10 +324,10 @@ class KinshipOptions(MenuReportOptions):
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
|
||||
def __init__(self, name, dbstate=None):
|
||||
MenuReportOptions.__init__(self, name, dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self, menu, dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
"""
|
||||
Add options to the menu for the kinship report.
|
||||
"""
|
||||
|
@ -425,10 +425,11 @@ class MarkerReport(Report):
|
||||
#------------------------------------------------------------------------
|
||||
class MarkerOptions(MenuReportOptions):
|
||||
|
||||
def __init__(self,name,dbstate=None):
|
||||
MenuReportOptions.__init__(self,name,dbstate)
|
||||
def __init__(self, name, dbase):
|
||||
self.__db = dbase
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self,menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
"""
|
||||
Add options to the menu for the marker report.
|
||||
"""
|
||||
@ -443,7 +444,7 @@ class MarkerOptions(MenuReportOptions):
|
||||
marker.add_item(MarkerType._I2EMAP[mtype],
|
||||
MarkerType._I2SMAP[mtype] )
|
||||
# Add custom marker types
|
||||
for m in dbstate.get_database().get_marker_types():
|
||||
for m in self.__db.get_marker_types():
|
||||
marker.add_item( m, m )
|
||||
marker.set_help( _("The marker to use for the report"))
|
||||
menu.add_option(category_name,"marker",marker)
|
||||
|
@ -659,13 +659,13 @@ class StatisticsChart(Report):
|
||||
#------------------------------------------------------------------------
|
||||
class StatisticsChartOptions(MenuReportOptions):
|
||||
|
||||
def __init__(self,name,dbstate=None):
|
||||
def __init__(self, name, dbase):
|
||||
self.__pid = None
|
||||
self.__filter = None
|
||||
self.__dbstate = dbstate
|
||||
MenuReportOptions.__init__(self, name, dbstate)
|
||||
self.__db = dbase
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self,menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
"""
|
||||
Add options to the menu for the statistics report.
|
||||
"""
|
||||
@ -752,9 +752,8 @@ class StatisticsChartOptions(MenuReportOptions):
|
||||
"""
|
||||
Update the filter list based on the selected person
|
||||
"""
|
||||
_db = self.__dbstate.get_database()
|
||||
gid = self.__pid.get_value()
|
||||
person = _db.get_person_from_gramps_id(gid)
|
||||
person = self.__db.get_person_from_gramps_id(gid)
|
||||
filter_list = ReportUtils.get_person_filters(person, False)
|
||||
self.__filter.set_filters(filter_list)
|
||||
|
||||
|
@ -293,13 +293,13 @@ class TimeLine(Report):
|
||||
#------------------------------------------------------------------------
|
||||
class TimeLineOptions(MenuReportOptions):
|
||||
|
||||
def __init__(self,name,dbstate=None):
|
||||
def __init__(self, name, dbase):
|
||||
self.__pid = None
|
||||
self.__filter = None
|
||||
self.__dbstate = dbstate
|
||||
MenuReportOptions.__init__(self,name,dbstate)
|
||||
self.__db = dbase
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self,menu,dbstate):
|
||||
def add_menu_options(self, menu):
|
||||
category_name = _("Report Options")
|
||||
|
||||
self.__filter = FilterOption(_("Filter"), 0)
|
||||
@ -317,7 +317,7 @@ class TimeLineOptions(MenuReportOptions):
|
||||
|
||||
sortby = EnumeratedListOption(_('Sort by'), 0 )
|
||||
idx = 0
|
||||
for item in _get_sort_functions(Sort.Sort(dbstate.get_database())):
|
||||
for item in _get_sort_functions(Sort.Sort(self.__db)):
|
||||
sortby.add_item(idx,item[0])
|
||||
idx += 1
|
||||
sortby.set_help( _("Sorting method to use"))
|
||||
@ -327,9 +327,8 @@ class TimeLineOptions(MenuReportOptions):
|
||||
"""
|
||||
Update the filter list based on the selected person
|
||||
"""
|
||||
_db = self.__dbstate.get_database()
|
||||
gid = self.__pid.get_value()
|
||||
person = _db.get_person_from_gramps_id(gid)
|
||||
person = self.__db.get_person_from_gramps_id(gid)
|
||||
filter_list = ReportUtils.get_person_filters(person, False)
|
||||
self.__filter.set_filters(filter_list)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user