diff options
author | Liming An <limingx.l.an@intel.com> | 2012-05-21 22:41:20 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-22 14:56:17 +0100 |
commit | 39a9267dee0a0ee4d87ed51d4a0272549c462b02 (patch) | |
tree | 225d38aa8b79fc8245dc6d559fcd70db8918ee94 /bitbake/lib/bb/ui | |
parent | 532f96ddcc2e3641db25b08d4ca93ce4d196a984 (diff) | |
download | poky-39a9267dee0a0ee4d87ed51d4a0272549c462b02.tar.gz |
Hob: add '--select a machine--' and '--select a base image--' to GUI
[YOCTO #2175]
(Bitbake rev: 2729729012f035043fedc5098be2ec12b761166d)
Signed-off-by: Liming An <limingx.l.an@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/builder.py | 6 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hoblistmodel.py | 6 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py | 43 | ||||
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/recipeselectionpage.py | 2 |
4 files changed, 39 insertions, 18 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py index 18191df8dd..44d626c261 100755 --- a/bitbake/lib/bb/ui/crumbs/builder.py +++ b/bitbake/lib/bb/ui/crumbs/builder.py | |||
@@ -508,7 +508,7 @@ class Builder(gtk.Window): | |||
508 | toolchain_packages = [] | 508 | toolchain_packages = [] |
509 | if self.configuration.toolchain_build: | 509 | if self.configuration.toolchain_build: |
510 | toolchain_packages = self.package_model.get_selected_packages_toolchain() | 510 | toolchain_packages = self.package_model.get_selected_packages_toolchain() |
511 | if self.configuration.selected_image == self.recipe_model.__dummy_image__: | 511 | if self.configuration.selected_image == self.recipe_model.__custom_image__: |
512 | packages = self.package_model.get_selected_packages() | 512 | packages = self.package_model.get_selected_packages() |
513 | image = self.hob_image | 513 | image = self.hob_image |
514 | else: | 514 | else: |
@@ -827,7 +827,7 @@ class Builder(gtk.Window): | |||
827 | fraction = 1.0 | 827 | fraction = 1.0 |
828 | self.parameters.image_names = [] | 828 | self.parameters.image_names = [] |
829 | selected_image = self.recipe_model.get_selected_image() | 829 | selected_image = self.recipe_model.get_selected_image() |
830 | if selected_image == self.recipe_model.__dummy_image__: | 830 | if selected_image == self.recipe_model.__custom_image__: |
831 | linkname = 'hob-image-' + self.configuration.curr_mach | 831 | linkname = 'hob-image-' + self.configuration.curr_mach |
832 | else: | 832 | else: |
833 | linkname = selected_image + '-' + self.configuration.curr_mach | 833 | linkname = selected_image + '-' + self.configuration.curr_mach |
@@ -965,7 +965,7 @@ class Builder(gtk.Window): | |||
965 | selected_packages = self.package_model.get_selected_packages() or [] | 965 | selected_packages = self.package_model.get_selected_packages() or [] |
966 | 966 | ||
967 | # If no base image and no selected packages don't build anything | 967 | # If no base image and no selected packages don't build anything |
968 | if not (selected_packages or selected_image != self.recipe_model.__dummy_image__): | 968 | if not (selected_packages or selected_image != self.recipe_model.__custom_image__): |
969 | lbl = "<b>No selections made</b>\nYou have not made any selections" | 969 | lbl = "<b>No selections made</b>\nYou have not made any selections" |
970 | lbl = lbl + " so there isn't anything to bake at this time." | 970 | lbl = lbl + " so there isn't anything to bake at this time." |
971 | dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) | 971 | dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) |
diff --git a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py index 0b54f91a12..37cee78325 100644 --- a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py +++ b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py | |||
@@ -456,7 +456,7 @@ class RecipeListModel(gtk.ListStore): | |||
456 | """ | 456 | """ |
457 | (COL_NAME, COL_DESC, COL_LIC, COL_GROUP, COL_DEPS, COL_BINB, COL_TYPE, COL_INC, COL_IMG, COL_INSTALL, COL_PN, COL_FADE_INC) = range(12) | 457 | (COL_NAME, COL_DESC, COL_LIC, COL_GROUP, COL_DEPS, COL_BINB, COL_TYPE, COL_INC, COL_IMG, COL_INSTALL, COL_PN, COL_FADE_INC) = range(12) |
458 | 458 | ||
459 | __dummy_image__ = "Create your own image" | 459 | __custom_image__ = "Create your own image" |
460 | 460 | ||
461 | __gsignals__ = { | 461 | __gsignals__ = { |
462 | "recipe-selection-changed" : (gobject.SIGNAL_RUN_LAST, | 462 | "recipe-selection-changed" : (gobject.SIGNAL_RUN_LAST, |
@@ -565,14 +565,14 @@ class RecipeListModel(gtk.ListStore): | |||
565 | self.clear() | 565 | self.clear() |
566 | 566 | ||
567 | # dummy image for prompt | 567 | # dummy image for prompt |
568 | self.set(self.append(), self.COL_NAME, self.__dummy_image__, | 568 | self.set(self.append(), self.COL_NAME, self.__custom_image__, |
569 | self.COL_DESC, "Use the 'View recipes' and 'View packages' " \ | 569 | self.COL_DESC, "Use the 'View recipes' and 'View packages' " \ |
570 | "options to select what you want to include " \ | 570 | "options to select what you want to include " \ |
571 | "in your image.", | 571 | "in your image.", |
572 | self.COL_LIC, "", self.COL_GROUP, "", | 572 | self.COL_LIC, "", self.COL_GROUP, "", |
573 | self.COL_DEPS, "", self.COL_BINB, "", | 573 | self.COL_DEPS, "", self.COL_BINB, "", |
574 | self.COL_TYPE, "image", self.COL_INC, False, | 574 | self.COL_TYPE, "image", self.COL_INC, False, |
575 | self.COL_IMG, False, self.COL_INSTALL, "", self.COL_PN, self.__dummy_image__) | 575 | self.COL_IMG, False, self.COL_INSTALL, "", self.COL_PN, self.__custom_image__) |
576 | 576 | ||
577 | for item in event_model["pn"]: | 577 | for item in event_model["pn"]: |
578 | name = item | 578 | name = item |
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() |
diff --git a/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py b/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py index 7c1ecdd965..ece37e065b 100755 --- a/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py +++ b/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py | |||
@@ -222,7 +222,7 @@ class RecipeSelectionPage (HobPage): | |||
222 | self.refresh_selection() | 222 | self.refresh_selection() |
223 | if not self.builder.customized: | 223 | if not self.builder.customized: |
224 | self.builder.customized = True | 224 | self.builder.customized = True |
225 | self.builder.configuration.selected_image = self.recipe_model.__dummy_image__ | 225 | self.builder.configuration.selected_image = self.recipe_model.__custom_image__ |
226 | self.builder.rcppkglist_populated() | 226 | self.builder.rcppkglist_populated() |
227 | 227 | ||
228 | self.builder.window_sensitive(True) | 228 | self.builder.window_sensitive(True) |