behave gracefully if no GExiv2 under Python3

svn: r21467
This commit is contained in:
Paul Franklin 2013-02-26 20:36:18 +00:00
parent 5e9837d484
commit e6034cde4b
2 changed files with 19 additions and 11 deletions

View File

@ -240,11 +240,17 @@ def show_settings():
osmgpsmap_str = 'not found'
try:
from gi import Repository
repository = Repository.get_default()
if repository.enumerate_versions("GExiv2"):
from gi.repository import GExiv2
try:
gexiv2_str = GExiv2._version
except: # any failure to 'get' the version
gexiv2_str = 'unknown version'
else:
gexiv2_str = 'not found'
except ImportError:
gexiv2_str = 'not found'

View File

@ -371,12 +371,14 @@ register(GRAMPLET,
)
try:
from gi import Repository
repository = Repository.get_default()
if repository.enumerate_versions("GExiv2"):
from gi.repository import GExiv2
available = True
except:
import logging
logging.warning(_("WARNING: GExiv2 module not loaded. "
"Image metadata functionality will not be available."))
else:
available = False
except ImportError:
available = False
if available: