Fix of encoding errormsg, specially for Windows. Rearranged the msg a little.

svn: r16925
This commit is contained in:
Peter Landgren 2011-03-25 08:54:40 +00:00
parent 6d6edec21b
commit d4c8bf661d

View File

@ -1,6 +1,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2011 Nick Hall # Copyright (C) 2011 Nick Hall
# Copyright (C) 2011 Rob G. Healey <robhealey1@gmail.com>
# #
# This program is free software; you can redistribute it and/or modify # 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 # 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 _ from gen.ggettext import gettext as _
import gtk import gtk
import Utils import Utils
import sys
# pyexiv2 download page (C) Olivier Tilloy # pyexiv2 download page (C) Olivier Tilloy
_DOWNLOAD_LINK = "http://tilloy.net/dev/pyexiv2/download.html" _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 # the library is either not installed or does not meet
# minimum required version for this addon.... # minimum required version for this addon....
if not pyexiv2_req_install: if not pyexiv2_req_install:
raise Exception(_("The minimum required version for pyexiv2 must be %s \n" raise Exception((_("The minimum required version for pyexiv2 must be %s "
"or greater. Or you do not have the python library installed yet. " "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") % ( "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): class Exif(Gramplet):
""" """
@ -93,7 +95,7 @@ class Exif(Gramplet):
full_path = Utils.media_path_full(self.dbstate.db, media.get_path()) full_path = Utils.media_path_full(self.dbstate.db, media.get_path())
metadata = pyexiv2.ImageMetadata(full_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: if LesserVersion:
try: try:
metadata.readMetadata() metadata.readMetadata()
@ -104,6 +106,7 @@ class Exif(Gramplet):
metadata.read() metadata.read()
except IOError: except IOError:
return return
for key in metadata.exif_keys: for key in metadata.exif_keys:
tag = metadata[key] tag = metadata[key]
self.model.add((tag.section_name, tag.label, tag.human_value)) self.model.add((tag.section_name, tag.label, tag.human_value))