2007-11-29 Douglas S.Blank <dblank@cs.brynmawr.edu>

* 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



svn: r9433
This commit is contained in:
Doug Blank 2007-11-29 15:02:40 +00:00
parent 8d64c728fc
commit 56905cedd8
12 changed files with 74 additions and 57 deletions

View File

@ -1,3 +1,15 @@
2007-11-29 Douglas S.Blank <dblank@cs.brynmawr.edu>
* 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 <benny.malengier@gramps-project.org>
* src/DataViews/_RepositoryView.py:
* src/gen/db/base.py:

View File

@ -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)

View File

@ -311,3 +311,4 @@ class ToolOptions(Options):
"""
self.set_new_options()
self.handler = ToolOptionHandler(name,self.options_dict,person_id)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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