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>
This commit is contained in:
Liming An 2012-05-21 22:41:20 +08:00 committed by Richard Purdie
parent 532f96ddcc
commit 39a9267dee
4 changed files with 39 additions and 18 deletions

View File

@ -508,7 +508,7 @@ class Builder(gtk.Window):
toolchain_packages = []
if self.configuration.toolchain_build:
toolchain_packages = self.package_model.get_selected_packages_toolchain()
if self.configuration.selected_image == self.recipe_model.__dummy_image__:
if self.configuration.selected_image == self.recipe_model.__custom_image__:
packages = self.package_model.get_selected_packages()
image = self.hob_image
else:
@ -827,7 +827,7 @@ class Builder(gtk.Window):
fraction = 1.0
self.parameters.image_names = []
selected_image = self.recipe_model.get_selected_image()
if selected_image == self.recipe_model.__dummy_image__:
if selected_image == self.recipe_model.__custom_image__:
linkname = 'hob-image-' + self.configuration.curr_mach
else:
linkname = selected_image + '-' + self.configuration.curr_mach
@ -965,7 +965,7 @@ class Builder(gtk.Window):
selected_packages = self.package_model.get_selected_packages() or []
# If no base image and no selected packages don't build anything
if not (selected_packages or selected_image != self.recipe_model.__dummy_image__):
if not (selected_packages or selected_image != self.recipe_model.__custom_image__):
lbl = "<b>No selections made</b>\nYou have not made any selections"
lbl = lbl + " so there isn't anything to bake at this time."
dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)

View File

@ -456,7 +456,7 @@ class RecipeListModel(gtk.ListStore):
"""
(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)
__dummy_image__ = "Create your own image"
__custom_image__ = "Create your own image"
__gsignals__ = {
"recipe-selection-changed" : (gobject.SIGNAL_RUN_LAST,
@ -565,14 +565,14 @@ class RecipeListModel(gtk.ListStore):
self.clear()
# dummy image for prompt
self.set(self.append(), self.COL_NAME, self.__dummy_image__,
self.set(self.append(), self.COL_NAME, self.__custom_image__,
self.COL_DESC, "Use the 'View recipes' and 'View packages' " \
"options to select what you want to include " \
"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.__dummy_image__)
self.COL_IMG, False, self.COL_INSTALL, "", self.COL_PN, self.__custom_image__)
for item in event_model["pn"]:
name = item

View File

@ -34,6 +34,9 @@ from bb.ui.crumbs.hobpages import HobPage
#
class ImageConfigurationPage (HobPage):
__dummy_machine__ = "--select a machine--"
__dummy_image__ = "--select a base image--"
def __init__(self, builder):
super(ImageConfigurationPage, self).__init__(builder, "Image configuration")
@ -260,9 +263,15 @@ class ImageConfigurationPage (HobPage):
def machine_combo_changed_cb(self, machine_combo):
combo_item = machine_combo.get_active_text()
if not combo_item:
if not combo_item or combo_item == self.__dummy_machine__:
return
# remove __dummy_machine__ item from the store list after first user selection
# because it is no longer valid
combo_store = machine_combo.get_model()
if len(combo_store) and (combo_store[0][0] == self.__dummy_machine__):
machine_combo.remove_text(0)
self.builder.configuration.curr_mach = combo_item
if self.machine_combo_changed_by_manual:
self.builder.configuration.clear_selection()
@ -273,13 +282,13 @@ class ImageConfigurationPage (HobPage):
self.builder.populate_recipe_package_info_async()
def update_machine_combo(self):
all_machines = self.builder.parameters.all_machines
all_machines = [self.__dummy_machine__] + self.builder.parameters.all_machines
model = self.machine_combo.get_model()
model.clear()
for machine in all_machines:
self.machine_combo.append_text(machine)
self.machine_combo.set_active(-1)
self.machine_combo.set_active(0)
def switch_machine_combo(self):
self.machine_combo_changed_by_manual = False
@ -290,7 +299,11 @@ class ImageConfigurationPage (HobPage):
self.machine_combo.set_active(active)
return
active += 1
self.machine_combo.set_active(-1)
if model[0][0] != self.__dummy_machine__:
self.machine_combo.insert_text(0, self.__dummy_machine__)
self.machine_combo.set_active(0)
def update_image_desc(self):
desc = ""
@ -311,9 +324,15 @@ class ImageConfigurationPage (HobPage):
def image_combo_changed_cb(self, combo):
self.builder.window_sensitive(False)
selected_image = self.image_combo.get_active_text()
if not selected_image:
if not selected_image or (selected_image == self.__dummy_image__):
return
# remove __dummy_image__ item from the store list after first user selection
# because it is no longer valid
combo_store = combo.get_model()
if len(combo_store) and (combo_store[0][0] == self.__dummy_image__):
combo.remove_text(0)
self.builder.customized = False
selected_recipes = []
@ -344,7 +363,7 @@ class ImageConfigurationPage (HobPage):
# populate image combo
filter = {RecipeListModel.COL_TYPE : ['image']}
image_model = recipe_model.tree_model(filter)
active = -1
active = 0
cnt = 0
white_pattern = []
@ -361,12 +380,14 @@ class ImageConfigurationPage (HobPage):
self._image_combo_disconnect_signal()
model = self.image_combo.get_model()
model.clear()
# Set a indicator text to combo store when first open
self.image_combo.append_text(self.__dummy_image__)
# append and set active
while it:
path = image_model.get_path(it)
it = image_model.iter_next(it)
image_name = image_model[path][recipe_model.COL_NAME]
if image_name == self.builder.recipe_model.__dummy_image__:
if image_name == self.builder.recipe_model.__custom_image__:
continue
if black_pattern:
@ -390,14 +411,14 @@ class ImageConfigurationPage (HobPage):
active = cnt
cnt = cnt + 1
self.image_combo.append_text(self.builder.recipe_model.__dummy_image__)
if selected_image == self.builder.recipe_model.__dummy_image__:
self.image_combo.append_text(self.builder.recipe_model.__custom_image__)
if selected_image == self.builder.recipe_model.__custom_image__:
active = cnt
self.image_combo.set_active(-1)
self.image_combo.set_active(0)
self.image_combo.set_active(active)
if active != -1:
if active != 0:
self.show_baseimg_selected()
self._image_combo_connect_signal()

View File

@ -222,7 +222,7 @@ class RecipeSelectionPage (HobPage):
self.refresh_selection()
if not self.builder.customized:
self.builder.customized = True
self.builder.configuration.selected_image = self.recipe_model.__dummy_image__
self.builder.configuration.selected_image = self.recipe_model.__custom_image__
self.builder.rcppkglist_populated()
self.builder.window_sensitive(True)