summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Wang <shane.wang@intel.com>2012-04-09 22:13:49 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-11 00:05:22 +0100
commitccf4f7653b0e0dbaeb6b682463c8b57e2edf1787 (patch)
treedc6cb7a1061c67d276e57783a402eb765f8b2809
parent793058e6f21ab569bb8a0d2d72981b8e41e5e8c1 (diff)
downloadpoky-ccf4f7653b0e0dbaeb6b682463c8b57e2edf1787.tar.gz
poky-ccf4f7653b0e0dbaeb6b682463c8b57e2edf1787.tar.bz2
poky-ccf4f7653b0e0dbaeb6b682463c8b57e2edf1787.zip
Hob: forget selected_recipes and selected_packages after users change the machine
The patch is to fix [Yocto #2255]. Now the logic is: - If users change the machine, the image combo is empty for users to select. - If users load the template, the image combo should set the value of selected_image specified in the template. - After loading a template, if users change the machine, the selected_image specified in the template should be removed from the image combo because it is probably invalid for a new machine. - If users customize the recipe/package list, and change the settings which causes reparsing, selected_recipes and selected_packages should be remembered. - If users add more layers, selected_recipes and selected_packages should be remembered. (Bitbake rev: e549b11f4f31863393f62a253ee96bead4594523) Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py1
-rw-r--r--bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py26
2 files changed, 24 insertions, 3 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 8393f6636a..fda0ce0caa 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -601,6 +601,7 @@ class Builder(gtk.Window):
" ".join(selected_packages))
self.image_configuration_page.update_image_combo(self.recipe_model, selected_image)
+ self.image_configuration_page.update_image_desc(selected_image)
self.update_recipe_model(selected_image, selected_recipes)
self.update_package_model(selected_packages)
diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
index 9a893789be..64c512d502 100644
--- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -37,6 +37,10 @@ class ImageConfigurationPage (HobPage):
super(ImageConfigurationPage, self).__init__(builder, "Image configuration")
self.image_combo_id = None
+ # we use machine_combo_changed_by_manual to identify the machine is changed by code
+ # or by manual. If by manual, all user's recipe selection and package selection are
+ # cleared.
+ self.machine_combo_changed_by_manual = True
self.create_visual_elements()
def create_visual_elements(self):
@@ -259,6 +263,13 @@ class ImageConfigurationPage (HobPage):
return
self.builder.configuration.curr_mach = combo_item
+ if self.machine_combo_changed_by_manual:
+ self.builder.configuration.selected_image = None
+ self.builder.configuration.selected_recipes = []
+ self.builder.configuration.selected_packages = []
+ # reset machine_combo_changed_by_manual
+ self.machine_combo_changed_by_manual = True
+
# Do reparse recipes
self.builder.populate_recipe_package_info_async()
@@ -272,6 +283,7 @@ class ImageConfigurationPage (HobPage):
self.machine_combo.set_active(-1)
def switch_machine_combo(self):
+ self.machine_combo_changed_by_manual = False
model = self.machine_combo.get_model()
active = 0
while active < len(model):
@@ -281,6 +293,16 @@ class ImageConfigurationPage (HobPage):
active += 1
self.machine_combo.set_active(-1)
+ def update_image_desc(self, selected_image):
+ desc = ""
+ if selected_image and selected_image in self.builder.recipe_model.pn_path.keys():
+ image_path = self.builder.recipe_model.pn_path[selected_image]
+ image_iter = self.builder.recipe_model.get_iter(image_path)
+ desc = self.builder.recipe_model.get_value(image_iter, self.builder.recipe_model.COL_DESC)
+
+ mark = ("<span %s>%s</span>\n") % (self.span_tag('small'), desc)
+ self.image_desc.set_markup(mark)
+
def image_combo_changed_idle_cb(self, selected_image, selected_recipes, selected_packages):
self.builder.update_recipe_model(selected_image, selected_recipes)
self.builder.update_package_model(selected_packages)
@@ -299,9 +321,7 @@ class ImageConfigurationPage (HobPage):
image_path = self.builder.recipe_model.pn_path[selected_image]
image_iter = self.builder.recipe_model.get_iter(image_path)
selected_packages = self.builder.recipe_model.get_value(image_iter, self.builder.recipe_model.COL_INSTALL).split()
-
- mark = ("<span %s>%s</span>\n") % (self.span_tag('small'), self.builder.recipe_model.get_value(image_iter, self.builder.recipe_model.COL_DESC))
- self.image_desc.set_markup(mark)
+ self.update_image_desc(selected_image)
self.builder.recipe_model.reset()
self.builder.package_model.reset()