From d4c8bf661d494cdc4e919be79bafcc8917a20bb9 Mon Sep 17 00:00:00 2001 From: Peter Landgren Date: Fri, 25 Mar 2011 08:54:40 +0000 Subject: [PATCH] Fix of encoding errormsg, specially for Windows. Rearranged the msg a little. svn: r16925 --- src/plugins/gramplet/Exif.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/gramplet/Exif.py b/src/plugins/gramplet/Exif.py index 3be8494ef..2a684c285 100644 --- a/src/plugins/gramplet/Exif.py +++ b/src/plugins/gramplet/Exif.py @@ -1,6 +1,7 @@ # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2011 Nick Hall +# Copyright (C) 2011 Rob G. Healey # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,6 +25,7 @@ from gen.plug import Gramplet from gen.ggettext import gettext as _ import gtk import Utils +import sys # pyexiv2 download page (C) Olivier Tilloy _DOWNLOAD_LINK = "http://tilloy.net/dev/pyexiv2/download.html" @@ -51,10 +53,10 @@ except AttributeError: # the library is either not installed or does not meet # minimum required version for this addon.... if not pyexiv2_req_install: - raise Exception(_("The minimum required version for pyexiv2 must be %s \n" - "or greater. Or you do not have the python library installed yet. " + raise Exception((_("The minimum required version for pyexiv2 must be %s " + "or greater.\n Or you do not have the python library installed yet.\n" "You may download it from here: %s\n\n I recommend getting, %s") % ( - Min_VERSION_str, _DOWNLOAD_LINK, PrefVersion_str) ) + Min_VERSION_str, _DOWNLOAD_LINK, PrefVersion_str)).encode(sys.getfilesystemencoding()) ) class Exif(Gramplet): """ @@ -93,7 +95,7 @@ class Exif(Gramplet): full_path = Utils.media_path_full(self.dbstate.db, media.get_path()) metadata = pyexiv2.ImageMetadata(full_path) - # this will allow users of pyexiv2-0.1.3 to be able to use this addon also... + # this will allow users of pyexiv2-0.1.3 to use this addon also... if LesserVersion: try: metadata.readMetadata() @@ -104,6 +106,7 @@ class Exif(Gramplet): metadata.read() except IOError: return + for key in metadata.exif_keys: tag = metadata[key] self.model.add((tag.section_name, tag.label, tag.human_value))