diff options
author | Cristiana Voicu <cristiana.voicu@intel.com> | 2013-09-05 15:47:52 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-09-06 22:31:32 +0100 |
commit | b501b832eb1ebcdb20d55ee3d81a6a84ee5e3a77 (patch) | |
tree | 8d2b961b755512d4f35ae517bfdaf1ea6b21d6a3 /bitbake | |
parent | da29dcce8396cfabed3285c4f6ab3497b2e88f7a (diff) | |
download | poky-b501b832eb1ebcdb20d55ee3d81a6a84ee5e3a77.tar.gz |
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>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py index 56c00bbe56..e940ceee43 100644 --- a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py +++ b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py | |||
@@ -70,9 +70,11 @@ class SaveImageDialog (CrumbsDialog): | |||
70 | sub_label.set_alignment(0, 0) | 70 | sub_label.set_alignment(0, 0) |
71 | sub_label.set_markup("The description should be less than 150 characters long.") | 71 | sub_label.set_markup("The description should be less than 150 characters long.") |
72 | self.description_entry = gtk.TextView() | 72 | self.description_entry = gtk.TextView() |
73 | self.description_entry.get_buffer().set_text(self.description_field) | 73 | description_buffer = self.description_entry.get_buffer() |
74 | description_buffer.set_text(self.description_field) | ||
75 | description_buffer.connect("insert-text", self.limit_description_length) | ||
74 | self.description_entry.set_wrap_mode(gtk.WRAP_WORD) | 76 | self.description_entry.set_wrap_mode(gtk.WRAP_WORD) |
75 | self.description_entry.set_size_request(350,150) | 77 | self.description_entry.set_size_request(350,50) |
76 | sub_vbox.pack_start(label, expand=False, fill=False) | 78 | sub_vbox.pack_start(label, expand=False, fill=False) |
77 | sub_vbox.pack_start(sub_label, expand=False, fill=False) | 79 | sub_vbox.pack_start(sub_label, expand=False, fill=False) |
78 | sub_vbox.pack_start(self.description_entry, expand=False, fill=False) | 80 | sub_vbox.pack_start(self.description_entry, expand=False, fill=False) |
@@ -108,6 +110,13 @@ class SaveImageDialog (CrumbsDialog): | |||
108 | 110 | ||
109 | self.show_all() | 111 | self.show_all() |
110 | 112 | ||
113 | def limit_description_length(self, textbuffer, iter, text, length): | ||
114 | buffer_bounds = textbuffer.get_bounds() | ||
115 | entire_text = textbuffer.get_text(*buffer_bounds) | ||
116 | entire_text += text | ||
117 | if len(entire_text)>150 or text=="\n": | ||
118 | textbuffer.emit_stop_by_name("insert-text") | ||
119 | |||
111 | def name_entry_changed(self, entry): | 120 | def name_entry_changed(self, entry): |
112 | text = entry.get_text() | 121 | text = entry.get_text() |
113 | if text == '': | 122 | if text == '': |