[bitbake-devel] [PATCH 7/9] Hob: runqemu and deployment functionality filter

Dongxiao Xu dongxiao.xu at intel.com
Sat Mar 24 11:49:25 UTC 2012


Implement the filter for runqemu and deployment functionality.

runqemu
1) suffix should be in the list of RUNNABLE_IMAGE_TYPES.
2) machine should match the pattern of RUNNABLE_MACHINE_PATTERNS.

deployment:
1) suffix should be in the list of DEPLOYMENT_IMAGE_TYPES.

Signed-off-by: Dongxiao Xu <dongxiao.xu at intel.com>
---
 lib/bb/ui/crumbs/builder.py          |    3 ++
 lib/bb/ui/crumbs/hobeventhandler.py  |    4 +++
 lib/bb/ui/crumbs/imagedetailspage.py |   44 +++++++++++++++++++++++++--------
 3 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
index d348497..2984490 100755
--- a/lib/bb/ui/crumbs/builder.py
+++ b/lib/bb/ui/crumbs/builder.py
@@ -135,6 +135,9 @@ class Parameters:
         self.image_names = []
         self.image_addr = params["image_addr"]
         self.image_types = params["image_types"].split()
+        self.runnable_image_types = params["runnable_image_types"].split()
+        self.runnable_machine_patterns = params["runnable_machine_patterns"].split()
+        self.deployable_image_types = params["deployable_image_types"].split()
 
 class Builder(gtk.Window):
 
diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
index ec3e0ef..4b8aabc 100644
--- a/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/lib/bb/ui/crumbs/hobeventhandler.py
@@ -434,4 +434,8 @@ class HobHandler(gobject.GObject):
 
         params["conf_version"] = self.server.runCommand(["getVariable", "CONF_VERSION"]) or ""
         params["lconf_version"] = self.server.runCommand(["getVariable", "LCONF_VERSION"]) or ""
+
+        params["runnable_image_types"] = self.server.runCommand(["getVariable", "RUNNABLE_IMAGE_TYPES"]) or ""
+        params["runnable_machine_patterns"] = self.server.runCommand(["getVariable", "RUNNABLE_MACHINE_PATTERNS"]) or ""
+        params["deployable_image_types"] = self.server.runCommand(["getVariable", "DEPLOYABLE_IMAGE_TYPES"]) or ""
         return params
diff --git a/lib/bb/ui/crumbs/imagedetailspage.py b/lib/bb/ui/crumbs/imagedetailspage.py
index 07a6eb0..5a5ec3f 100755
--- a/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/lib/bb/ui/crumbs/imagedetailspage.py
@@ -183,7 +183,6 @@ class ImageDetailsPage (HobPage):
             self.image_store.set(self.image_store.append(), 0, image_name, 1, image_size, 2, False)
         image_table = HobViewTable(self.__columns__)
         image_table.set_model(self.image_store)
-        image_table.toggle_default()
         image_size = self._size_to_string(os.stat(os.path.join(image_addr, image_names[0])).st_size)
         image_table.connect("toggled", self.toggled_cb)
         view_files_button = gtk.LinkButton("file://%s" % image_addr, "View files")
@@ -256,6 +255,29 @@ class ImageDetailsPage (HobPage):
         model[path][columnid] = True
         self.refresh_package_detail_box(model[path][1])
 
+        type_runnable = False
+        mach_runnable = False
+        image_name = model[path][0]
+        for t in self.builder.parameters.runnable_image_types:
+            if image_name.endswith(t):
+                type_runnable = True
+                break
+
+        for t in self.builder.parameters.runnable_machine_patterns:
+            if t in image_name:
+                mach_runnable = True
+                break
+
+        self.run_button.set_sensitive(type_runnable and mach_runnable)
+
+        deployable = False
+        for t in self.builder.parameters.deployable_image_types:
+            if image_name.endswith(t):
+                deployable = True
+                break
+
+        self.deploy_button.set_sensitive(deployable)
+
     def create_bottom_buttons(self, buttonlist):
         # Create the buttons at the bottom
         bottom_buttons = gtk.HBox(False, 6)
@@ -264,13 +286,13 @@ class ImageDetailsPage (HobPage):
         # create button "Deploy image"
         name = "Deploy image"
         if name in buttonlist:
-            deploy_button = HobButton('Deploy image')
-            deploy_button.set_size_request(205, 49)
-            deploy_button.set_tooltip_text("Deploy image to get your target board")
-            deploy_button.set_flags(gtk.CAN_DEFAULT)
-            deploy_button.grab_default()
-            deploy_button.connect("clicked", self.deploy_button_clicked_cb)
-            bottom_buttons.pack_end(deploy_button, expand=False, fill=False)
+            self.deploy_button = HobButton('Deploy image')
+            self.deploy_button.set_size_request(205, 49)
+            self.deploy_button.set_tooltip_text("Deploy image to get your target board")
+            self.deploy_button.set_flags(gtk.CAN_DEFAULT)
+            self.deploy_button.grab_default()
+            self.deploy_button.connect("clicked", self.deploy_button_clicked_cb)
+            bottom_buttons.pack_end(self.deploy_button, expand=False, fill=False)
             created = True
 
         name = "Run image"
@@ -281,9 +303,9 @@ class ImageDetailsPage (HobPage):
                 bottom_buttons.pack_end(label, expand=False, fill=False)
 
             # create button "Run image"
-            run_button = HobAltButton("Run image")
-            run_button.connect("clicked", self.run_button_clicked_cb)
-            bottom_buttons.pack_end(run_button, expand=False, fill=False)
+            self.run_button = HobAltButton("Run image")
+            self.run_button.connect("clicked", self.run_button_clicked_cb)
+            bottom_buttons.pack_end(self.run_button, expand=False, fill=False)
             created = True
 
         name = "Save as template"
-- 
1.7.4.1





More information about the bitbake-devel mailing list