diff --git a/ChangeLog b/ChangeLog index c0ee9681d..a97a2f260 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-11-29 Douglas S.Blank + * src/ReportBase/__init__.py: import MenuReportOptions + * src/ReportBase/_ReportOptions.py: import MenuOptions and + define MenuReportOptions + * src/plugins/Calendar.py: get MenuReportOptions from ReportOptions + * src/plugins/DescendChart.py: ditto + * src/plugins/AncestorChart.py: ditto + * src/plugins/GVHourGlass.py: ditto + * src/plugins/FanChart.py: ditto + * src/PluginUtils/__init__.py: define MenuToolOptions + * src/PluginUtils/_MenuOptions.py: Remove circular dependancies + 2007-11-29 Benny Malengier * src/DataViews/_RepositoryView.py: * src/gen/db/base.py: diff --git a/src/PluginUtils/_MenuOptions.py b/src/PluginUtils/_MenuOptions.py index cbc71d2e4..100462801 100644 --- a/src/PluginUtils/_MenuOptions.py +++ b/src/PluginUtils/_MenuOptions.py @@ -27,7 +27,6 @@ Abstracted option handling. # gramps modules # #------------------------------------------------------------------------- -from ReportBase import ReportUtils, ReportOptions import _Tool as Tool #------------------------------------------------------------------------- @@ -438,9 +437,11 @@ class FilterListOption(Option): """ Add an FilterListOption to the dialog. """ + from ReportBase import ReportUtils self.gobj = gtk.combo_box_new_text() for filter in self.get_items(): if filter in ["person"]: + # FIXME: get filter list from filter sidebar? filter_list = ReportUtils.get_person_filters(dialog.person,False) for filter in filter_list: self.gobj.append_text(filter.get_name()) @@ -567,6 +568,9 @@ class Menu: # #------------------------------------------------------------------------ class MenuOptions: + def __init__(self): + self.menu = Menu() + def make_default_style(self,default_style): pass @@ -621,36 +625,3 @@ class MenuOptions: """ return self.menu.get_option_by_name(name).parse() -#------------------------------------------------------------------------ -# -# Option handlers for tools and reports -# -#------------------------------------------------------------------------ -class MenuReportOptions(MenuOptions,ReportOptions): - """ - The MenuOptions class implementes the ReportOptions functionality in a - generic way so that the user does not need to be concerned with the - graphical representation of the options. - - The user should inherit the MenuOptions class and override the - add_menu_options function. The user can add options to the menu and the - MenuOptions class will worry about setting up the GUI. - """ - def __init__(self,name,person_id=None): - self.menu = Menu() - ReportOptions.__init__(self,name, person_id) - -class MenuToolOptions(MenuOptions,Tool.ToolOptions): - """ - The MenuOptions class implementes the ReportOptions functionality in a - generic way so that the user does not need to be concerned with the - graphical representation of the options. - - The user should inherit the MenuOptions class and override the - add_menu_options function. The user can add options to the menu and the - MenuOptions class will worry about setting up the GUI. - """ - def __init__(self,name,person_id=None): - self.menu = Menu() - Tool.ToolOptions.__init__(self,name, person_id) - diff --git a/src/PluginUtils/_Tool.py b/src/PluginUtils/_Tool.py index 284dde7e9..5c72cf90a 100644 --- a/src/PluginUtils/_Tool.py +++ b/src/PluginUtils/_Tool.py @@ -311,3 +311,4 @@ class ToolOptions(Options): """ self.set_new_options() self.handler = ToolOptionHandler(name,self.options_dict,person_id) + diff --git a/src/PluginUtils/__init__.py b/src/PluginUtils/__init__.py index 2a815378d..040308cb0 100644 --- a/src/PluginUtils/__init__.py +++ b/src/PluginUtils/__init__.py @@ -27,6 +27,9 @@ #Better would be to do: import _PluginMgr as PluginMgr and then access # the list as PluginUtils.PluginMgr, or use a function that returns the pointer # of the list. +from _MenuOptions import MenuOptions, \ + NumberOption, BooleanOption, TextOption, \ + EnumeratedListOption, FilterListOption, StringOption from _PluginMgr import \ register_export, register_import, \ register_tool, register_report, \ @@ -41,6 +44,19 @@ from _PluginMgr import \ import _Tool as Tool import _Plugins as Plugins import _PluginWindows as PluginWindows -from _MenuOptions import MenuReportOptions, MenuToolOptions, \ - NumberOption, BooleanOption, TextOption, \ - EnumeratedListOption, FilterListOption, StringOption + +# This needs to go above Tool and MenuOption as it needs both +class MenuToolOptions(MenuOptions,Tool.ToolOptions): + """ + The MenuToolOptions class implementes the ToolOptions + functionality in a generic way so that the user does not need to + be concerned with the graphical representation of the options. + + The user should inherit the MenuToolOptions class and override the + add_menu_options function. The user can add options to the menu + and the MenuToolOptions class will worry about setting up the GUI. + """ + def __init__(self,name,person_id=None): + MenuOptions.__init__(self) + Tool.ToolOptions.__init__(self,name, person_id) + diff --git a/src/ReportBase/_ReportOptions.py b/src/ReportBase/_ReportOptions.py index ede734e5a..249d475bb 100644 --- a/src/ReportBase/_ReportOptions.py +++ b/src/ReportBase/_ReportOptions.py @@ -54,7 +54,7 @@ except: import const import Config import BaseDoc -from PluginUtils import _Options +from PluginUtils import _Options, MenuOptions #------------------------------------------------------------------------- # @@ -541,3 +541,25 @@ class ReportOptions(_Options.Options): This method MUST NOT be overridden by subclasses. """ self.handler.output = val + +#------------------------------------------------------------------------- +# +# MenuReportOptions +# +#------------------------------------------------------------------------- +class MenuReportOptions(MenuOptions,ReportOptions): + """ + + The MenuReportOptions class implementes the ReportOptions + functionality in a generic way so that the user does not need to + be concerned with the graphical representation of the options. + + The user should inherit the MenuReportOptions class and override the + add_menu_options function. The user can add options to the menu and the + MenuReportOptions class will worry about setting up the GUI. + + """ + def __init__(self,name,person_id=None): + MenuOptions.__init__(self) + ReportOptions.__init__(self,name, person_id) + diff --git a/src/ReportBase/_ReportUtils.py b/src/ReportBase/_ReportUtils.py index 98ec18921..fd48080cf 100644 --- a/src/ReportBase/_ReportUtils.py +++ b/src/ReportBase/_ReportUtils.py @@ -2457,3 +2457,4 @@ def get_person_filters(person, include_single=True): the_filters = [all, des, df, ans, com] the_filters.extend(CustomFilters.get_filters('Person')) return the_filters + diff --git a/src/ReportBase/__init__.py b/src/ReportBase/__init__.py index 2225c11a2..aa0224485 100644 --- a/src/ReportBase/__init__.py +++ b/src/ReportBase/__init__.py @@ -36,7 +36,7 @@ from _CommandLineReport import cl_report from _DrawReportDialog import DrawReportDialog from _TextReportDialog import TextReportDialog -from _ReportOptions import ReportOptions +from _ReportOptions import ReportOptions, MenuReportOptions import _ReportUtils as ReportUtils from _Bibliography import Bibliography, Citation diff --git a/src/plugins/AncestorChart.py b/src/plugins/AncestorChart.py index 2977452cd..7975e78af 100644 --- a/src/plugins/AncestorChart.py +++ b/src/plugins/AncestorChart.py @@ -38,10 +38,9 @@ from gettext import gettext as _ #------------------------------------------------------------------------ import BaseDoc from SubstKeywords import SubstKeywords -from PluginUtils import register_report -from PluginUtils import MenuReportOptions, \ +from PluginUtils import register_report, \ NumberOption, BooleanOption, TextOption -from ReportBase import Report, ReportUtils, CATEGORY_DRAW, \ +from ReportBase import Report, ReportUtils, CATEGORY_DRAW, MenuReportOptions,\ MODE_GUI, MODE_BKI, MODE_CLI from BasicUtils import name_displayer pt2cm = ReportUtils.pt2cm diff --git a/src/plugins/Calendar.py b/src/plugins/Calendar.py index 1983aa164..ab1c3c80a 100644 --- a/src/plugins/Calendar.py +++ b/src/plugins/Calendar.py @@ -41,11 +41,10 @@ import BaseDoc from BasicUtils import name_displayer from DateHandler import displayer from PluginUtils import register_report -from ReportBase import Report, ReportUtils, \ +from ReportBase import Report, ReportUtils, MenuReportOptions, \ CATEGORY_DRAW, CATEGORY_TEXT, \ MODE_GUI, MODE_BKI, MODE_CLI -from PluginUtils import MenuReportOptions, \ - NumberOption, BooleanOption, StringOption, \ +from PluginUtils import NumberOption, BooleanOption, StringOption, \ FilterListOption, EnumeratedListOption import GrampsLocale import gen.lib diff --git a/src/plugins/DescendChart.py b/src/plugins/DescendChart.py index 49ac90dfa..91b7eba37 100644 --- a/src/plugins/DescendChart.py +++ b/src/plugins/DescendChart.py @@ -29,11 +29,9 @@ # #------------------------------------------------------------------------ from BasicUtils import name_displayer -from PluginUtils import register_report -from PluginUtils import MenuReportOptions, \ - NumberOption, BooleanOption, TextOption -from ReportBase import Report, ReportOptions, ReportUtils, CATEGORY_DRAW, \ - MODE_GUI, MODE_BKI, MODE_CLI +from PluginUtils import register_report, NumberOption, BooleanOption, TextOption +from ReportBase import Report, ReportOptions, MenuReportOptions, \ + ReportUtils, CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI from SubstKeywords import SubstKeywords from gettext import gettext as _ import BaseDoc diff --git a/src/plugins/FanChart.py b/src/plugins/FanChart.py index 18fc84167..8fba75ded 100644 --- a/src/plugins/FanChart.py +++ b/src/plugins/FanChart.py @@ -35,9 +35,8 @@ from gettext import gettext as _ #------------------------------------------------------------------------ import BaseDoc from PluginUtils import register_report -from PluginUtils import MenuReportOptions, \ - NumberOption, EnumeratedListOption -from ReportBase import Report, ReportUtils, CATEGORY_DRAW, \ +from PluginUtils import NumberOption, EnumeratedListOption +from ReportBase import Report, ReportUtils,MenuReportOptions,CATEGORY_DRAW, \ MODE_GUI, MODE_BKI, MODE_CLI from SubstKeywords import SubstKeywords diff --git a/src/plugins/GVHourGlass.py b/src/plugins/GVHourGlass.py index c8280468b..c39218341 100644 --- a/src/plugins/GVHourGlass.py +++ b/src/plugins/GVHourGlass.py @@ -28,10 +28,9 @@ Generate an hourglass graph using the GraphViz generator. # GRAMPS modules # #------------------------------------------------------------------------ -from PluginUtils import register_report -from PluginUtils import MenuReportOptions, NumberOption -from ReportBase import Report, ReportUtils, CATEGORY_GRAPHVIZ, \ - MODE_GUI, MODE_CLI +from PluginUtils import register_report, NumberOption +from ReportBase import Report, ReportUtils, MenuReportOptions, \ + MODE_GUI, MODE_CLI, CATEGORY_GRAPHVIZ from BasicUtils import name_displayer import DateHandler