Removed the use of dbstate in report options.

svn: r9930
This commit is contained in:
Brian Matherly 2008-01-25 01:23:21 +00:00
parent 6efffe4bf0
commit c2a6656f0e
4 changed files with 21 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2008-01-24 Brian Matherly <brian@gramps-project.org>
* src/PluginUtils/_GuiOptions.py:
* src/ReportBase/_BareReportDialog.py:
* src/ReportBase/_ReportOptions.py:
Remove the use of dbstate.
2008-01-24 Douglas S. Blank <dblank@cs.brynmawr.edu> 2008-01-24 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/GrampsCfg.py: missing const; added Text tab * src/GrampsCfg.py: missing const; added Text tab
* src/Config/_GrampsConfigKeys.py: added missing and private text * src/Config/_GrampsConfigKeys.py: added missing and private text

View File

@ -853,9 +853,8 @@ class GuiMenuOptions:
A GuiMenuOptions is used to implement the necessary funtions for adding A GuiMenuOptions is used to implement the necessary funtions for adding
options to a GTK dialog. options to a GTK dialog.
""" """
def __init__(self, dbstate): def __init__(self):
self.menu = _MenuOptions.Menu() self.menu = _MenuOptions.Menu()
self.__dbstate = dbstate
# Fill options_dict with report/tool defaults: # Fill options_dict with report/tool defaults:
self.options_dict = {} self.options_dict = {}
@ -906,44 +905,44 @@ class GuiMenuOptions:
found = True found = True
label = True label = True
if isinstance(option, _MenuOptions.PersonOption): if isinstance(option, _MenuOptions.PersonOption):
widget = GuiPersonOption(option, self.__dbstate, widget = GuiPersonOption(option, dialog.dbstate,
dialog.uistate, dialog.track, dialog.uistate, dialog.track,
self.__tooltips) self.__tooltips)
elif isinstance(option, _MenuOptions.NumberOption): elif isinstance(option, _MenuOptions.NumberOption):
widget = GuiNumberOption(option, self.__dbstate, widget = GuiNumberOption(option, dialog.dbstate,
dialog.uistate, dialog.track, dialog.uistate, dialog.track,
self.__tooltips) self.__tooltips)
elif isinstance(option, _MenuOptions.BooleanOption): elif isinstance(option, _MenuOptions.BooleanOption):
widget = GuiBooleanOption(option, self.__dbstate, widget = GuiBooleanOption(option, dialog.dbstate,
dialog.uistate, dialog.track, dialog.uistate, dialog.track,
self.__tooltips) self.__tooltips)
label = False label = False
elif isinstance(option, _MenuOptions.StringOption): elif isinstance(option, _MenuOptions.StringOption):
widget = GuiStringOption(option, self.__dbstate, widget = GuiStringOption(option, dialog.dbstate,
dialog.uistate, dialog.track, dialog.uistate, dialog.track,
self.__tooltips) self.__tooltips)
elif isinstance(option, _MenuOptions.EnumeratedListOption): elif isinstance(option, _MenuOptions.EnumeratedListOption):
widget = GuiEnumeratedListOption(option, self.__dbstate, widget = GuiEnumeratedListOption(option, dialog.dbstate,
dialog.uistate, dialog.track, dialog.uistate, dialog.track,
self.__tooltips) self.__tooltips)
elif isinstance(option, _MenuOptions.TextOption): elif isinstance(option, _MenuOptions.TextOption):
widget = GuiTextOption(option, self.__dbstate, widget = GuiTextOption(option, dialog.dbstate,
dialog.uistate, dialog.track, dialog.uistate, dialog.track,
self.__tooltips) self.__tooltips)
elif isinstance(option, _MenuOptions.FamilyOption): elif isinstance(option, _MenuOptions.FamilyOption):
widget = GuiFamilyOption(option, self.__dbstate, widget = GuiFamilyOption(option, dialog.dbstate,
dialog.uistate, dialog.track, dialog.uistate, dialog.track,
self.__tooltips) self.__tooltips)
elif isinstance(option, _MenuOptions.PersonListOption): elif isinstance(option, _MenuOptions.PersonListOption):
widget = GuiPersonListOption(option, self.__dbstate, widget = GuiPersonListOption(option, dialog.dbstate,
dialog.uistate, dialog.track, dialog.uistate, dialog.track,
self.__tooltips) self.__tooltips)
elif isinstance(option, _MenuOptions.ColourOption): elif isinstance(option, _MenuOptions.ColourOption):
widget = GuiColourOption(option, self.__dbstate, widget = GuiColourOption(option, dialog.dbstate,
dialog.uistate, dialog.track, dialog.uistate, dialog.track,
self.__tooltips) self.__tooltips)
elif isinstance(option, _MenuOptions.SurnameColourOption): elif isinstance(option, _MenuOptions.SurnameColourOption):
widget = GuiSurnameColourOption(option, self.__dbstate, widget = GuiSurnameColourOption(option, dialog.dbstate,
dialog.uistate, dialog.track, dialog.uistate, dialog.track,
self.__tooltips) self.__tooltips)
else: else:

View File

@ -87,7 +87,7 @@ class BareReportDialog(ManagedWindow.ManagedWindow):
def init_options(self,option_class): def init_options(self,option_class):
if type(option_class) == ClassType: if type(option_class) == ClassType:
self.options = option_class(self.raw_name,self.dbstate) self.options = option_class(self.raw_name, self.db)
elif type(option_class) == InstanceType: elif type(option_class) == InstanceType:
self.options = option_class self.options = option_class

View File

@ -784,11 +784,12 @@ class MenuReportOptions(GuiMenuOptions,ReportOptions):
""" """
def __init__(self, name, dbase): def __init__(self, name, dbase):
ReportOptions.__init__(self, name, None) ReportOptions.__init__(self, name, None)
GuiMenuOptions.__init__(self, dbase) GuiMenuOptions.__init__(self)
def load_previous_values(self): def load_previous_values(self):
ReportOptions.load_previous_values(self) ReportOptions.load_previous_values(self)
# Pass the loaded values to the menu options so they will be displayed properly. # Pass the loaded values to the menu options so they will be displayed
# properly.
for optname in self.options_dict: for optname in self.options_dict:
menu_option = self.menu.get_option_by_name(optname) menu_option = self.menu.get_option_by_name(optname)
menu_option.set_value(self.options_dict[optname]) menu_option.set_value(self.options_dict[optname])