Code cleanup: Fixed and cleanup of event_box and entry combo.

svn: r18032
This commit is contained in:
Rob G. Healey 2011-08-11 21:50:54 +00:00
parent 606a712cbf
commit 545d61353e

View File

@ -252,7 +252,9 @@ class EditExifMetadata(Gramplet):
""" """
create variables, and build display create variables, and build display
""" """
self.exif_widgets, self.dates, self.coordinates = {}, {}, {} self.exif_widgets = {}
self.dates = {}
self.coordinates = {}
self.orig_image, self.plugin_image, self.image_path = [False]*3 self.orig_image, self.plugin_image, self.image_path = [False]*3
vbox = self.__build_gui() vbox = self.__build_gui()
@ -638,6 +640,37 @@ class EditExifMetadata(Gramplet):
label.show() label.show()
return label return label
def __create_event_entry(self, pos, width, height, length_, type_, cb_list):
"""
handles the creation of an event_box and entry containers and returns them...
"""
evt_box = gtk.EventBox()
if (width and height):
evt_box.set_size_request(width, height)
self.exif_widgets[pos + "Box"] = evt_box
evt_box.show()
if type_ == "Validate":
entry = ValidatableMaskedEntry()
if cb_list:
for call_ in cb_list:
entry.connect('validate', call_, pos)
elif type_ == "Entry":
entry = gtk.Entry(max = length_)
if cb_list:
for call_ in cb_list:
entry.connect('validate', call_)
evt_box.add(entry)
self.exif_widgets[pos] = entry
entry.show()
return evt_box
def thumbnail_view(self, object): def thumbnail_view(self, object):
""" """
will allow a display area for a thumbnail pop-up window. will allow a display area for a thumbnail pop-up window.
@ -966,15 +999,8 @@ class EditExifMetadata(Gramplet):
title_frame.add(new_hbox) title_frame.add(new_hbox)
new_hbox.show() new_hbox.show()
event_box = gtk.EventBox() event_box = self.__create_event_entry("MediaTitle", 440, 40, 100, "Entry", [] )
event_box.set_size_request(440, 40)
new_hbox.pack_start(event_box, expand =False, fill =True, padding =10) new_hbox.pack_start(event_box, expand =False, fill =True, padding =10)
event_box.show()
entry = gtk.Entry(max =100)
event_box.add(entry)
self.exif_widgets["MediaTitle"] = entry
entry.show()
# create the data fields... # create the data fields...
# ***Description, Artist, and Copyright # ***Description, Artist, and Copyright
@ -999,15 +1025,8 @@ class EditExifMetadata(Gramplet):
label = self.__create_label(False, text, width =90, height =25) label = self.__create_label(False, text, width =90, height =25)
new_hbox.pack_start(label, expand =False, fill =False, padding =0) new_hbox.pack_start(label, expand =False, fill =False, padding =0)
event_box = gtk.EventBox() event_box = self.__create_event_entry(widget, 360, 30, 100, "Entry", [] )
event_box.set_size_request(360, 30)
new_hbox.pack_start(event_box, expand =False, fill =False, padding =0) new_hbox.pack_start(event_box, expand =False, fill =False, padding =0)
event_box.show()
entry = gtk.Entry(max =100)
event_box.add(entry)
self.exif_widgets[widget] = entry
entry.show()
# iso format: Year, Month, Day spinners... # iso format: Year, Month, Day spinners...
datetime_frame = gtk.Frame(_("Date/ Time")) datetime_frame = gtk.Frame(_("Date/ Time"))
@ -1036,16 +1055,8 @@ class EditExifMetadata(Gramplet):
vbox2.pack_start(label, expand =False, fill =False, padding =0) vbox2.pack_start(label, expand =False, fill =False, padding =0)
label.show() label.show()
event_box = gtk.EventBox() event_box = self.__create_event_entry(widget, 215, 30, 0, "Validate", [self.validate_datetime] )
event_box.set_size_request(215, 30)
vbox2.pack_start(event_box, expand =False, fill =False, padding =0) vbox2.pack_start(event_box, expand =False, fill =False, padding =0)
event_box.show()
entry = ValidatableMaskedEntry()
entry.connect('validate', self.validate_datetime, widget)
event_box.add(entry)
self.exif_widgets[widget] = entry
entry.show()
self.dates[widget] = None self.dates[widget] = None
@ -1076,16 +1087,10 @@ class EditExifMetadata(Gramplet):
vbox2.pack_start(label, expand =False, fill =False, padding =0) vbox2.pack_start(label, expand =False, fill =False, padding =0)
label.show() label.show()
event_box = gtk.EventBox() event_box = self.__create_event_entry(widget, 141, 30, 0, "Validate", [self.validate_coordinate])
event_box.set_size_request(141, 30)
vbox2.pack_start(event_box, expand =False, fill =False, padding =0) vbox2.pack_start(event_box, expand =False, fill =False, padding =0)
event_box.show()
entry = ValidatableMaskedEntry() self.coordinates[widget] = None
entry.connect('validate', self.validate_coordinate, widget)
event_box.add(entry)
self.exif_widgets[widget] = entry
entry.show()
# Help, Save, Clear, Copy, and Close buttons... # Help, Save, Clear, Copy, and Close buttons...
new_hbox = gtk.HBox(False, 0) new_hbox = gtk.HBox(False, 0)