The exif tags option will only be displayed if they have the pyexiv2 library installed. Great error prevention.
svn: r13584
This commit is contained in:
parent
ff073515be
commit
4a98fd23d6
@ -304,6 +304,9 @@ class BasePage(object):
|
||||
self.linkhome = report.options['linkhome']
|
||||
self.create_media = report.options['gallery']
|
||||
self.inc_events = report.options['inc_events']
|
||||
|
||||
# only show option if the pyexiv2 library is available on local system
|
||||
if pyexiftaglib:
|
||||
self.exiftagsopt = report.options['exiftagsopt']
|
||||
|
||||
def get_birth_date(self, db, person):
|
||||
@ -2603,12 +2606,11 @@ class MediaPage(BasePage):
|
||||
table += trow
|
||||
|
||||
# display image Exif tags/ keys if any?
|
||||
if ((pyexiftaglib and self.exiftagsopt) and mime_type.startswith("image/")):
|
||||
"""
|
||||
# Determine if the python exif lib is installed on the system?
|
||||
# yes, then use it and determine if the photo has anything written inside of it?
|
||||
"""
|
||||
if pyexiftaglib:
|
||||
if self.exiftagsopt and mime_type.startswith("image/"):
|
||||
|
||||
# if the pyexiv2 library is installed, then show if the option has been set,
|
||||
# yes, then use it and determine if the image has anything written inside of it?
|
||||
image = pyexiv2.Image("%s" % Utils.media_path_full(db, media.get_path()) )
|
||||
image.readMetadata()
|
||||
|
||||
@ -4837,7 +4839,8 @@ class NavWebReport(Report):
|
||||
self.inc_contact = self.options['contactnote'] or \
|
||||
self.options['contactimg']
|
||||
|
||||
# exif tags option
|
||||
# only show option if the pyexiv2 library is available on local system
|
||||
if pyexiftaglib:
|
||||
self.exiftagsopt = self.options["exiftagsopt"]
|
||||
|
||||
# name format option
|
||||
@ -5739,6 +5742,8 @@ class NavWebOptions(MenuReportOptions):
|
||||
menu.add_option(category_name, 'gallery', self.__gallery)
|
||||
self.__gallery.connect('value-changed', self.__gallery_changed)
|
||||
|
||||
# only show option if the pyexiv2 library is available on local system
|
||||
if pyexiftaglib:
|
||||
self.__exiftags = BooleanOption(_("Whether to add exif tags to the media page or not?"), False)
|
||||
self.__exiftags.set_help(_("Do you want to add the exif data tags to the page? You will"
|
||||
" need to have the pyexiv2 library installed on your system."
|
||||
@ -5945,10 +5950,16 @@ class NavWebOptions(MenuReportOptions):
|
||||
"""
|
||||
|
||||
if self.__gallery.get_value() == False:
|
||||
|
||||
# only show option if the pyexiv2 library is available on local system
|
||||
if pyexiftaglib:
|
||||
self.__exiftags.set_available(False)
|
||||
self.__maxinitialimagewidth.set_available(False)
|
||||
self.__maxinitialimageheight.set_available(False)
|
||||
else:
|
||||
|
||||
# only show option if the pyexiv2 library is available on local system
|
||||
if pyexiftaglib:
|
||||
self.__exiftags.set_available(True)
|
||||
self.__maxinitialimagewidth.set_available(True)
|
||||
self.__maxinitialimageheight.set_available(True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user