Skip to contentSkip to conversation

Hob: bug-fixes (2)

PATCH New Liming An 1 participant 6 messages Jun 4, 2012

lore
Share & tools
lore

Liming An

author
#0 lore raw

cover Hob: bug-fixes (2)

Added two commits compared with the last mail sent to public:
Hob: clear the repeated function get_kernel_file_name
Hob: fix entry of recipe page can't be edited in case after clicked
clear button

The following changes since commit de4cdfd6bc1280ac7ac0559b87734d26294ef773:

documentation/kernel-manual/kernel-how-to.xml: Updated to kernel 3.4 (2012-05-31 21:16:55 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib limx/hob-bug-fixes-continue
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=limx/hob-bug-fixes-continue

Liming An (5):
Hob: clear the repeated function get_kernel_file_name
Hob: fix entry of recipe page can't be edited in case after clicked
clear button
Hob: fixed a definition not match issue when click choose directflb
in package page
Hob: Change 'run image' work flow and image detail screen as ui
design
Hob: fixed the index issue when set actived item for base image combo

 bitbake/lib/bb/ui/crumbs/builder.py                |  117 +++++------
 bitbake/lib/bb/ui/crumbs/hig.py                    |    2 +-
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py        |    3 +-
 bitbake/lib/bb/ui/crumbs/hobwidget.py              |   10 +-
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |    3 +-
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py       |  216 ++++++++++++++------
 bitbake/lib/bb/ui/crumbs/packageselectionpage.py   |    2 +-
 7 files changed, 214 insertions(+), 139 deletions(-)
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH 1/5 Hob: clear the repeated function get_kernel_file_name

there are a repeated function in builder.py and imagedetailspage.py, so combine them to one.

---
 bitbake/lib/bb/ui/crumbs/builder.py          |    5 +++--
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py |   19 +------------------
 2 files changed, 4 insertions(+), 20 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +3 -2
index 8d35ea9..899d0e0 100755
@@ -1141,9 +1141,10 @@ class Builder(gtk.Window):
         response = dialog.run()
         dialog.destroy()
 
-    def get_kernel_file_name(self, image_path):
+    def get_kernel_file_name(self):
         name_list = []
         kernel_name = ""
+        image_path = self.parameters.image_addr
         if image_path:
             files = [f for f in os.listdir(image_path) if f[0] <> '.']
             for check_file in files:
@@ -1166,7 +1167,7 @@ class Builder(gtk.Window):
             dialog.destroy()
             return
 
-        kernel_name, kernels_number = self.get_kernel_file_name(self.parameters.image_addr)
+        kernel_name, kernels_number = self.get_kernel_file_name()
         if not kernel_name or kernels_number > 1:
             dialog = gtk.FileChooserDialog("Load Kernel Files", self,
                                            gtk.FILE_CHOOSER_ACTION_SAVE)
bitbake/lib/bb/ui/crumbs/imagedetailspage.py +1 -18
index deb053c..1ab80f8 100755
@@ -368,7 +368,7 @@ class ImageDetailsPage (HobPage):
         iter = model.get_iter(path)
         image_name = model[path][0]
         if iter and model[path][2] == 'runnable':
-            kernel_name, kernel_number = self.get_kernel_file_name(image_name)
+            kernel_name, kernel_number = self.builder.parameters.get_kernel_file_name()
             self.builder.runqemu_image(image_name, kernel_name, kernel_number)
 
     def create_bottom_buttons(self, buttonlist, image_name):
@@ -446,23 +446,6 @@ class ImageDetailsPage (HobPage):
             button_id = build_new_button.connect("clicked", self.build_new_button_clicked_cb)
             self.button_ids[button_id] = build_new_button
 
-    def get_kernel_file_name(self, image_name):
-        name_list = []
-        kernel_name = ""
-        if image_name:
-            image_path = os.path.join(self.builder.parameters.image_addr)
-            files = [f for f in os.listdir(image_path) if f[0] <> '.']
-            for check_file in files:
-                if check_file.endswith(".bin"):
-                    if  self.test_mach_runnable(check_file):
-                        selected_machine = self.builder.configuration.curr_mach
-                        if selected_machine in check_file:
-                            kernel_name = check_file
-                    if not os.path.islink(os.path.join(image_path, check_file)):
-                        name_list.append(check_file)
-
-        return kernel_name, len(name_list)
-
     def save_button_clicked_cb(self, button):
         self.builder.show_save_template_dialog()
 
Signature · 1 line
1.7.5.4
author
#2 lore raw

PATCH 2/5 Hob: fix entry of recipe page can't be edited in case after clicked clear button

cancel some inviable code and fixed this issue

---
 bitbake/lib/bb/ui/crumbs/hobwidget.py |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
bitbake/lib/bb/ui/crumbs/hobwidget.py +2 -8
index bd9e2e2..afcd5b8 100644
@@ -529,14 +529,8 @@ class HobNotebook(gtk.Notebook):
         self.reset_entry(search)
 
     def set_search_entry_clear_cb(self, search, icon_pos, event):
-        self.reset_entry(search)
-
-    def set_page(self, title):
-        for child in self.tabbar.children:
-            if child["title"] == title:
-                self.tabbar.current_child = child
-                self.tabbar.grab_focus()
-                self.notebook.set_current_page(child["toggled_page"])
+        if search.get_editable() == True:
+            search.set_text("")
 
 class HobWarpCellRendererText(gtk.CellRendererText):
     def __init__(self, col_number):
Signature · 1 line
1.7.5.4
author
#3 lore raw

PATCH 3/5 Hob: fixed a definition not match issue when click choose directflb in package page

In reply to Liming An

[YOCTO #2526]

---
 bitbake/lib/bb/ui/crumbs/packageselectionpage.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
bitbake/lib/bb/ui/crumbs/packageselectionpage.py +1 -1
index d2c7325..9895835 100755
@@ -215,7 +215,7 @@ class PackageSelectionPage (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)
Signature · 1 line
1.7.5.4
author
#4 lore raw

PATCH 4/5 Hob: Change 'run image' work flow and image detail screen as ui design

In reply to Liming An

Added the qemu_image_kernel selection view box to image detail screen GUI, and changed the 'run image' button clicked work flow.

[YOCTO #2155]

---
 bitbake/lib/bb/ui/crumbs/builder.py          |  118 +++++++---------
 bitbake/lib/bb/ui/crumbs/hig.py              |    2 +-
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py  |    3 +-
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py |  201 ++++++++++++++++++++------
 4 files changed, 211 insertions(+), 113 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +51 -67
index 899d0e0..ab336d3 100755
@@ -300,6 +300,7 @@ class Parameters:
         self.tmpdir = params["tmpdir"]
         self.image_white_pattern = params["image_white_pattern"]
         self.image_black_pattern = params["image_black_pattern"]
+        self.kernel_image_type = params["kernel_image_type"]
         # for build log to show
         self.bb_version = params["bb_version"]
         self.target_arch = params["target_arch"]
@@ -1141,25 +1142,32 @@ class Builder(gtk.Window):
         response = dialog.run()
         dialog.destroy()
 
-    def get_kernel_file_name(self):
-        name_list = []
-        kernel_name = ""
-        image_path = self.parameters.image_addr
-        if image_path:
-            files = [f for f in os.listdir(image_path) if f[0] <> '.']
-            for check_file in files:
-                if check_file.endswith(".bin"):
-                    name_splits = check_file.split(".")[0]
-                    if self.configuration.curr_mach in name_splits.split("-"):
-                        kernel_name = check_file
-                    if not os.path.islink(os.path.join(image_path, check_file)):
-                        name_list.append(check_file)
-
-        return kernel_name, len(name_list)
-
-    def runqemu_image(self, image_name):
-        if not image_name:
-            lbl = "<b>Please select an image to launch in QEMU.</b>"
+    def show_load_kernel_dialog(self):
+        dialog = gtk.FileChooserDialog("Load Kernel Files", self,
+                                       gtk.FILE_CHOOSER_ACTION_SAVE)
+        button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
+        HobAltButton.style_button(button)
+        button = dialog.add_button("Open", gtk.RESPONSE_YES)
+        HobButton.style_button(button)
+        filter = gtk.FileFilter()
+        filter.set_name("Kernel Files")
+        filter.add_pattern("*.bin")
+        dialog.add_filter(filter)
+
+        dialog.set_current_folder(self.parameters.image_addr)
+
+        response = dialog.run()
+        kernel_path = ""
+        if response == gtk.RESPONSE_YES:
+            kernel_path = dialog.get_filename()
+
+        dialog.destroy()
+
+        return kernel_path
+
+    def runqemu_image(self, image_name, kernel_name):
+        if not image_name or not kernel_name:
+            lbl = "<b>Please select an %s to launch in QEMU.</b>" % ("kernel" if image_name else "image")
             dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
             button = dialog.add_button("Close", gtk.RESPONSE_OK)
             HobButton.style_button(button)
@@ -1167,57 +1175,33 @@ class Builder(gtk.Window):
             dialog.destroy()
             return
 
-        kernel_name, kernels_number = self.get_kernel_file_name()
-        if not kernel_name or kernels_number > 1:
-            dialog = gtk.FileChooserDialog("Load Kernel Files", self,
-                                           gtk.FILE_CHOOSER_ACTION_SAVE)
-            button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
-            HobAltButton.style_button(button)
-            button = dialog.add_button("Open", gtk.RESPONSE_YES)
-            HobButton.style_button(button)
-            filter = gtk.FileFilter()
-            filter.set_name("Kernel Files")
-            filter.add_pattern("*.bin")
-            dialog.add_filter(filter)
-
-            dialog.set_current_folder(self.parameters.image_addr)
+        kernel_path = os.path.join(self.parameters.image_addr, kernel_name)
+        image_path = os.path.join(self.parameters.image_addr, image_name)
 
-            response = dialog.run()
-            if response == gtk.RESPONSE_YES:
-                kernel_path = dialog.get_filename()
-                image_path = os.path.join(self.parameters.image_addr, image_name)
+        source_env_path = os.path.join(self.parameters.core_base, "oe-init-build-env")
+        tmp_path = self.parameters.tmpdir
+        cmdline = bb.ui.crumbs.utils.which_terminal()
+        if os.path.exists(image_path) and os.path.exists(kernel_path) \
+           and os.path.exists(source_env_path) and os.path.exists(tmp_path) \
+           and cmdline:
+            cmdline += "\' bash -c \"export OE_TMPDIR=" + tmp_path + "; "
+            cmdline += "source " + source_env_path + " " + os.getcwd() + "; "
+            cmdline += "runqemu " + kernel_path + " " + image_path + "\"\'"
+            subprocess.Popen(shlex.split(cmdline))
+        else:
+            lbl = "<b>Path error</b>\nOne of your paths is wrong,"
+            lbl = lbl + " please make sure the following paths exist:\n"
+            lbl = lbl + "image path:" + image_path + "\n"
+            lbl = lbl + "kernel path:" + kernel_path + "\n"
+            lbl = lbl + "source environment path:" + source_env_path + "\n"
+            lbl = lbl + "tmp path: " + tmp_path + "."
+            lbl = lbl + "You may be missing either xterm or vte for terminal services."
+            dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
+            button = dialog.add_button("Close", gtk.RESPONSE_OK)
+            HobButton.style_button(button)
+            dialog.run()
             dialog.destroy()
 
-        elif kernel_name:
-            kernel_path = os.path.join(self.parameters.image_addr, kernel_name)
-            image_path = os.path.join(self.parameters.image_addr, image_name)
-            response = gtk.RESPONSE_YES
-
-        if response == gtk.RESPONSE_YES:
-            source_env_path = os.path.join(self.parameters.core_base, "oe-init-build-env")
-            tmp_path = self.parameters.tmpdir
-            cmdline = bb.ui.crumbs.utils.which_terminal()
-            if os.path.exists(image_path) and os.path.exists(kernel_path) \
-               and os.path.exists(source_env_path) and os.path.exists(tmp_path) \
-               and cmdline:
-                cmdline += "\' bash -c \"export OE_TMPDIR=" + tmp_path + "; "
-                cmdline += "source " + source_env_path + " " + os.getcwd() + "; "
-                cmdline += "runqemu " + kernel_path + " " + image_path + "\"\'"
-                subprocess.Popen(shlex.split(cmdline))
-            else:
-                lbl = "<b>Path error</b>\nOne of your paths is wrong,"
-                lbl = lbl + " please make sure the following paths exist:\n"
-                lbl = lbl + "image path:" + image_path + "\n"
-                lbl = lbl + "kernel path:" + kernel_path + "\n"
-                lbl = lbl + "source environment path:" + source_env_path + "\n"
-                lbl = lbl + "tmp path: " + tmp_path + "."
-                lbl = lbl + "You may be missing either xterm or vte for terminal services."
-                dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
-                button = dialog.add_button("Close", gtk.RESPONSE_OK)
-                HobButton.style_button(button)
-                dialog.run()
-                dialog.destroy()
-
     def show_packages(self, ask=True):
         _, selected_recipes = self.recipe_model.get_selected_recipes()
         if selected_recipes and ask:
bitbake/lib/bb/ui/crumbs/hig.py +1 -1
index 7c9e73f..f64f1be 100644
@@ -1210,7 +1210,7 @@ class ImageSelectionDialog (CrumbsDialog):
                         if f.endswith('.' + real_image_type):
                             imageset.add(f.rsplit('.' + real_image_type)[0].rsplit('.rootfs')[0])
                             self.image_list.append(f)
-        
+
         for image in imageset:
             self.image_store.set(self.image_store.append(), 0, image, 1, False)
 
bitbake/lib/bb/ui/crumbs/hobeventhandler.py +2 -1
index 1db9c44..a00fcd8 100644
@@ -347,7 +347,7 @@ class HobHandler(gobject.GObject):
         self.commands_async.append(self.SUB_PARSE_CONFIG)
         self.commands_async.append(self.SUB_GNERATE_TGTS)
         self.run_next_command(self.GENERATE_RECIPES)
-                 
+
     def generate_packages(self, tgts, default_task="build"):
         targets = []
         targets.extend(tgts)
@@ -492,6 +492,7 @@ class HobHandler(gobject.GObject):
         params["runnable_image_types"] = self._remove_redundant(self.runCommand(["getVariable", "RUNNABLE_IMAGE_TYPES"]) or "")
         params["runnable_machine_patterns"] = self._remove_redundant(self.runCommand(["getVariable", "RUNNABLE_MACHINE_PATTERNS"]) or "")
         params["deployable_image_types"] = self._remove_redundant(self.runCommand(["getVariable", "DEPLOYABLE_IMAGE_TYPES"]) or "")
+        params["kernel_image_type"] = self.runCommand(["getVariable", "KERNEL_IMAGETYPE"]) or ""
         params["tmpdir"] = self.runCommand(["getVariable", "TMPDIR"]) or ""
         params["distro_version"] = self.runCommand(["getVariable", "DISTRO_VERSION"]) or ""
         params["target_os"] = self.runCommand(["getVariable", "TARGET_OS"]) or ""
bitbake/lib/bb/ui/crumbs/imagedetailspage.py +157 -44

342 lines not on this page · raw message

Signature · 1 line
1.7.5.4
author
#5 lore raw

PATCH 5/5 Hob: fixed the index issue when set actived item for base image combo

In reply to Liming An

The combo item index dosn't be increased as the insert a dummy item, when execute the upadate base image combo operation.

[YOCTO #2500]

---
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +1 -2
index b5f0a5a..80332fe 100644
@@ -364,7 +364,7 @@ class ImageConfigurationPage (HobPage):
         filter = {RecipeListModel.COL_TYPE : ['image']}
         image_model = recipe_model.tree_model(filter)
         active = 0
-        cnt = 0
+        cnt = 1
 
         white_pattern = []
         if self.builder.parameters.image_white_pattern:
@@ -415,7 +415,6 @@ class ImageConfigurationPage (HobPage):
         if selected_image == self.builder.recipe_model.__custom_image__:
             active = cnt
 
-        self.image_combo.set_active(0)
         self.image_combo.set_active(active)
 
         if active != 0:
Signature · 1 line
1.7.5.4