diff options
| -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 == '': |
