summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Wang <shane.wang@intel.com>2012-04-09 14:13:49 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-10 23:05:22 (GMT)
commitccf4f7653b0e0dbaeb6b682463c8b57e2edf1787 (patch)
treedc6cb7a1061c67d276e57783a402eb765f8b2809
parent793058e6f21ab569bb8a0d2d72981b8e41e5e8c1 (diff)
downloadpoky-ccf4f7653b0e0dbaeb6b682463c8b57e2edf1787.tar.gz
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 8393f66..fda0ce0 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):
601 " ".join(selected_packages)) 601 " ".join(selected_packages))
602 602
603 self.image_configuration_page.update_image_combo(self.recipe_model, selected_image) 603 self.image_configuration_page.update_image_combo(self.recipe_model, selected_image)
604 self.image_configuration_page.update_image_desc(selected_image)
604 self.update_recipe_model(selected_image, selected_recipes) 605 self.update_recipe_model(selected_image, selected_recipes)
605 self.update_package_model(selected_packages) 606 self.update_package_model(selected_packages)
606 607
diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
index 9a89378..64c512d 100644
--- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -37,6 +37,10 @@ class ImageConfigurationPage (HobPage):
37 super(ImageConfigurationPage, self).__init__(builder, "Image configuration") 37 super(ImageConfigurationPage, self).__init__(builder, "Image configuration")
38 38
39 self.image_combo_id = None 39 self.image_combo_id = None
40 # we use machine_combo_changed_by_manual to identify the machine is changed by code
41 # or by manual. If by manual, all user's recipe selection and package selection are
42 # cleared.
43 self.machine_combo_changed_by_manual = True
40 self.create_visual_elements() 44 self.create_visual_elements()
41 45
42 def create_visual_elements(self): 46 def create_visual_elements(self):
@@ -259,6 +263,13 @@ class ImageConfigurationPage (HobPage):
259 return 263 return
260 264
261 self.builder.configuration.curr_mach = combo_item 265 self.builder.configuration.curr_mach = combo_item
266 if self.machine_combo_changed_by_manual:
267 self.builder.configuration.selected_image = None
268 self.builder.configuration.selected_recipes = []
269 self.builder.configuration.selected_packages = []
270 # reset machine_combo_changed_by_manual
271 self.machine_combo_changed_by_manual = True
272
262 # Do reparse recipes 273 # Do reparse recipes
263 self.builder.populate_recipe_package_info_async() 274 self.builder.populate_recipe_package_info_async()
264 275
@@ -272,6 +283,7 @@ class ImageConfigurationPage (HobPage):
272 self.machine_combo.set_active(-1) 283 self.machine_combo.set_active(-1)
273 284
274 def switch_machine_combo(self): 285 def switch_machine_combo(self):
286 self.machine_combo_changed_by_manual = False
275 model = self.machine_combo.get_model() 287 model = self.machine_combo.get_model()
276 active = 0 288 active = 0
277 while active < len(model): 289 while active < len(model):
@@ -281,6 +293,16 @@ class ImageConfigurationPage (HobPage):
281 active += 1 293 active += 1
282 self.machine_combo.set_active(-1) 294 self.machine_combo.set_active(-1)
283 295
296 def update_image_desc(self, selected_image):
297 desc = ""
298 if selected_image and selected_image in self.builder.recipe_model.pn_path.keys():
299 image_path = self.builder.recipe_model.pn_path[selected_image]
300 image_iter = self.builder.recipe_model.get_iter(image_path)
301 desc = self.builder.recipe_model.get_value(image_iter, self.builder.recipe_model.COL_DESC)
302
303 mark = ("<span %s>%s</span>\n") % (self.span_tag('small'), desc)
304 self.image_desc.set_markup(mark)
305
284 def image_combo_changed_idle_cb(self, selected_image, selected_recipes, selected_packages): 306 def image_combo_changed_idle_cb(self, selected_image, selected_recipes, selected_packages):
285 self.builder.update_recipe_model(selected_image, selected_recipes) 307 self.builder.update_recipe_model(selected_image, selected_recipes)
286 self.builder.update_package_model(selected_packages) 308 self.builder.update_package_model(selected_packages)
@@ -299,9 +321,7 @@ class ImageConfigurationPage (HobPage):
299 image_path = self.builder.recipe_model.pn_path[selected_image] 321 image_path = self.builder.recipe_model.pn_path[selected_image]
300 image_iter = self.builder.recipe_model.get_iter(image_path) 322 image_iter = self.builder.recipe_model.get_iter(image_path)
301 selected_packages = self.builder.recipe_model.get_value(image_iter, self.builder.recipe_model.COL_INSTALL).split() 323 selected_packages = self.builder.recipe_model.get_value(image_iter, self.builder.recipe_model.COL_INSTALL).split()
302 324 self.update_image_desc(selected_image)
303 mark = ("<span %s>%s</span>\n") % (self.span_tag('small'), self.builder.recipe_model.get_value(image_iter, self.builder.recipe_model.COL_DESC))
304 self.image_desc.set_markup(mark)
305 325
306 self.builder.recipe_model.reset() 326 self.builder.recipe_model.reset()
307 self.builder.package_model.reset() 327 self.builder.package_model.reset()