bitbake: hob: make changes in order to permit from UI to edit an image after saving it

Added the image name to the list model, in order to show the image name as
the user named it.

[YOCTO #4193]
(Bitbake rev: 0aba493103d1fe50026a47db16529febbbbd77a2)

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:37:34 +00:00 committed by Richard Purdie
parent 564c83be5e
commit 116219ce09
3 changed files with 31 additions and 11 deletions

View File

@ -119,7 +119,11 @@ class SaveImageDialog (CrumbsDialog):
description_buffer = self.description_entry.get_buffer()
description = description_buffer.get_text(description_buffer.get_start_iter(),description_buffer.get_end_iter())
if new_text.islower() and new_text.isalnum():
self.builder.image_details_page.image_saved = True
self.builder.generate_new_image(self.directory+text, description)
self.builder.recipe_model.set_in_list(text, description)
self.builder.recipe_model.set_selected_image(text)
self.builder.image_details_page.show_page(self.builder.IMAGE_GENERATED)
self.destroy()
else:
self.show_invalid_input_error_dialog()

View File

@ -678,15 +678,8 @@ class RecipeListModel(gtk.ListStore):
self.clear()
# dummy image for prompt
self.set(self.append(), self.COL_NAME, self.__custom_image__,
self.COL_DESC, "Use 'Edit image recipe' to customize recipes and packages " \
"to be included in your image ",
self.COL_LIC, "", self.COL_GROUP, "",
self.COL_DEPS, "", self.COL_BINB, "",
self.COL_TYPE, "image", self.COL_INC, False,
self.COL_IMG, False, self.COL_INSTALL, "", self.COL_PN, self.__custom_image__,
self.COL_SUMMARY, "", self.COL_VERSION, "", self.COL_REVISION, "",
self.COL_HOMEPAGE, "", self.COL_BUGTRACKER, "")
self.set_in_list(self.__custom_image__, "Use 'Edit image recipe' to customize recipes and packages " \
"to be included in your image ")
for item in event_model["pn"]:
name = item
@ -732,6 +725,23 @@ class RecipeListModel(gtk.ListStore):
self.pn_path[pn] = path
it = self.iter_next(it)
def set_in_list(self, item, desc):
self.set(self.append(), self.COL_NAME, item,
self.COL_DESC, desc,
self.COL_LIC, "", self.COL_GROUP, "",
self.COL_DEPS, "", self.COL_BINB, "",
self.COL_TYPE, "image", self.COL_INC, False,
self.COL_IMG, False, self.COL_INSTALL, "", self.COL_PN, item,
self.COL_SUMMARY, "", self.COL_VERSION, "", self.COL_REVISION, "",
self.COL_HOMEPAGE, "", self.COL_BUGTRACKER, "")
self.pn_path = {}
it = self.get_iter_first()
while it:
pn = self.get_value(it, self.COL_NAME)
path = self.get_path(it)
self.pn_path[pn] = path
it = self.iter_next(it)
"""
Update the model, send out the notification.
"""

View File

@ -189,6 +189,7 @@ class ImageDetailsPage (HobPage):
self.image_store = []
self.button_ids = {}
self.details_bottom_buttons = gtk.HBox(False, 6)
self.image_saved = False
self.create_visual_elements()
def create_visual_elements(self):
@ -248,7 +249,7 @@ class ImageDetailsPage (HobPage):
self.pack_start(self.group_align, expand=True, fill=True)
self.build_result = None
if self.build_succeeded and self.builder.current_step == self.builder.IMAGE_GENERATING:
if self.image_saved or (self.build_succeeded and self.builder.current_step == self.builder.IMAGE_GENERATING):
# building is the previous step
icon = gtk.Image()
pixmap_path = hic.ICON_INDI_CONFIRM_FILE
@ -256,7 +257,10 @@ class ImageDetailsPage (HobPage):
pix_buffer = gtk.gdk.pixbuf_new_from_file(pixmap_path)
icon.set_from_pixbuf(pix_buffer)
varlist = [""]
vallist = ["Your image is ready"]
if self.image_saved:
vallist = ["Your image recipe has been saved"]
else:
vallist = ["Your image is ready"]
self.build_result = self.BuildDetailBox(varlist=varlist, vallist=vallist, icon=icon, color=color)
self.box_group_area.pack_start(self.build_result, expand=False, fill=False)
@ -397,6 +401,7 @@ class ImageDetailsPage (HobPage):
self.show_all()
if self.kernel_detail and (not is_runnable):
self.kernel_detail.hide()
self.image_saved = False
def view_files_clicked_cb(self, button, image_addr):
subprocess.call("xdg-open /%s" % image_addr, shell=True)
@ -583,6 +588,7 @@ class ImageDetailsPage (HobPage):
name = "Save image recipe"
if name in buttonlist and self.builder.recipe_model.is_custom_image():
save_button = HobAltButton("Save image recipe")
save_button.set_sensitive(not self.image_saved)
button_id = save_button.connect("clicked", self.save_button_clicked_cb)
self.button_ids[button_id] = save_button
self.details_bottom_buttons.pack_end(save_button, expand=False, fill=False)