From 7b3d7f263ad49194b7690a2da3f46de7a0ae4c57 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Fri, 12 Aug 2016 18:49:13 -0700 Subject: [PATCH] make it clear that consistency is needed --- gramps/cli/plug/__init__.py | 8 ++++---- gramps/gen/const.py | 1 + gramps/gui/plug/report/_reportdialog.py | 9 +++++---- gramps/plugins/docgen/asciidoc.py | 6 +++--- gramps/plugins/docgen/svgdrawdoc.py | 6 +++--- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/gramps/cli/plug/__init__.py b/gramps/cli/plug/__init__.py index 62d2db26c..7d92b6782 100644 --- a/gramps/cli/plug/__init__.py +++ b/gramps/cli/plug/__init__.py @@ -59,7 +59,7 @@ from gramps.gen.plug.report import (CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_BOOK, CATEGORY_GRAPHVIZ, CATEGORY_CODE, ReportOptions, append_styles) from gramps.gen.plug.report._paper import paper_sizes -from gramps.gen.const import USER_HOME +from gramps.gen.const import USER_HOME, DOCGEN_OPTIONS from gramps.gen.dbstate import DbState from ..grampscli import CLIManager from ..user import User @@ -576,15 +576,15 @@ class CommandLineReport: self.doc_options.load_previous_values() docgen_menu = self.doc_options.menu report_menu = self.option_class.menu # "help" checks the option type - for oname in docgen_menu.get_option_names('Document Options'): - docgen_opt = docgen_menu.get_option('Document Options', oname) + for oname in docgen_menu.get_option_names(DOCGEN_OPTIONS): + docgen_opt = docgen_menu.get_option(DOCGEN_OPTIONS, oname) if oname in self.options_str_dict and oname in doc_options_dict: doc_options_dict[oname] = _convert_str_to_match_type( self.options_str_dict[oname], doc_options_dict[oname]) self.options_str_dict.pop(oname) if oname in doc_options_dict: docgen_opt.set_value(doc_options_dict[oname]) - report_menu.add_option('Document Options', oname, docgen_opt) + report_menu.add_option(DOCGEN_OPTIONS, oname, docgen_opt) for oname in doc_options_dict: # enable "help" self.options_dict[oname] = doc_options_dict[oname] self.options_help[oname] = self.doc_options.options_help[oname][:3] diff --git a/gramps/gen/const.py b/gramps/gen/const.py index 6c1cd0cdd..19143e7bc 100644 --- a/gramps/gen/const.py +++ b/gramps/gen/const.py @@ -252,6 +252,7 @@ NO_SURNAME = "(%s)" % _("surname|none") NO_GIVEN = "(%s)" % _("given-name|none") ARABIC_COMMA = "،" ARABIC_SEMICOLON = "؛" +DOCGEN_OPTIONS = 'Docgen Options' #------------------------------------------------------------------------- # diff --git a/gramps/gui/plug/report/_reportdialog.py b/gramps/gui/plug/report/_reportdialog.py index 19e1798b3..b9e79b964 100644 --- a/gramps/gui/plug/report/_reportdialog.py +++ b/gramps/gui/plug/report/_reportdialog.py @@ -45,9 +45,8 @@ from gi.repository import Gtk # Gramps modules # #------------------------------------------------------------------------- -from gramps.gen.const import GRAMPS_LOCALE as glocale, URL_MANUAL_PAGE -_ = glocale.translation.gettext from gramps.gen.config import config +from gramps.gen.const import URL_MANUAL_PAGE, DOCGEN_OPTIONS from gramps.gen.errors import (DatabaseError, FilterError, ReportError, WindowActiveError) from ...utils import open_file_with_default_application @@ -62,6 +61,8 @@ from ...managedwindow import ManagedWindow from ._stylecombobox import StyleComboBox from ._styleeditor import StyleListDisplay from ._fileentry import FileEntry +from gramps.gen.const import GRAMPS_LOCALE as glocale +_ = glocale.translation.gettext #------------------------------------------------------------------------- # # Private Constants @@ -606,8 +607,8 @@ class ReportDialog(ManagedWindow): self.init_doc_options(self.doc_option_class) menu = self.doc_options.menu - for name in menu.get_option_names('Document Options'): - option = menu.get_option('Document Options', name) + for name in menu.get_option_names(DOCGEN_OPTIONS): + option = menu.get_option(DOCGEN_OPTIONS, name) # override option default with xml-saved value: if name in self.doc_options.options_dict: option.set_value(self.doc_options.options_dict[name]) diff --git a/gramps/plugins/docgen/asciidoc.py b/gramps/plugins/docgen/asciidoc.py index 7f5076535..872c7e7a1 100644 --- a/gramps/plugins/docgen/asciidoc.py +++ b/gramps/plugins/docgen/asciidoc.py @@ -32,9 +32,10 @@ ACSII document generator. # Gramps modules # #------------------------------------------------------------------------ +from gramps.gen.const import DOCGEN_OPTIONS +from gramps.gen.errors import ReportError from gramps.gen.plug.docgen import (BaseDoc, TextDoc, PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER) -from gramps.gen.errors import ReportError from gramps.gen.plug.menu import NumberOption from gramps.gen.plug.report import DocOptions from gramps.gen.const import GRAMPS_LOCALE as glocale @@ -457,8 +458,7 @@ class AsciiDocOptions(DocOptions): Add options to the document menu for the AsciiDoc docgen. """ - # next line for internal use only, never will be in UI: don't translate - category_name = 'Document Options' + category_name = DOCGEN_OPTIONS linechars = NumberOption(_('Characters per line'), 72, 20, 9999) linechars.set_help(_("The number of characters per line")) diff --git a/gramps/plugins/docgen/svgdrawdoc.py b/gramps/plugins/docgen/svgdrawdoc.py index f430fdb93..94d7c84d0 100644 --- a/gramps/plugins/docgen/svgdrawdoc.py +++ b/gramps/plugins/docgen/svgdrawdoc.py @@ -37,8 +37,9 @@ from io import StringIO # Gramps modules # #------------------------------------------------------------------------- -from gramps.gen.plug.docgen import BaseDoc, DrawDoc, SOLID, FONT_SANS_SERIF +from gramps.gen.const import DOCGEN_OPTIONS from gramps.gen.errors import ReportError +from gramps.gen.plug.docgen import BaseDoc, DrawDoc, SOLID, FONT_SANS_SERIF from gramps.gen.plug.menu import EnumeratedListOption from gramps.gen.plug.report import DocOptions from gramps.gen.const import GRAMPS_LOCALE as glocale @@ -335,8 +336,7 @@ class SvgDrawDocOptions(DocOptions): Add options to the document menu for the docgen. """ - # next line for internal use only, never will be in UI: don't translate - category_name = 'Document Options' + category_name = DOCGEN_OPTIONS background = EnumeratedListOption(_('SVG background color'), 'transparent')