diff options
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py index c33474bb95..931e55b2ad 100644 --- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py | |||
@@ -34,6 +34,9 @@ from bb.ui.crumbs.hobpages import HobPage | |||
34 | # | 34 | # |
35 | class ImageConfigurationPage (HobPage): | 35 | class ImageConfigurationPage (HobPage): |
36 | 36 | ||
37 | __dummy_machine__ = "--select a machine--" | ||
38 | __dummy_image__ = "--select a base image--" | ||
39 | |||
37 | def __init__(self, builder): | 40 | def __init__(self, builder): |
38 | super(ImageConfigurationPage, self).__init__(builder, "Image configuration") | 41 | super(ImageConfigurationPage, self).__init__(builder, "Image configuration") |
39 | 42 | ||
@@ -260,9 +263,15 @@ class ImageConfigurationPage (HobPage): | |||
260 | 263 | ||
261 | def machine_combo_changed_cb(self, machine_combo): | 264 | def machine_combo_changed_cb(self, machine_combo): |
262 | combo_item = machine_combo.get_active_text() | 265 | combo_item = machine_combo.get_active_text() |
263 | if not combo_item: | 266 | if not combo_item or combo_item == self.__dummy_machine__: |
264 | return | 267 | return |
265 | 268 | ||
269 | # remove __dummy_machine__ item from the store list after first user selection | ||
270 | # because it is no longer valid | ||
271 | combo_store = machine_combo.get_model() | ||
272 | if len(combo_store) and (combo_store[0][0] == self.__dummy_machine__): | ||
273 | machine_combo.remove_text(0) | ||
274 | |||
266 | self.builder.configuration.curr_mach = combo_item | 275 | self.builder.configuration.curr_mach = combo_item |
267 | if self.machine_combo_changed_by_manual: | 276 | if self.machine_combo_changed_by_manual: |
268 | self.builder.configuration.clear_selection() | 277 | self.builder.configuration.clear_selection() |
@@ -273,13 +282,13 @@ class ImageConfigurationPage (HobPage): | |||
273 | self.builder.populate_recipe_package_info_async() | 282 | self.builder.populate_recipe_package_info_async() |
274 | 283 | ||
275 | def update_machine_combo(self): | 284 | def update_machine_combo(self): |
276 | all_machines = self.builder.parameters.all_machines | 285 | all_machines = [self.__dummy_machine__] + self.builder.parameters.all_machines |
277 | 286 | ||
278 | model = self.machine_combo.get_model() | 287 | model = self.machine_combo.get_model() |
279 | model.clear() | 288 | model.clear() |
280 | for machine in all_machines: | 289 | for machine in all_machines: |
281 | self.machine_combo.append_text(machine) | 290 | self.machine_combo.append_text(machine) |
282 | self.machine_combo.set_active(-1) | 291 | self.machine_combo.set_active(0) |
283 | 292 | ||
284 | def switch_machine_combo(self): | 293 | def switch_machine_combo(self): |
285 | self.machine_combo_changed_by_manual = False | 294 | self.machine_combo_changed_by_manual = False |
@@ -290,7 +299,11 @@ class ImageConfigurationPage (HobPage): | |||
290 | self.machine_combo.set_active(active) | 299 | self.machine_combo.set_active(active) |
291 | return | 300 | return |
292 | active += 1 | 301 | active += 1 |
293 | self.machine_combo.set_active(-1) | 302 | |
303 | if model[0][0] != self.__dummy_machine__: | ||
304 | self.machine_combo.insert_text(0, self.__dummy_machine__) | ||
305 | |||
306 | self.machine_combo.set_active(0) | ||
294 | 307 | ||
295 | def update_image_desc(self): | 308 | def update_image_desc(self): |
296 | desc = "" | 309 | desc = "" |
@@ -311,9 +324,15 @@ class ImageConfigurationPage (HobPage): | |||
311 | def image_combo_changed_cb(self, combo): | 324 | def image_combo_changed_cb(self, combo): |
312 | self.builder.window_sensitive(False) | 325 | self.builder.window_sensitive(False) |
313 | selected_image = self.image_combo.get_active_text() | 326 | selected_image = self.image_combo.get_active_text() |
314 | if not selected_image: | 327 | if not selected_image or (selected_image == self.__dummy_image__): |
315 | return | 328 | return |
316 | 329 | ||
330 | # remove __dummy_image__ item from the store list after first user selection | ||
331 | # because it is no longer valid | ||
332 | combo_store = combo.get_model() | ||
333 | if len(combo_store) and (combo_store[0][0] == self.__dummy_image__): | ||
334 | combo.remove_text(0) | ||
335 | |||
317 | self.builder.customized = False | 336 | self.builder.customized = False |
318 | 337 | ||
319 | selected_recipes = [] | 338 | selected_recipes = [] |
@@ -344,7 +363,7 @@ class ImageConfigurationPage (HobPage): | |||
344 | # populate image combo | 363 | # populate image combo |
345 | filter = {RecipeListModel.COL_TYPE : ['image']} | 364 | filter = {RecipeListModel.COL_TYPE : ['image']} |
346 | image_model = recipe_model.tree_model(filter) | 365 | image_model = recipe_model.tree_model(filter) |
347 | active = -1 | 366 | active = 0 |
348 | cnt = 0 | 367 | cnt = 0 |
349 | 368 | ||
350 | white_pattern = [] | 369 | white_pattern = [] |
@@ -361,12 +380,14 @@ class ImageConfigurationPage (HobPage): | |||
361 | self._image_combo_disconnect_signal() | 380 | self._image_combo_disconnect_signal() |
362 | model = self.image_combo.get_model() | 381 | model = self.image_combo.get_model() |
363 | model.clear() | 382 | model.clear() |
383 | # Set a indicator text to combo store when first open | ||
384 | self.image_combo.append_text(self.__dummy_image__) | ||
364 | # append and set active | 385 | # append and set active |
365 | while it: | 386 | while it: |
366 | path = image_model.get_path(it) | 387 | path = image_model.get_path(it) |
367 | it = image_model.iter_next(it) | 388 | it = image_model.iter_next(it) |
368 | image_name = image_model[path][recipe_model.COL_NAME] | 389 | image_name = image_model[path][recipe_model.COL_NAME] |
369 | if image_name == self.builder.recipe_model.__dummy_image__: | 390 | if image_name == self.builder.recipe_model.__custom_image__: |
370 | continue | 391 | continue |
371 | 392 | ||
372 | if black_pattern: | 393 | if black_pattern: |
@@ -390,14 +411,14 @@ class ImageConfigurationPage (HobPage): | |||
390 | active = cnt | 411 | active = cnt |
391 | cnt = cnt + 1 | 412 | cnt = cnt + 1 |
392 | 413 | ||
393 | self.image_combo.append_text(self.builder.recipe_model.__dummy_image__) | 414 | self.image_combo.append_text(self.builder.recipe_model.__custom_image__) |
394 | if selected_image == self.builder.recipe_model.__dummy_image__: | 415 | if selected_image == self.builder.recipe_model.__custom_image__: |
395 | active = cnt | 416 | active = cnt |
396 | 417 | ||
397 | self.image_combo.set_active(-1) | 418 | self.image_combo.set_active(0) |
398 | self.image_combo.set_active(active) | 419 | self.image_combo.set_active(active) |
399 | 420 | ||
400 | if active != -1: | 421 | if active != 0: |
401 | self.show_baseimg_selected() | 422 | self.show_baseimg_selected() |
402 | 423 | ||
403 | self._image_combo_connect_signal() | 424 | self._image_combo_connect_signal() |