From 1e67047f6c949d94f92c1104660aae07d72bafc6 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 27 Sep 2005 05:10:54 +0000 Subject: [PATCH] * src/const.py.in: Remove report and tool categories. * src/Plugins.py: Switch report and tool category constants. * src/PluginMgr.py: Switch report and tool category constants. * src/Report.py, src/Tool.py: Move constants. * src/plugins/ChangeNames.py, src/plugins/ChangeTypes.py, src/plugins/Checkpoint.py: switch category constants. svn: r5245 --- gramps2/ChangeLog | 6 ++++++ gramps2/src/Plugins.py | 2 +- gramps2/src/Tool.py | 23 +++++++++++++++++++++++ gramps2/src/const.py.in | 16 ---------------- gramps2/src/plugins/ChangeNames.py | 3 +-- gramps2/src/plugins/ChangeTypes.py | 2 +- gramps2/src/plugins/Checkpoint.py | 3 +-- 7 files changed, 33 insertions(+), 22 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index df1c7e2e0..d098f3177 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,5 +1,11 @@ 2005-09-26 Alex Roitman * all reports: switch categories from const to Report module. + * src/const.py.in: Remove report and tool categories. + * src/Plugins.py: Switch report and tool category constants. + * src/PluginMgr.py: Switch report and tool category constants. + * src/Report.py, src/Tool.py: Move constants. + * src/plugins/ChangeNames.py, src/plugins/ChangeTypes.py, + src/plugins/Checkpoint.py: switch category constants. 2005-09-26 Don Allingham * src/docgen/PSDrawDoc.py: locale independent floating point diff --git a/gramps2/src/Plugins.py b/gramps2/src/Plugins.py index ef4473bdb..9513469a2 100644 --- a/gramps2/src/Plugins.py +++ b/gramps2/src/Plugins.py @@ -428,7 +428,7 @@ def build_tools_menu(top_menu,callback): hash_data = {} for tool in PluginMgr.tool_list: - tool_category = const.tool_categories[tool[3]] + tool_category = Tool.tool_categories[tool[3]] if hash_data.has_key(tool_category): hash_data[tool_category].append( (tool[0],tool[1],tool[2],tool[4],tool[3])) diff --git a/gramps2/src/Tool.py b/gramps2/src/Tool.py index 00b6a2666..d64b2eaea 100644 --- a/gramps2/src/Tool.py +++ b/gramps2/src/Tool.py @@ -25,7 +25,13 @@ __author__ = "Alex Roitman" __version__ = "$Revision$" +#------------------------------------------------------------------------- +# +# Python modules +# +#------------------------------------------------------------------------- from types import ClassType, InstanceType +from gettext import gettext as _ #------------------------------------------------------------------------- # @@ -47,6 +53,23 @@ import Options MODE_GUI = 1 # Standrt tool using GUI MODE_CLI = 2 # Command line interface (CLI) +# Tool categories +TOOL_DEBUG = -1 +TOOL_ANAL = 0 +TOOL_DBPROC = 1 +TOOL_DBFIX = 2 +TOOL_REVCTL = 3 +TOOL_UTILS = 4 + +tool_categories = { + TOOL_DEBUG : _("Debug"), + TOOL_ANAL : _("Analysis and Exploration"), + TOOL_DBPROC : _("Database Processing"), + TOOL_DBFIX : _("Database Repair"), + TOOL_REVCTL : _("Revision Control"), + TOOL_UTILS : _("Utilities"), + } + #------------------------------------------------------------------------- # # Report diff --git a/gramps2/src/const.py.in b/gramps2/src/const.py.in index d42232bf0..9717c0d9c 100644 --- a/gramps2/src/const.py.in +++ b/gramps2/src/const.py.in @@ -929,19 +929,3 @@ notes_formats = [ _("Flowed"), _("Preformatted"), ] - -TOOL_DEBUG = -1 -TOOL_ANAL = 0 -TOOL_DBPROC = 1 -TOOL_DBFIX = 2 -TOOL_REVCTL = 3 -TOOL_UTILS = 4 - -tool_categories = { - TOOL_DEBUG : _("Debug"), - TOOL_ANAL : _("Analysis and Exploration"), - TOOL_DBPROC : _("Database Processing"), - TOOL_DBFIX : _("Database Repair"), - TOOL_REVCTL : _("Revision Control"), - TOOL_UTILS : _("Utilities"), - } diff --git a/gramps2/src/plugins/ChangeNames.py b/gramps2/src/plugins/ChangeNames.py index e6a7bd359..228d0c0fe 100644 --- a/gramps2/src/plugins/ChangeNames.py +++ b/gramps2/src/plugins/ChangeNames.py @@ -46,7 +46,6 @@ from gnome import help_display # gramps modules # #------------------------------------------------------------------------- -import const import Utils from QuestionDialog import OkDialog import Tool @@ -210,7 +209,7 @@ from PluginMgr import register_tool register_tool( name = 'chname', - category = const.TOOL_DBPROC, + category = Tool.TOOL_DBPROC, tool_class = ChangeNames, options_class = ChangeNamesOptions, modes = Tool.MODE_GUI, diff --git a/gramps2/src/plugins/ChangeTypes.py b/gramps2/src/plugins/ChangeTypes.py index 7a7f9ad96..bf73b975a 100644 --- a/gramps2/src/plugins/ChangeTypes.py +++ b/gramps2/src/plugins/ChangeTypes.py @@ -209,7 +209,7 @@ class ChangeTypesOptions(Tool.ToolOptions): from PluginMgr import register_tool register_tool( name = 'chtype', - category = const.TOOL_DBPROC, + category = Tool.TOOL_DBPROC, tool_class = ChangeTypes, options_class = ChangeTypesOptions, modes = Tool.MODE_GUI | Tool.MODE_CLI, diff --git a/gramps2/src/plugins/Checkpoint.py b/gramps2/src/plugins/Checkpoint.py index 9e4ef4a67..9b8968558 100644 --- a/gramps2/src/plugins/Checkpoint.py +++ b/gramps2/src/plugins/Checkpoint.py @@ -47,7 +47,6 @@ from gnome import help_display # gramps modules # #------------------------------------------------------------------------- -import const from QuestionDialog import OkDialog, ErrorDialog import WriteXML import Tool @@ -439,7 +438,7 @@ from PluginMgr import register_tool register_tool( name = 'chkpoint', - category = const.TOOL_REVCTL, + category = Tool.TOOL_REVCTL, tool_class = Checkpoint, options_class = CheckpointOptions, modes = Tool.MODE_GUI | Tool.MODE_CLI,