bitbake: hob: limit the description size when a custom image is saved

[YOCTO #5003]
(Bitbake rev: 9aec9ee41d4d893325d9bf92b8a53f2e68e4973d)

Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Cristiana Voicu 2013-09-05 15:47:52 +03:00 committed by Richard Purdie
parent da29dcce83
commit b501b832eb
1 changed files with 11 additions and 2 deletions

View File

@ -70,9 +70,11 @@ class SaveImageDialog (CrumbsDialog):
sub_label.set_alignment(0, 0)
sub_label.set_markup("The description should be less than 150 characters long.")
self.description_entry = gtk.TextView()
self.description_entry.get_buffer().set_text(self.description_field)
description_buffer = self.description_entry.get_buffer()
description_buffer.set_text(self.description_field)
description_buffer.connect("insert-text", self.limit_description_length)
self.description_entry.set_wrap_mode(gtk.WRAP_WORD)
self.description_entry.set_size_request(350,150)
self.description_entry.set_size_request(350,50)
sub_vbox.pack_start(label, expand=False, fill=False)
sub_vbox.pack_start(sub_label, expand=False, fill=False)
sub_vbox.pack_start(self.description_entry, expand=False, fill=False)
@ -108,6 +110,13 @@ class SaveImageDialog (CrumbsDialog):
self.show_all()
def limit_description_length(self, textbuffer, iter, text, length):
buffer_bounds = textbuffer.get_bounds()
entire_text = textbuffer.get_text(*buffer_bounds)
entire_text += text
if len(entire_text)>150 or text=="\n":
textbuffer.emit_stop_by_name("insert-text")
def name_entry_changed(self, entry):
text = entry.get_text()
if text == '':