4849: Prevent errors in gramplets that depend on the pyexiv2 module when this module is not available
svn: r17186
This commit is contained in:
parent
8c22cce7b2
commit
bf23e340db
@ -266,11 +266,11 @@ src/plugins/gramplet/CalendarGramplet.py
|
||||
src/plugins/gramplet/Children.py
|
||||
src/plugins/gramplet/DescendGramplet.py
|
||||
src/plugins/gramplet/Events.py
|
||||
src/plugins/gramplet/Exif.py
|
||||
src/plugins/gramplet/FanChartGramplet.py
|
||||
src/plugins/gramplet/FaqGramplet.py
|
||||
src/plugins/gramplet/GivenNameGramplet.py
|
||||
src/plugins/gramplet/gramplet.gpr.py
|
||||
src/plugins/gramplet/MetadataViewer.py
|
||||
src/plugins/gramplet/Notes.py
|
||||
src/plugins/gramplet/PedigreeGramplet.py
|
||||
src/plugins/gramplet/PersonDetails.py
|
||||
|
@ -191,6 +191,16 @@ def show_settings():
|
||||
except ImportError:
|
||||
cairover_str = 'not found'
|
||||
|
||||
try:
|
||||
import pyexiv2
|
||||
try:
|
||||
pyexiv2_str = '%d.%d.%d' % pyexiv2.version_info
|
||||
except :# any failure to 'get' the version
|
||||
pyexiv2_str = 'unknown version'
|
||||
|
||||
except ImportError:
|
||||
pyexiv2_str = 'not found'
|
||||
|
||||
import config
|
||||
usebsddb3 = config.get('preferences.use-bsddb3')
|
||||
try:
|
||||
@ -256,6 +266,7 @@ def show_settings():
|
||||
print ' bsddb : %s' % bsddb_str
|
||||
print ' bsddb.db : %s' % bsddb_db_str
|
||||
print ' cairo : %s' % cairover_str
|
||||
print ' pyexiv2 : %s' % pyexiv2_str
|
||||
print ' o.s. : %s' % operating_system
|
||||
if kernel:
|
||||
print ' kernel : %s' % kernel
|
||||
|
@ -107,11 +107,12 @@ class GrampsBar(gtk.Notebook):
|
||||
|
||||
opts_list.sort(key=lambda opt: opt["page"])
|
||||
for opts in opts_list:
|
||||
all_opts = get_gramplet_opts(opts["name"], opts)
|
||||
gramplet = make_requested_gramplet(TabGramplet, self, all_opts,
|
||||
self.dbstate, self.uistate)
|
||||
if gramplet:
|
||||
self.__add_tab(gramplet)
|
||||
if opts["name"] in AVAILABLE_GRAMPLETS():
|
||||
all_opts = get_gramplet_opts(opts["name"], opts)
|
||||
gramplet = make_requested_gramplet(TabGramplet, self, all_opts,
|
||||
self.dbstate, self.uistate)
|
||||
if gramplet:
|
||||
self.__add_tab(gramplet)
|
||||
|
||||
if len(opts_list) == 0:
|
||||
self.empty = True
|
||||
@ -126,7 +127,7 @@ class GrampsBar(gtk.Notebook):
|
||||
Load the gramplets from the configuration file.
|
||||
"""
|
||||
retval = []
|
||||
visible = False
|
||||
visible = True
|
||||
default_page = 0
|
||||
filename = self.configfile
|
||||
if filename and os.path.exists(filename):
|
||||
|
@ -16,14 +16,14 @@ pkgdata_PYTHON = \
|
||||
Children.py \
|
||||
DescendGramplet.py \
|
||||
Events.py \
|
||||
Exif.py \
|
||||
FanChartGramplet.py \
|
||||
FaqGramplet.py \
|
||||
Filter.py \
|
||||
Filter.py \
|
||||
Gallery.py \
|
||||
GivenNameGramplet.py \
|
||||
gramplet.gpr.py \
|
||||
MediaPreview.py \
|
||||
MetadataViewer.py \
|
||||
Notes.py \
|
||||
PedigreeGramplet.py \
|
||||
PersonDetails.py \
|
||||
|
@ -63,7 +63,7 @@ if not pyexiv2_req_install:
|
||||
Min_VERSION_str, _DOWNLOAD_LINK, PrefVersion_str)
|
||||
).encode(sys.getfilesystemencoding()) )
|
||||
|
||||
class Exif(Gramplet):
|
||||
class MetadataViewer(Gramplet):
|
||||
"""
|
||||
Displays the exif tags of an image.
|
||||
"""
|
@ -77,20 +77,27 @@ register(GRAMPLET,
|
||||
gramplet_title=_("Preview"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id = "Exif Viewer Gramplet",
|
||||
name = _("Exif Viewer Gramplet"),
|
||||
description = _("Gramplet showing exif tags for a media object"),
|
||||
version = "1.0.0",
|
||||
gramps_target_version = "3.4",
|
||||
status = STABLE,
|
||||
fname = "Exif.py",
|
||||
height = 200,
|
||||
gramplet = 'Exif',
|
||||
gramplet_title = _("Exif"),
|
||||
authors = ["Rob G. Healey"],
|
||||
authors_email = ["robhealey1@gmail.com"],
|
||||
)
|
||||
try:
|
||||
import pyexiv2
|
||||
available = True
|
||||
except:
|
||||
print _("WARNING: pyexiv2 module not loaded. "
|
||||
"Image metadata functionality will not be available.")
|
||||
available = False
|
||||
|
||||
if available:
|
||||
register(GRAMPLET,
|
||||
id = "Metadata Viewer Gramplet",
|
||||
name = _("Metadata Viewer Gramplet"),
|
||||
description = _("Gramplet showing metadata for a media object"),
|
||||
version = "1.0.0",
|
||||
gramps_target_version = "3.4",
|
||||
status = STABLE,
|
||||
fname = "MetadataViewer.py",
|
||||
height = 200,
|
||||
gramplet = 'MetadataViewer',
|
||||
gramplet_title = _("Image Metadata"),
|
||||
)
|
||||
|
||||
register(GRAMPLET,
|
||||
id="Person Residence Gramplet",
|
||||
|
@ -425,8 +425,8 @@ class MediaView(ListView):
|
||||
"""
|
||||
return (("Media Filter Gramplet",),
|
||||
("Media Preview Gramplet",
|
||||
"Exif Viewer Gramplet",
|
||||
"Media Sources Gramplet",
|
||||
"Media Notes Gramplet",
|
||||
"Media Attributes Gramplet",
|
||||
"Metadata Viewer Gramplet",
|
||||
"Media Backlinks Gramplet"))
|
||||
|
Loading…
Reference in New Issue
Block a user