Patchwork [bitbake-devel,PATCH_V3,10/16] hob: changes to image combo box

login
register
mail settings
Submitter Cristiana Voicu
Date July 29, 2013, 12:59 p.m.
Message ID <1375102770-14079-11-git-send-email-cristiana.voicu@intel.com>
Download mbox | patch
Permalink /patch/54713/
State New
Headers show

Comments

Cristiana Voicu - July 29, 2013, 12:59 p.m.
Added an item for the custom images.
Added a separator in the combo box.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Patch

diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
index e4c6606..8da2861 100644
--- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -35,7 +35,8 @@  from bb.ui.crumbs.hobpages import HobPage
 class ImageConfigurationPage (HobPage):
 
     __dummy_machine__ = "--select a machine--"
-    __dummy_image__   = "Select from my image recipes"
+    __dummy_image__   = "--select an image recipe--"
+    __custom_image__  = "Select from my image recipes"
 
     def __init__(self, builder):
         super(ImageConfigurationPage, self).__init__(builder, "Image configuration")
@@ -238,6 +239,7 @@  class ImageConfigurationPage (HobPage):
         self.image_title_desc.set_markup(mark)
 
         self.image_combo = gtk.combo_box_new_text()
+        self.image_combo.set_row_separator_func(self.combo_separator_func, None)
         self.image_combo_id = self.image_combo.connect("changed", self.image_combo_changed_cb)
 
         self.image_desc = gtk.Label()
@@ -256,6 +258,11 @@  class ImageConfigurationPage (HobPage):
 
         self.image_separator = gtk.HSeparator()
 
+    def combo_separator_func(self, model, iter, user_data):
+        name = model.get_value(iter, 0)
+        if name == "--Separator--":
+            return True
+
     def set_config_baseimg_layout(self):
         self.gtable.attach(self.image_title, 0, 40, 15+self.warning_shift, 17+self.warning_shift)
         self.gtable.attach(self.image_title_desc, 0, 40, 18+self.warning_shift, 22+self.warning_shift)
@@ -358,6 +365,8 @@  class ImageConfigurationPage (HobPage):
     def image_combo_changed_cb(self, combo):
         self.builder.window_sensitive(False)
         selected_image = self.image_combo.get_active_text()
+        if selected_image == self.__custom_image__:
+            return
         if not selected_image or (selected_image == self.__dummy_image__):
             return
 
@@ -424,6 +433,10 @@  class ImageConfigurationPage (HobPage):
             self.image_combo.append_text(self.__dummy_image__)
             cnt = cnt + 1
 
+        self.image_combo.append_text(self.__custom_image__)
+        self.image_combo.append_text(self.builder.recipe_model.__custom_image__)
+        self.image_combo.append_text("--Separator--")
+
         # append and set active
         while it:
             path = image_model.get_path(it)
@@ -453,7 +466,6 @@  class ImageConfigurationPage (HobPage):
                     active = cnt
                 cnt = cnt + 1
 
-        self.image_combo.append_text(self.builder.recipe_model.__custom_image__)
         if selected_image == self.builder.recipe_model.__custom_image__:
             active = cnt