From 55e2863a0baadef29083c885b7bd8a0548662a21 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Sun, 10 Mar 2013 21:51:52 +0000 Subject: [PATCH] sync a few files in gramps40 and trunk svn: r21603 --- gramps/gen/datehandler/_grampslocale.py | 1 + gramps/gen/utils/cast.py | 1 + gramps/gen/utils/configmanager.py | 1 + gramps/gen/utils/image.py | 1 - gramps/gui/widgets/grampletbar.py | 6 +++++- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gramps/gen/datehandler/_grampslocale.py b/gramps/gen/datehandler/_grampslocale.py index c398f518f..1190f03e9 100644 --- a/gramps/gen/datehandler/_grampslocale.py +++ b/gramps/gen/datehandler/_grampslocale.py @@ -43,6 +43,7 @@ else: #locale returns unicode in python 3 to_uni = lambda x, y: x codeset = glocale.encoding + try: month_to_int = { diff --git a/gramps/gen/utils/cast.py b/gramps/gen/utils/cast.py index 75c5f2a9f..684137b24 100644 --- a/gramps/gen/utils/cast.py +++ b/gramps/gen/utils/cast.py @@ -36,6 +36,7 @@ import locale import sys import logging LOG = logging.getLogger(".") + #------------------------------------------------------------------------- # # Gramps modules diff --git a/gramps/gen/utils/configmanager.py b/gramps/gen/utils/configmanager.py index f504c06b9..5b19c8e20 100644 --- a/gramps/gen/utils/configmanager.py +++ b/gramps/gen/utils/configmanager.py @@ -47,6 +47,7 @@ import io from ..constfunc import STRTYPE from ..const import GRAMPS_LOCALE as glocale _ = glocale.get_translation().gettext + def safe_eval(exp): # restrict eval to empty environment return eval(exp, {}) diff --git a/gramps/gen/utils/image.py b/gramps/gen/utils/image.py index 5a6b0a24e..85cf4b12b 100644 --- a/gramps/gen/utils/image.py +++ b/gramps/gen/utils/image.py @@ -277,4 +277,3 @@ def resize_to_jpeg_buffer(source, size, crop=None): except: pass return data - diff --git a/gramps/gui/widgets/grampletbar.py b/gramps/gui/widgets/grampletbar.py index 76df4e661..a348d94e1 100644 --- a/gramps/gui/widgets/grampletbar.py +++ b/gramps/gui/widgets/grampletbar.py @@ -56,6 +56,7 @@ from gi.repository import Gtk #------------------------------------------------------------------------- from gramps.gen.const import URL_MANUAL_PAGE, VERSION_DIR from gramps.gen.config import config +from gramps.gen.constfunc import win from ..managedwindow import ManagedWindow from ..display import display_help, display_url from .grampletpane import (AVAILABLE_GRAMPLETS, @@ -191,7 +192,10 @@ class GrampletBar(Gtk.Notebook): """ filename = self.configfile try: - fp = open(filename, "w") + if win() and not sys.version_info[0] < 3: + fp = open(filename, "w", encoding='utf-8') + else: + fp = open(filename, "w") except IOError: print("Failed writing '%s'; gramplets not saved" % filename) return