Fixed entry and button tooltips not being available until after clicking on a media object.

svn: r17506
This commit is contained in:
Rob G. Healey 2011-05-16 04:46:45 +00:00
parent 8fff393b8b
commit 2b6855531c

View File

@ -271,6 +271,10 @@ class EditExifMetadata(Gramplet):
self.gui.get_container_widget().add_with_viewport(vbox) self.gui.get_container_widget().add_with_viewport(vbox)
vbox.show_all() vbox.show_all()
# setup widget tooltips for all fields and buttons...
# so the user has them available even before clicking on anything...
_setup_widget_tips(self.exif_widgets)
def build_gui(self): def build_gui(self):
""" """
creates the editing area fields. creates the editing area fields.
@ -572,13 +576,15 @@ class EditExifMetadata(Gramplet):
for ButtonName in ButtonList: for ButtonName in ButtonList:
self.exif_widgets[ButtonName].set_sensitive(False) self.exif_widgets[ButtonName].set_sensitive(False)
def activate_save(self, obj): def active_buttons(self, obj):
""" """
will handle the toggle action of the Save button. will handle the toggle action of the Save button.
If there is no Exif metadata, then the data fields are connected to the If there is no Exif metadata, then the data fields are connected to the
'changed' signal to be able to activate the Save button once data has been entered 'changed' signal to be able to activate the Save button once data has been entered
into the data fields... into the data fields...
Activate these buttons once info has been entered into the data fields...
""" """
if not self.exif_widgets["Save"].get_sensitive(): if not self.exif_widgets["Save"].get_sensitive():
@ -587,6 +593,13 @@ class EditExifMetadata(Gramplet):
# set Message Area to Entering Data... # set Message Area to Entering Data...
self.exif_widgets["Message:Area"].set_text(_("Entering data...")) self.exif_widgets["Message:Area"].set_text(_("Entering data..."))
if not self.exif_widgets["Clear"].get_sensitive():
self.activate_buttons(["Clear"])
if _MAGICK_FOUND:
if not self.exif_widgets["Delete"].get_sensitive():
self.activate_buttons(["Delete"])
def main(self): # return false finishes def main(self): # return false finishes
""" """
get the active media, mime type, and reads the image metadata get the active media, mime type, and reads the image metadata
@ -596,18 +609,6 @@ class EditExifMetadata(Gramplet):
# clear Edit Area and Labels... # clear Edit Area and Labels...
self.clear_metadata(self.orig_image) self.clear_metadata(self.orig_image)
# De-activate the buttons except for Help...
self.deactivate_buttons(["Clear", "ThumbnailView", "Save", "Advanced"])
if _MAGICK_FOUND:
self.deactivate_buttons(["Convert"])
if (_MAGICK_FOUND or _HEAD_FOUND):
self.deactivate_buttons(["Delete"])
# set Message Area to Select...
self.exif_widgets["Message:Area"].set_text(_("Select an image to begin..."))
active_handle = self.get_active("Media") active_handle = self.get_active("Media")
if not active_handle: if not active_handle:
self.set_has_data(False) self.set_has_data(False)
@ -655,9 +656,6 @@ class EditExifMetadata(Gramplet):
if (_MAGICK_FOUND and self.extension not in [".jpeg", ".jpg", ".jfif"] ): if (_MAGICK_FOUND and self.extension not in [".jpeg", ".jpg", ".jfif"] ):
self.activate_buttons(["Convert"]) self.activate_buttons(["Convert"])
# setup widget tooltips for all fields and buttons...
_setup_widget_tips(self.exif_widgets)
# creates, and reads the plugin image instance... # creates, and reads the plugin image instance...
self.plugin_image = self.setup_image(self.image_path) self.plugin_image = self.setup_image(self.image_path)
@ -840,6 +838,18 @@ class EditExifMetadata(Gramplet):
else: else:
self.exif_widgets["Message:Area"].set_text("") self.exif_widgets["Message:Area"].set_text("")
# De-activate the buttons except for Help...
self.deactivate_buttons(["Clear", "ThumbnailView", "Save", "Advanced"])
if _MAGICK_FOUND:
self.deactivate_buttons(["Convert"])
if (_MAGICK_FOUND or _HEAD_FOUND):
self.deactivate_buttons(["Delete"])
# set Message Area to Select...
self.exif_widgets["Message:Area"].set_text(_("Select an image to begin..."))
def EditArea(self, obj): def EditArea(self, obj):
""" """
displays the image Exif metadata in the Edit Area... displays the image Exif metadata in the Edit Area...
@ -848,22 +858,21 @@ class EditExifMetadata(Gramplet):
# Retrieves all metadata key pairs from this image... # Retrieves all metadata key pairs from this image...
MediaDataTags = _get_exif_keypairs(self.plugin_image) MediaDataTags = _get_exif_keypairs(self.plugin_image)
# activate Clear button...
self.activate_buttons(["Clear"])
# if no Exif metadata, disable the has_data() functionality? # if no Exif metadata, disable the has_data() functionality?
if MediaDataTags: if MediaDataTags:
# update has_data() functionality...
self.set_has_data(True) self.set_has_data(True)
# activate Clear, Save, and Advanced button...
self.activate_buttons(["Clear", "Save", "Advanced"])
# Activate Delete button if ImageMagick or jhead is found?... # Activate Delete button if ImageMagick or jhead is found?...
if (_MAGICK_FOUND or _JHEAD_FOUND): if (_MAGICK_FOUND or _JHEAD_FOUND):
self.activate_buttons(["Delete"]) self.activate_buttons(["Delete"])
imageKeyTags = [KeyTag for KeyTag in MediaDataTags if KeyTag in _DATAMAP] imageKeyTags = [KeyTag for KeyTag in MediaDataTags if KeyTag in _DATAMAP]
# activate Advanced and Save buttons...
self.activate_buttons(["Advanced", "Save"])
# set Message Area to Copying... # set Message Area to Copying...
self.exif_widgets["Message:Area"].set_text(_("Copying Exif metadata to the Edit Area...")) self.exif_widgets["Message:Area"].set_text(_("Copying Exif metadata to the Edit Area..."))
@ -883,7 +892,8 @@ class EditExifMetadata(Gramplet):
use_date = self._get_value(_DATAMAP["Modified"]) use_date = self._get_value(_DATAMAP["Modified"])
use_date = _process_datetime(use_date) if use_date else False use_date = _process_datetime(use_date) if use_date else False
if use_date: if use_date:
self.exif_widgets["Message:Area"].set_text(_("Last Changed: %s") % use_date) self.exif_widgets["Message:Area"].set_text(
_("Last Changed: %s") % use_date)
# Original Creation Date/ Time... # Original Creation Date/ Time...
elif widgetsName == "Original": elif widgetsName == "Original":
@ -954,7 +964,7 @@ class EditExifMetadata(Gramplet):
for widget, tooltip in _TOOLTIPS: for widget, tooltip in _TOOLTIPS:
if widget is not "Modified": if widget is not "Modified":
self.exif_widgets[widget].connect("changed", self.activate_save) self.exif_widgets[widget].connect("changed", self.active_buttons)
def convertdelete(self): def convertdelete(self):
""" """