1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 13:09:50 +00:00

bitbake: hob: change the name and description for the saveimagedialog

The image name and description should be saved for a future
save.

[YOCTO #4193]
(Bitbake rev: 6dc0fc243ac6046714523d08df4d8f88c48698cc)

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-07-25 07:40:49 +00:00
committed by Richard Purdie
parent bb8a265b0f
commit 3bef5a75d6
2 changed files with 11 additions and 3 deletions
@@ -29,10 +29,12 @@ class SaveImageDialog (CrumbsDialog):
This class is used to create a dialog that permits to save This class is used to create a dialog that permits to save
a custom image in a predefined directory. a custom image in a predefined directory.
""" """
def __init__(self, directory, title, parent, flags, buttons=None): def __init__(self, directory, name, description, title, parent, flags, buttons=None):
super(SaveImageDialog, self).__init__(title, parent, flags, buttons) super(SaveImageDialog, self).__init__(title, parent, flags, buttons)
self.directory = directory self.directory = directory
self.builder = parent self.builder = parent
self.name_field = name
self.description_field = description
# create visual elements on the dialog # create visual elements on the dialog
self.create_visual_elements() self.create_visual_elements()
@@ -52,6 +54,7 @@ class SaveImageDialog (CrumbsDialog):
content += "characters. The only special character you can use is the ASCII hyphen (-)." content += "characters. The only special character you can use is the ASCII hyphen (-)."
sub_label.set_markup(content) sub_label.set_markup(content)
self.name_entry = gtk.Entry() self.name_entry = gtk.Entry()
self.name_entry.set_text(self.name_field)
self.name_entry.set_size_request(350,30) self.name_entry.set_size_request(350,30)
self.name_entry.connect("changed", self.name_entry_changed) self.name_entry.connect("changed", self.name_entry_changed)
sub_vbox.pack_start(label, expand=False, fill=False) sub_vbox.pack_start(label, expand=False, fill=False)
@@ -67,6 +70,7 @@ class SaveImageDialog (CrumbsDialog):
sub_label.set_alignment(0, 0) sub_label.set_alignment(0, 0)
sub_label.set_markup("The description should be less than 150 characters long.") sub_label.set_markup("The description should be less than 150 characters long.")
self.description_entry = gtk.TextView() self.description_entry = gtk.TextView()
self.description_entry.get_buffer().set_text(self.description_field)
self.description_entry.set_wrap_mode(gtk.WRAP_WORD) self.description_entry.set_wrap_mode(gtk.WRAP_WORD)
self.description_entry.set_size_request(350,150) self.description_entry.set_size_request(350,150)
sub_vbox.pack_start(label, expand=False, fill=False) sub_vbox.pack_start(label, expand=False, fill=False)
@@ -124,6 +128,8 @@ class SaveImageDialog (CrumbsDialog):
self.builder.recipe_model.set_in_list(text, description) self.builder.recipe_model.set_in_list(text, description)
self.builder.recipe_model.set_selected_image(text) self.builder.recipe_model.set_selected_image(text)
self.builder.image_details_page.show_page(self.builder.IMAGE_GENERATED) self.builder.image_details_page.show_page(self.builder.IMAGE_GENERATED)
self.builder.image_details_page.name_field_template = text
self.builder.image_details_page.description_field_template = description
self.destroy() self.destroy()
else: else:
self.show_invalid_input_error_dialog() self.show_invalid_input_error_dialog()
+4 -2
View File
@@ -191,6 +191,8 @@ class ImageDetailsPage (HobPage):
self.details_bottom_buttons = gtk.HBox(False, 6) self.details_bottom_buttons = gtk.HBox(False, 6)
self.image_saved = False self.image_saved = False
self.create_visual_elements() self.create_visual_elements()
self.name_field_template = ""
self.description_field_template = ""
def create_visual_elements(self): def create_visual_elements(self):
# create visual elements # create visual elements
@@ -632,8 +634,8 @@ class ImageDetailsPage (HobPage):
images_dir = topdir + "/recipes/images/" images_dir = topdir + "/recipes/images/"
self.builder.ensure_dir(images_dir) self.builder.ensure_dir(images_dir)
dialog = SaveImageDialog(images_dir, "Save image recipe", self.builder, dialog = SaveImageDialog(images_dir, self.name_field_template, self.description_field_template,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT) "Save image recipe", self.builder, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
response = dialog.run() response = dialog.run()
dialog.destroy() dialog.destroy()