From 30a6f4267b73a1e9da6233ef24adc2810cb6341b Mon Sep 17 00:00:00 2001 From: prculley Date: Tue, 2 Aug 2016 15:13:45 -0500 Subject: [PATCH 1/3] Add GUI and CLI config option to allow easy setting --- gramps/gen/config.py | 1 + gramps/grampsapp.py | 4 ++++ gramps/gui/configure.py | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/gramps/gen/config.py b/gramps/gen/config.py index cbfa71b60..4355ccc71 100644 --- a/gramps/gen/config.py +++ b/gramps/gen/config.py @@ -294,6 +294,7 @@ register('paths.quick-backup-filename', register('preferences.date-format', 0) register('preferences.calendar-format-report', 0) register('preferences.cprefix', 'C%04d') +register('preferences.alternate-fonthandler', False) register('preferences.default-source', False) register('preferences.tag-on-import', False) register('preferences.tag-on-import-format', _("Imported %Y/%m/%d %H:%M:%S")) diff --git a/gramps/grampsapp.py b/gramps/grampsapp.py index 07dc53544..b460f7e45 100644 --- a/gramps/grampsapp.py +++ b/gramps/grampsapp.py @@ -46,6 +46,7 @@ from .gen.const import APP_GRAMPS, USER_DIRLIST, HOME_DIR from .gen.constfunc import mac from .version import VERSION_TUPLE from .gen.constfunc import win, get_env_var +from gramps.gen.config import config #------------------------------------------------------------------------- # @@ -473,6 +474,9 @@ def main(): resource_path, filename = os.path.split(os.path.abspath(__file__)) resource_path, dirname = os.path.split(resource_path) os.environ['GRAMPS_RESOURCES'] = resource_path + if win() and ('PANGOCAIRO_BACKEND' not in os.environ) and \ + config.get('preferences.alternate-fonthandler'): + os.environ['PANGOCAIRO_BACKEND'] = "fontconfig" errors = run() if errors and isinstance(errors, list): for error in errors: diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index 337f39df7..6b7eea7f0 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -66,6 +66,7 @@ from gramps.gen.plug.utils import available_updates from .plug import PluginWindows from gramps.gen.errors import WindowActiveError from .spell import HAVE_GTKSPELL +from gramps.gen.constfunc import win _ = glocale.translation.gettext #------------------------------------------------------------------------- @@ -1291,6 +1292,12 @@ class GrampsPreferences(ConfigureDialog): grid.set_row_spacing(6) current_line = 0 + if win(): + self.add_checkbox(grid, + _('Use alternate Font handler for GUI and Reports (requires restart)'), + current_line, 'preferences.alternate-fonthandler') + + current_line += 1 self.add_checkbox(grid, _('Add default source on GEDCOM import'), current_line, 'preferences.default-source') From a1b20d4b9ddbb680444f5431a87fe2abb83b7c2f Mon Sep 17 00:00:00 2001 From: prculley Date: Tue, 2 Aug 2016 16:12:32 -0500 Subject: [PATCH 2/3] Fix long line (pylint) --- gramps/gui/configure.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py index 6b7eea7f0..cf80e2431 100644 --- a/gramps/gui/configure.py +++ b/gramps/gui/configure.py @@ -1294,7 +1294,8 @@ class GrampsPreferences(ConfigureDialog): current_line = 0 if win(): self.add_checkbox(grid, - _('Use alternate Font handler for GUI and Reports (requires restart)'), + _('Use alternate Font handler for GUI and Reports ' + '(requires restart)'), current_line, 'preferences.alternate-fonthandler') current_line += 1 From 7efee37123ee1143a93eab6a4d4bd6834858e459 Mon Sep 17 00:00:00 2001 From: prculley Date: Sun, 21 Aug 2016 14:59:55 -0500 Subject: [PATCH 3/3] use relative import --- gramps/grampsapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gramps/grampsapp.py b/gramps/grampsapp.py index b460f7e45..aedaa0f44 100644 --- a/gramps/grampsapp.py +++ b/gramps/grampsapp.py @@ -46,7 +46,7 @@ from .gen.const import APP_GRAMPS, USER_DIRLIST, HOME_DIR from .gen.constfunc import mac from .version import VERSION_TUPLE from .gen.constfunc import win, get_env_var -from gramps.gen.config import config +from .gen.config import config #------------------------------------------------------------------------- #