Skip to contentSkip to conversation

Hob fixes and cleanups

PATCH Superseded Shane Wang 1 participant 22 messages Apr 8, 2012 – Apr 9, 2012 Arm STM32

lore
Share & tools
lore

Shane Wang

author
#0 lore raw

cover Hob fixes and cleanups

Those patches fix the following:
- the UI bug to fade out the entry in the "Included" page when it is removed
- add and correct tooltips reviewed by Scott
- clean up the code and maximize reusage, for exception handling
- change the logic after recipe/package are populated
- misc

The following changes since commit 190f6d791d51aaa4cfb9f1cf932bc205ff674fb5:

runqemu-internal: Add console=tty for qemuppc and NFS (2012-04-06 01:12:47 +0100)

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

Liming An (3):
Hob: add fadeout display effection for recipe view include page
Hob: add fadeout display effection for package view include page
Hob: Add the tooltips for recipe view page as request

Shane Wang (17):
Hob: fix version check - Hob can run on pygtk 2.21.0
Hob: correct indent
Hob: clean up and unify the steps for new build to call
initiate_new_build_async()
Hob: clean up and unify the steps for CONFIG_UPDATE to call
update_config_async()
Hob: clean up and unify the steps for RCPPKGINFO_POPULATING to call
populate_recipe_package_info_async()
Hob: clean up and unify the steps for PACKAGE_GENERATING and
FAST_IMAGE_GENERATING to call generate_packages_async() and fast_generate_image_async()
Hob: clean up and unify the steps for IMAGE_GENERATING to call
generate_image_async()
Hob: clean up to call clear_busy() in hobeventhandler.py
Hob: clean up and unify get_parameters() to be get_parameters_sync()
Hob: clean up request_package_info_async()
Hob: clean up cancel_build()
Hob: clean up generate_configuration()
Hob: clean up and reword stop_parse()
Hob: handle some steps for build-succeeded and build-failed by hob
event handler itself
Hob: tooltip change for "Build image" button
Hob: add tooltips into image details screen
Hob: change the logic for rcppkglist_populated()

 bitbake/lib/bb/ui/crumbs/builder.py                |  212 +++++++++++++-------
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py        |   14 +-
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py           |   35 +++-
 bitbake/lib/bb/ui/crumbs/hobwidget.py              |  155 ++++++++++++---
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |   32 +---
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py       |   18 +-
 bitbake/lib/bb/ui/crumbs/packageselectionpage.py   |   54 +++++-
 bitbake/lib/bb/ui/crumbs/recipeselectionpage.py    |   58 +++++-
 bitbake/lib/bb/ui/hob.py                           |    2 +-
 9 files changed, 421 insertions(+), 159 deletions(-)
Signature · 1 line
1.7.6
author
#1 lore raw

PATCH 1/20 Hob: fix version check - Hob can run on pygtk 2.21.0

---
 bitbake/lib/bb/ui/hob.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
bitbake/lib/bb/ui/hob.py +1 -1
index 1321ebb..61df300 100755
@@ -29,7 +29,7 @@ try:
     import pygtk
     pygtk.require('2.0') # to be certain we don't have gtk+ 1.x !?!
     ver = gtk.pygtk_version
-    if ver  < (2, 22, 0):
+    if ver  < (2, 21, 0):
         sys.exit("%s (you have pygtk %s.%s.%s)." % (requirements, ver[0], ver[1], ver[2]))
 except ImportError as exc:
     sys.exit("%s (%s)." % (requirements, str(exc)))
Signature · 1 line
1.7.6
author
#2 lore raw

PATCH 2/20 Hob: add fadeout display effection for recipe view include page

From: Liming An <[email protected]>

As UI request, in recipes selection page, if user exclude a item, the related depends recipes will be excluded together,so the view clearly to add it.

[YOCTO #2100]

---
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py        |   22 +++-
 bitbake/lib/bb/ui/crumbs/hobwidget.py           |  129 +++++++++++++++++++----
 bitbake/lib/bb/ui/crumbs/recipeselectionpage.py |   50 ++++++++-
 3 files changed, 166 insertions(+), 35 deletions(-)
bitbake/lib/bb/ui/crumbs/hoblistmodel.py +16 -6
index 4934ba8..523a591 100644
@@ -34,7 +34,7 @@ class PackageListModel(gtk.TreeStore):
     providing convenience functions to access gtk.TreeModel subclasses which
     provide filtered views of the data.
     """
-    (COL_NAME, COL_VER, COL_REV, COL_RNM, COL_SEC, COL_SUM, COL_RDEP, COL_RPROV, COL_SIZE, COL_BINB, COL_INC) = range(11)
+    (COL_NAME, COL_VER, COL_REV, COL_RNM, COL_SEC, COL_SUM, COL_RDEP, COL_RPROV, COL_SIZE, COL_BINB, COL_INC, COL_FADE_INC) = range(12)
 
     __gsignals__ = {
         "package-selection-changed" : (gobject.SIGNAL_RUN_LAST,
@@ -62,6 +62,7 @@ class PackageListModel(gtk.TreeStore):
                                 gobject.TYPE_STRING,
                                 gobject.TYPE_STRING,
                                 gobject.TYPE_STRING,
+                                gobject.TYPE_BOOLEAN,
                                 gobject.TYPE_BOOLEAN)
 
 
@@ -437,7 +438,7 @@ class RecipeListModel(gtk.ListStore):
     providing convenience functions to access gtk.TreeModel subclasses which
     provide filtered views of the data.
     """
-    (COL_NAME, COL_DESC, COL_LIC, COL_GROUP, COL_DEPS, COL_BINB, COL_TYPE, COL_INC, COL_IMG, COL_INSTALL, COL_PN) = range(11)
+    (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"
 
@@ -461,7 +462,8 @@ class RecipeListModel(gtk.ListStore):
                                 gobject.TYPE_BOOLEAN,
                                 gobject.TYPE_BOOLEAN,
                                 gobject.TYPE_STRING,
-                                gobject.TYPE_STRING)
+                                gobject.TYPE_STRING,
+                                gobject.TYPE_BOOLEAN)
 
     """
     Find the model path for the item_name
@@ -498,17 +500,25 @@ class RecipeListModel(gtk.ListStore):
 
         return True
 
+    def exclude_item_sort_func(self, model, iter1, iter2):
+        val1 = model.get_value(iter1, RecipeListModel.COL_FADE_INC)
+        val2 = model.get_value(iter2, RecipeListModel.COL_INC)
+        return ((val1 == True) and (val2 == False))
+
     """
     Create, if required, and return a filtered gtk.TreeModelSort
     containing only the items which are items specified by filter
     """
-    def tree_model(self, filter):
+    def tree_model(self, filter, excluded_items_head=False):
         model = self.filter_new()
         model.set_visible_func(self.tree_model_filter, filter)
 
         sort = gtk.TreeModelSort(model)
-        sort.set_sort_column_id(RecipeListModel.COL_NAME, gtk.SORT_ASCENDING)
-        sort.set_default_sort_func(None)
+        if excluded_items_head:
+            sort.set_default_sort_func(self.exclude_item_sort_func)
+        else:
+            sort.set_sort_column_id(RecipeListModel.COL_NAME, gtk.SORT_ASCENDING)
+            sort.set_default_sort_func(None)
         return sort
 
     def convert_vpath_to_path(self, view_model, view_path):
bitbake/lib/bb/ui/crumbs/hobwidget.py +106 -23

214 lines not on this page · raw message

bitbake/lib/bb/ui/crumbs/recipeselectionpage.py +44 -6

72 lines not on this page · raw message

Signature · 1 line
1.7.6
author
#3 lore raw

PATCH 3/20 Hob: add fadeout display effection for package view include page

In reply to Shane Wang

From: Liming An <[email protected]>

[YOCTO #2100]

---
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py         |   17 ++++++-
 bitbake/lib/bb/ui/crumbs/hobwidget.py            |    6 ++-
 bitbake/lib/bb/ui/crumbs/packageselectionpage.py |   52 +++++++++++++++++++---
 bitbake/lib/bb/ui/crumbs/recipeselectionpage.py  |    2 +-
 4 files changed, 67 insertions(+), 10 deletions(-)
bitbake/lib/bb/ui/crumbs/hoblistmodel.py +15 -2
index 523a591..f5e3740 100644
@@ -428,6 +428,19 @@ class PackageListModel(gtk.TreeStore):
 
         self.selection_change_notification()
 
+    """
+    Resync the state of included items to a backup column before performing the fadeout visible effect
+    """
+    def resync_fadeout_column(self, model_first_iter=None):
+        it = model_first_iter
+        while it:
+            active = self.get_value(it, self.COL_INC)
+            self.set(it, self.COL_FADE_INC, active)
+            if self.iter_has_child(it):
+                self.resync_fadeout_column(self.iter_children(it))
+
+            it = self.iter_next(it)
+
 #
 # RecipeListModel
 #
@@ -509,12 +522,12 @@ class RecipeListModel(gtk.ListStore):
     Create, if required, and return a filtered gtk.TreeModelSort
     containing only the items which are items specified by filter
     """
-    def tree_model(self, filter, excluded_items_head=False):
+    def tree_model(self, filter, excluded_items_ahead=False):
         model = self.filter_new()
         model.set_visible_func(self.tree_model_filter, filter)
 
         sort = gtk.TreeModelSort(model)
-        if excluded_items_head:
+        if excluded_items_ahead:
             sort.set_default_sort_func(self.exclude_item_sort_func)
         else:
             sort.set_sort_column_id(RecipeListModel.COL_NAME, gtk.SORT_ASCENDING)
bitbake/lib/bb/ui/crumbs/hobwidget.py +5 -1
index 41a59bd..21836f7 100644
@@ -1057,7 +1057,11 @@ class HobCellRendererToggle(gtk.CellRendererToggle):
         if (not self.ctrl) or (not widget):
             return
         if self.ctrl.is_active():
-            path = widget.get_path_at_pos(cell_area.x + cell_area.width/2, cell_area.y + cell_area.height/2)[0]
+            path = widget.get_path_at_pos(cell_area.x + cell_area.width/2, cell_area.y + cell_area.height/2)
+            # sometimes the parameters of cell_area will be a negative number,such as pull up down the scroll bar
+            # it's over the tree container range, so the path will be bad
+            if not path: return
+            path = path[0]
             if path in self.ctrl.running_cell_areas:
                 cr = window.cairo_create()
                 color = gtk.gdk.Color(HobColors.WHITE)
bitbake/lib/bb/ui/crumbs/packageselectionpage.py +46 -6

74 lines not on this page · raw message

bitbake/lib/bb/ui/crumbs/recipeselectionpage.py +1 -1
index 0568032..a2f7982 100755
@@ -212,7 +212,7 @@ class RecipeSelectionPage (HobPage):
         # it's save the prev state of column COL_INC before do exclude_item
         filter = { RecipeListModel.COL_FADE_INC  : [True],
                    RecipeListModel.COL_TYPE      : ['recipe', 'task'] }
-        new_model = self.recipe_model.tree_model(filter, excluded_items_head=True)
+        new_model = self.recipe_model.tree_model(filter, excluded_items_ahead=True)
         tree.set_model(new_model)
 
     def render_fadeout(self, tree, cell):
Signature · 1 line
1.7.6
author
#5 lore raw

PATCH 5/20 Hob: correct indent

In reply to Shane Wang
---
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
bitbake/lib/bb/ui/crumbs/hobeventhandler.py +2 -2
index dc2b1bb..d608b5f 100644
@@ -243,8 +243,8 @@ class HobHandler(gobject.GObject):
         self.run_next_command(self.PARSE_CONFIG)
 
     def parse_generate_configuration(self):
-         self.commands_async.append(self.SUB_PARSE_CONFIG)
-         self.generate_configuration()
+        self.commands_async.append(self.SUB_PARSE_CONFIG)
+        self.generate_configuration()
 
     def set_extra_inherit(self, bbclass):
         inherits = self.server.runCommand(["getVariable", "INHERIT"]) or ""
Signature · 1 line
1.7.6
author
#4 lore raw

PATCH 4/20 Hob: Add the tooltips for recipe view page as request

In reply to Shane Wang

From: Liming An <[email protected]>

[YOCTO #2229]

---
 bitbake/lib/bb/ui/crumbs/hobwidget.py           |   22 ++++++++++++++++++++--
 bitbake/lib/bb/ui/crumbs/recipeselectionpage.py |    8 ++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)
bitbake/lib/bb/ui/crumbs/hobwidget.py +20 -2
index 21836f7..b79edce 100644
@@ -410,6 +410,7 @@ class HobTabBar(gtk.DrawingArea):
         self.connect("expose-event", self.on_draw)
         self.connect("button-press-event", self.button_pressed_cb)
         self.connect("button-release-event", self.button_released_cb)
+        self.connect("query-tooltip", self.query_tooltip_cb)
         self.show_all()
 
     def button_released_cb(self, widget, event):
@@ -473,7 +474,7 @@ class HobTabBar(gtk.DrawingArea):
             child["g"] = color.green
             child["b"] = color.blue
 
-    def append_tab_child(self, title, page):
+    def append_tab_child(self, title, page, tooltip=""):
         num = len(self.children) + 1
         self.tab_width = self.tab_width * len(self.children) / num
 
@@ -498,8 +499,11 @@ class HobTabBar(gtk.DrawingArea):
             "title"        : title,
             "indicator_show"   : False,
             "indicator_number" : 0,
+            "tooltip_markup"   : tooltip,
         }
         self.children.append(new_one)
+        if tooltip and (not self.props.has_tooltip):
+            self.props.has_tooltip = True
         # set the default current child
         if not self.current_child:
             self.current_child = new_one
@@ -668,6 +672,18 @@ class HobTabBar(gtk.DrawingArea):
 
         return gtk.gdk.Rectangle(x, y, w, h)
 
+    def query_tooltip_cb(self, widget, x, y, keyboardtip, tooltip):
+        if keyboardtip or (not tooltip):
+            return False
+        # check which tab be clicked
+        for child in self.children:
+           if      (child["x"] < x) and (x < child["x"] + self.tab_width) \
+               and (child["y"] < y) and (y < child["y"] + self.tab_height):
+               tooltip.set_markup(child["tooltip_markup"])
+               return True
+
+        return False
+
 class HobNotebook(gtk.VBox):
 
     def __init__(self):
@@ -752,13 +768,15 @@ class HobNotebook(gtk.VBox):
         if not notebook:
             return
         title = notebook.get_tab_label_text(notebook_child)
+        label = notebook.get_tab_label(notebook_child)
+        tooltip_markup = label.get_tooltip_markup()
         if not title:
             return
         for child in self.tabbar.children:
             if child["title"] == title:
                 child["toggled_page"] = page
                 return
-        self.tabbar.append_tab_child(title, page)
+        self.tabbar.append_tab_child(title, page, tooltip_markup)
 
     def page_removed_cb(self, notebook, notebook_child, page, title=""):
         for child in self.tabbar.children:
bitbake/lib/bb/ui/crumbs/recipeselectionpage.py +8 -0
index a2f7982..ea32fb0 100755
@@ -34,6 +34,7 @@ class RecipeSelectionPage (HobPage):
     pages = [
         {
          'name'    : 'Included',
+         'tooltip' : 'The recipes currently included for your image',
          'filter'  : { RecipeListModel.COL_INC  : [True],
                        RecipeListModel.COL_TYPE : ['recipe', 'task'] },
          'columns' : [{
@@ -57,6 +58,7 @@ class RecipeSelectionPage (HobPage):
                       }]
         }, {
          'name'    : 'All recipes',
+         'tooltip' : 'All recipes available in the Yocto Project',
          'filter'  : { RecipeListModel.COL_TYPE : ['recipe'] },
          'columns' : [{
                        'col_name' : 'Recipe name',
@@ -85,6 +87,7 @@ class RecipeSelectionPage (HobPage):
                       }]
         }, {
          'name'    : 'Tasks',
+         'tooltip' : 'All tasks availabel in the Yocto Project',
          'filter'  : { RecipeListModel.COL_TYPE : ['task'] },
          'columns' : [{
                        'col_name' : 'Task name',
@@ -137,12 +140,17 @@ class RecipeSelectionPage (HobPage):
                 tab.connect("row-activated", self.tree_row_activated_cb)
                 tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
             label = gtk.Label(page['name'])
+            label.set_selectable(False)
+            label.set_tooltip_text(page['tooltip'])
             self.ins.append_page(tab, label)
             self.tables.append(tab)
 
         self.ins.set_entry("Search recipes:")
         # set the search entry for each table
         for tab in self.tables:
+            search_tip = "Enter a recipe's or task's name to find it"
+            self.ins.search.set_tooltip_text(search_tip)
+            self.ins.search.props.has_tooltip = True
             tab.set_search_entry(0, self.ins.search)
 
         # add all into the window
Signature · 1 line
1.7.6
author
#6 lore raw

PATCH 6/20 Hob: clean up and unify the steps for new build to call initiate_new_build_async()

In reply to Shane Wang

initiate_new_build() (changed the function name into initiate_new_build_async() to indicate it is an async function) or the similar sub-functions are called at different places.

This patch is unify to call initiate_new_build_async().

---
 bitbake/lib/bb/ui/crumbs/builder.py          |   19 +++++++------------
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py |    2 +-
 2 files changed, 8 insertions(+), 13 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +7 -12
index a3410d4..ef6f182 100755
@@ -294,11 +294,7 @@ class Builder(gtk.Window):
         self.handler.connect("command-succeeded",        self.handler_command_succeeded_cb)
         self.handler.connect("command-failed",           self.handler_command_failed_cb)
 
-        self.handler.init_cooker()
-        self.handler.set_extra_inherit("image_types")
-        self.handler.parse_config()
-
-        self.switch_page(self.MACHINE_SELECTION)
+        self.initiate_new_build_async()
 
     def create_visual_elements(self):
         self.set_title("Hob")
@@ -334,6 +330,12 @@ class Builder(gtk.Window):
         self.show_all()
         self.nb.set_current_page(0)
 
+    def initiate_new_build_async(self):
+        self.switch_page(self.MACHINE_SELECTION)
+        self.handler.init_cooker()
+        self.handler.set_extra_inherit("image_types")
+        self.handler.parse_config()
+
     def load_template(self, path):
         self.template = TemplateMgr()
         self.template.load(path)
@@ -987,13 +989,6 @@ class Builder(gtk.Window):
     def show_recipes(self):
         self.switch_page(self.RECIPE_SELECTION)
 
-    def initiate_new_build(self):
-        self.handler.init_cooker()
-        self.handler.set_extra_inherit("image_types")
-        self.handler.parse_config()
-        self.image_configuration_page.switch_machine_combo()
-        self.switch_page(self.MACHINE_SELECTION)
-
     def show_configuration(self):
         self.switch_page(self.BASEIMG_SELECTED)
 
bitbake/lib/bb/ui/crumbs/imagedetailspage.py +1 -1
index b685d11..e550653 100755
@@ -381,7 +381,7 @@ class ImageDetailsPage (HobPage):
         self.builder.runqemu_image(image_name)
 
     def build_new_button_clicked_cb(self, button):
-        self.builder.initiate_new_build()
+        self.builder.initiate_new_build_async()
 
     def edit_config_button_clicked_cb(self, button):
         self.builder.show_configuration()
Signature · 1 line
1.7.6
author
#9 lore raw

PATCH 9/20 Hob: clean up and unify the steps for PACKAGE_GENERATING and FAST_IMAGE_GENERATING to call generate_packages_async() and fast_generate_image_async()

In reply to Shane Wang

For the steps in PACKAGE_GENERATING, the patch consolidates them into generate_packages_async() to call.

For the steps in FAST_IMAGE_GENERATING, the patch also consolidates them into fast_generate_image_async() to call.

---
 bitbake/lib/bb/ui/crumbs/builder.py |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +19 -11
index a0ad5a0..8a95b94 100755
@@ -345,6 +345,22 @@ class Builder(gtk.Window):
         self.set_user_config()
         self.handler.generate_recipes()
 
+    def generate_packages_async(self):
+        self.switch_page(self.PACKAGE_GENERATING)
+        # Build packages
+        _, all_recipes = self.recipe_model.get_selected_recipes()
+        self.set_user_config()
+        self.handler.reset_build()
+        self.handler.generate_packages(all_recipes)
+
+    def fast_generate_image_async(self):
+        self.switch_page(self.FAST_IMAGE_GENERATING)
+        # Build packages
+        _, all_recipes = self.recipe_model.get_selected_recipes()
+        self.set_user_config()
+        self.handler.reset_build()
+        self.handler.generate_packages(all_recipes)
+
     def load_template(self, path):
         self.template = TemplateMgr()
         self.template.load(path)
@@ -402,7 +418,6 @@ class Builder(gtk.Window):
         elif next_step == self.PACKAGE_GENERATING or next_step == self.FAST_IMAGE_GENERATING:
             # both PACKAGE_GENEATING and FAST_IMAGE_GENERATING share the same page
             self.build_details_page.show_page(next_step)
-            self.generate_packages()
 
         elif next_step == self.PACKAGE_GENERATED:
             pass
@@ -460,13 +475,6 @@ class Builder(gtk.Window):
         left = self.package_model.set_selected_packages(selected_packages)
         self.configuration.selected_packages += left
 
-    def generate_packages(self):
-        # Build packages
-        _, all_recipes = self.recipe_model.get_selected_recipes()
-        self.set_user_config()
-        self.handler.reset_build()
-        self.handler.generate_packages(all_recipes)
-
     def generate_image(self):
         # Build image
         self.set_user_config()
@@ -737,7 +745,7 @@ class Builder(gtk.Window):
             dialog.run()
             dialog.destroy()
             return
-        self.switch_page(self.PACKAGE_GENERATING)
+        self.generate_packages_async()
 
     def build_image(self):
         selected_packages = self.package_model.get_selected_packages()
@@ -767,7 +775,7 @@ class Builder(gtk.Window):
             dialog.destroy()
             return
 
-        self.switch_page(self.FAST_IMAGE_GENERATING)
+        self.fast_generate_image_async()
 
     def show_binb_dialog(self, binb):
         markup = "<b>Brought in by:</b>\n%s" % binb
@@ -977,7 +985,7 @@ class Builder(gtk.Window):
             response = dialog.run()
             dialog.destroy()
             if response == gtk.RESPONSE_YES:
-                self.switch_page(self.PACKAGE_GENERATING)
+                self.generate_packages_async()
             else:
                 self.switch_page(self.PACKAGE_SELECTION)
         else:
Signature · 1 line
1.7.6
author
#10 lore raw

PATCH 10/20 Hob: clean up and unify the steps for IMAGE_GENERATING to call generate_image_async()

In reply to Shane Wang

For the steps in IMAGE_GENERATING, the patch consolidates them into generate_image_async() to call.

---
 bitbake/lib/bb/ui/crumbs/builder.py |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +16 -16
index 8a95b94..959d8c1 100755
@@ -361,6 +361,20 @@ class Builder(gtk.Window):
         self.handler.reset_build()
         self.handler.generate_packages(all_recipes)
 
+    def generate_image_async(self):
+        self.switch_page(self.IMAGE_GENERATING)
+        # Build image
+        self.set_user_config()
+        packages = self.package_model.get_selected_packages()
+        toolchain_packages = []
+        if self.configuration.toolchain_build:
+            toolchain_packages = self.package_model.get_selected_packages_toolchain()
+        self.handler.reset_build()
+        self.handler.generate_image(packages,
+                                    self.hob_image,
+                                    self.hob_toolchain,
+                                    toolchain_packages)
+
     def load_template(self, path):
         self.template = TemplateMgr()
         self.template.load(path)
@@ -426,7 +440,6 @@ class Builder(gtk.Window):
             # after packages are generated, selected_packages need to
             # be updated in package_model per selected_image in recipe_model
             self.build_details_page.show_page(next_step)
-            self.generate_image()
 
         elif next_step == self.IMAGE_GENERATED:
             self.image_details_page.show_page(next_step)
@@ -475,19 +488,6 @@ class Builder(gtk.Window):
         left = self.package_model.set_selected_packages(selected_packages)
         self.configuration.selected_packages += left
 
-    def generate_image(self):
-        # Build image
-        self.set_user_config()
-        packages = self.package_model.get_selected_packages()
-        toolchain_packages = []
-        if self.configuration.toolchain_build:
-            toolchain_packages = self.package_model.get_selected_packages_toolchain()
-        self.handler.reset_build()
-        self.handler.generate_image(packages,
-                                    self.hob_image,
-                                    self.hob_toolchain,
-                                    toolchain_packages)
-
     # Callback Functions
     def handler_config_updated_cb(self, handler, which, values):
         if which == "distro":
@@ -526,7 +526,7 @@ class Builder(gtk.Window):
 
             self.rcppkglist_populated()
             if self.current_step == self.FAST_IMAGE_GENERATING:
-                self.switch_page(self.IMAGE_GENERATING)
+                self.generate_image_async()
             elif self.current_step == self.PACKAGE_GENERATING:
                 self.switch_page(self.PACKAGE_GENERATED)
             elif self.current_step == self.IMAGE_GENERATING:
@@ -758,7 +758,7 @@ class Builder(gtk.Window):
             dialog.run()
             dialog.destroy()
             return
-        self.switch_page(self.IMAGE_GENERATING)
+        self.generate_image_async()
 
     def just_bake(self):
         selected_image = self.recipe_model.get_selected_image()
Signature · 1 line
1.7.6
author
#8 lore raw

PATCH 8/20 Hob: clean up and unify the steps for RCPPKGINFO_POPULATING to call populate_recipe_package_info_async()

In reply to Shane Wang

For the steps in RCPPKGINFO_POPULATING, This patch consolidates them into populate_recipe_package_info_async() to call.

---
 bitbake/lib/bb/ui/crumbs/builder.py                |   14 +++++++-------
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |    2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +7 -7
index 6b8e9f3..a0ad5a0 100755
@@ -339,6 +339,12 @@ class Builder(gtk.Window):
         self.set_user_config()
         self.handler.parse_generate_configuration()
 
+    def populate_recipe_package_info_async(self):
+        self.switch_page(self.RCPPKGINFO_POPULATING)
+        # Parse recipes
+        self.set_user_config()
+        self.handler.generate_recipes()
+
     def load_template(self, path):
         self.template = TemplateMgr()
         self.template.load(path)
@@ -380,7 +386,6 @@ class Builder(gtk.Window):
             # MACHINE CHANGED action or SETTINGS CHANGED
             # show the progress bar
             self.image_configuration_page.show_info_populating()
-            self.generate_recipes()
 
         elif next_step == self.RCPPKGINFO_POPULATED:
             self.image_configuration_page.show_info_populated()
@@ -462,11 +467,6 @@ class Builder(gtk.Window):
         self.handler.reset_build()
         self.handler.generate_packages(all_recipes)
 
-    def generate_recipes(self):
-        # Parse recipes
-        self.set_user_config()
-        self.handler.generate_recipes()
-
     def generate_image(self):
         # Build image
         self.set_user_config()
@@ -885,7 +885,7 @@ class Builder(gtk.Window):
         if not self.configuration.curr_mach:
             self.update_config_async()
         else:
-            self.switch_page(self.RCPPKGINFO_POPULATING)
+            self.populate_recipe_package_info_async()
 
     def deploy_image(self, image_name):
         if not image_name:
bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +1 -1
index d8cb752..204d1c6 100644
@@ -259,7 +259,7 @@ class ImageConfigurationPage (HobPage):
 
         self.builder.configuration.curr_mach = combo_item
         # Do reparse recipes
-        self.builder.switch_page(self.builder.RCPPKGINFO_POPULATING)
+        self.builder.populate_recipe_package_info_async()
 
     def update_machine_combo(self):
         all_machines = self.builder.parameters.all_machines
Signature · 1 line
1.7.6
author
#7 lore raw

PATCH 7/20 Hob: clean up and unify the steps for CONFIG_UPDATE to call update_config_async()

In reply to Shane Wang

For the steps in CONFIG_UPDATE, the patch consolidates them into update_config_async() to call.
consequently remove CONFIG_UPDATE since MACHINE_SELECTION covers it.

---
 bitbake/lib/bb/ui/crumbs/builder.py |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +9 -12
index ef6f182..6b8e9f3 100755
@@ -212,7 +212,6 @@ class Parameters:
 class Builder(gtk.Window):
 
     (MACHINE_SELECTION,
-     CONFIG_UPDATED,
      RCPPKGINFO_POPULATING,
      RCPPKGINFO_POPULATED,
      BASEIMG_SELECTED,
@@ -225,7 +224,7 @@ class Builder(gtk.Window):
      IMAGE_GENERATED,
      MY_IMAGE_OPENED,
      BACK,
-     END_NOOP) = range(15)
+     END_NOOP) = range(14)
 
     (IMAGE_CONFIGURATION,
      RECIPE_DETAILS,
@@ -236,7 +235,6 @@ class Builder(gtk.Window):
 
     __step2page__ = {
         MACHINE_SELECTION     : IMAGE_CONFIGURATION,
-        CONFIG_UPDATED        : IMAGE_CONFIGURATION,
         RCPPKGINFO_POPULATING : IMAGE_CONFIGURATION,
         RCPPKGINFO_POPULATED  : IMAGE_CONFIGURATION,
         BASEIMG_SELECTED      : IMAGE_CONFIGURATION,
@@ -336,6 +334,11 @@ class Builder(gtk.Window):
         self.handler.set_extra_inherit("image_types")
         self.handler.parse_config()
 
+    def update_config_async(self):
+        self.switch_page(self.MACHINE_SELECTION)
+        self.set_user_config()
+        self.handler.parse_generate_configuration()
+
     def load_template(self, path):
         self.template = TemplateMgr()
         self.template.load(path)
@@ -345,7 +348,7 @@ class Builder(gtk.Window):
             if not os.path.exists(layer+'/conf/layer.conf'):
                 return False
 
-        self.switch_page(self.CONFIG_UPDATED)
+        self.update_config_async()
 
         self.template.destroy()
         self.template = None
@@ -373,12 +376,6 @@ class Builder(gtk.Window):
         if next_step == self.MACHINE_SELECTION: # init step
             self.image_configuration_page.show_machine()
 
-        elif next_step == self.CONFIG_UPDATED:
-            # after layers is changd by users
-            self.image_configuration_page.show_machine()
-            self.set_user_config()
-            self.handler.parse_generate_configuration()
-
         elif next_step == self.RCPPKGINFO_POPULATING:
             # MACHINE CHANGED action or SETTINGS CHANGED
             # show the progress bar
@@ -795,7 +792,7 @@ class Builder(gtk.Window):
             self.configuration.layers = dialog.layers
             # DO refresh layers
             if dialog.layers_changed:
-                self.switch_page(self.CONFIG_UPDATED)
+                self.update_config_async()
         dialog.destroy()
 
     def show_load_template_dialog(self):
@@ -886,7 +883,7 @@ class Builder(gtk.Window):
     def reparse_post_adv_settings(self):
         # DO reparse recipes
         if not self.configuration.curr_mach:
-            self.switch_page(self.CONFIG_UPDATED)
+            self.update_config_async()
         else:
             self.switch_page(self.RCPPKGINFO_POPULATING)
 
Signature · 1 line
1.7.6
author
#11 lore raw

PATCH 11/20 Hob: clean up to call clear_busy() in hobeventhandler.py

In reply to Shane Wang
---
 bitbake/lib/bb/ui/crumbs/builder.py         |    1 -
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    1 +
 2 files changed, 1 insertions(+), 1 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +0 -1
index 959d8c1..ddd93f6 100755
@@ -542,7 +542,6 @@ class Builder(gtk.Window):
             HobButton.style_button(button)
             response = dialog.run()
             dialog.destroy()
-        self.handler.clear_busy()
         self.configuration.curr_mach = ""
         self.image_configuration_page.switch_machine_combo()
         self.switch_page(self.MACHINE_SELECTION)
bitbake/lib/bb/ui/crumbs/hobeventhandler.py +1 -0
index d608b5f..dd85530 100644
@@ -202,6 +202,7 @@ class HobHandler(gobject.GObject):
 
         elif isinstance(event, bb.command.CommandFailed):
             self.commands_async = []
+            self.clear_busy()
             self.emit("command-failed", self.error_msg)
             self.error_msg = ""
         elif isinstance(event, (bb.event.ParseStarted,
Signature · 1 line
1.7.6
author
#12 lore raw

PATCH 12/20 Hob: clean up and unify get_parameters() to be get_parameters_sync()

In reply to Shane Wang
---
 bitbake/lib/bb/ui/crumbs/builder.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +6 -3
index ddd93f6..d8c420e 100755
@@ -375,6 +375,9 @@ class Builder(gtk.Window):
                                     self.hob_toolchain,
                                     toolchain_packages)
 
+    def get_parameters_sync(self):
+        return self.handler.get_parameters()
+
     def load_template(self, path):
         self.template = TemplateMgr()
         self.template.load(path)
@@ -504,18 +507,18 @@ class Builder(gtk.Window):
     def handler_command_succeeded_cb(self, handler, initcmd):
         if initcmd == self.handler.PARSE_CONFIG:
             # settings
-            params = self.handler.get_parameters()
+            params = self.get_parameters_sync()
             self.configuration = Configuration(params)
             self.parameters = Parameters(params)
             self.handler.generate_configuration()
         elif initcmd == self.handler.GENERATE_CONFIGURATION:
-            params = self.handler.get_parameters()
+            params = self.get_parameters_sync()
             self.configuration.update(params)
             self.image_configuration_page.switch_machine_combo()
         elif initcmd in [self.handler.GENERATE_RECIPES,
                          self.handler.GENERATE_PACKAGES,
                          self.handler.GENERATE_IMAGE]:
-            params = self.handler.get_parameters()
+            params = self.get_parameters_sync()
             self.configuration.update(params)
             self.handler.request_package_info_async()
         elif initcmd == self.handler.POPULATE_PACKAGEINFO:
Signature · 1 line
1.7.6
author
#13 lore raw

PATCH 13/20 Hob: clean up request_package_info_async()

In reply to Shane Wang
---
 bitbake/lib/bb/ui/crumbs/builder.py         |    5 ++++-
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +4 -1
index d8c420e..f069215 100755
@@ -378,6 +378,9 @@ class Builder(gtk.Window):
     def get_parameters_sync(self):
         return self.handler.get_parameters()
 
+    def request_package_info_async(self):
+        self.handler.request_package_info()
+
     def load_template(self, path):
         self.template = TemplateMgr()
         self.template.load(path)
@@ -520,7 +523,7 @@ class Builder(gtk.Window):
                          self.handler.GENERATE_IMAGE]:
             params = self.get_parameters_sync()
             self.configuration.update(params)
-            self.handler.request_package_info_async()
+            self.request_package_info_async()
         elif initcmd == self.handler.POPULATE_PACKAGEINFO:
             if self.current_step == self.RCPPKGINFO_POPULATING:
                 self.switch_page(self.RCPPKGINFO_POPULATED)
bitbake/lib/bb/ui/crumbs/hobeventhandler.py +1 -1
index dd85530..1a7427a 100644
@@ -325,7 +325,7 @@ class HobHandler(gobject.GObject):
         self.server.runCommand(["setVariable", "CVS_PROXY_HOST", host])
         self.server.runCommand(["setVariable", "CVS_PROXY_PORT", port])
 
-    def request_package_info_async(self):
+    def request_package_info(self):
         self.commands_async.append(self.SUB_GENERATE_PKGINFO)
         self.run_next_command(self.POPULATE_PACKAGEINFO)
 
Signature · 1 line
1.7.6
author
#14 lore raw

PATCH 14/20 Hob: clean up cancel_build()

In reply to Shane Wang
---
 bitbake/lib/bb/ui/crumbs/builder.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +5 -2
index f069215..26e202e 100755
@@ -381,6 +381,9 @@ class Builder(gtk.Window):
     def request_package_info_async(self):
         self.handler.request_package_info()
 
+    def cancel_build_sync(self, force=False):
+        self.handler.cancel_build(force)
+
     def load_template(self, path):
         self.template = TemplateMgr()
         self.template.load(path)
@@ -1038,6 +1041,6 @@ class Builder(gtk.Window):
         if response != gtk.RESPONSE_CANCEL:
             self.stopping = True
         if response == gtk.RESPONSE_OK:
-            self.handler.cancel_build()
+            self.cancel_build_sync()
         elif response == gtk.RESPONSE_YES:
-            self.handler.cancel_build(True)
+            self.cancel_build_sync(True)
Signature · 1 line
1.7.6
author
#15 lore raw

PATCH 15/20 Hob: clean up generate_configuration()

In reply to Shane Wang
---
 bitbake/lib/bb/ui/crumbs/builder.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +4 -1
index 26e202e..b052d99 100755
@@ -384,6 +384,9 @@ class Builder(gtk.Window):
     def cancel_build_sync(self, force=False):
         self.handler.cancel_build(force)
 
+    def generate_configuration_async(self):
+        self.handler.generate_configuration()
+
     def load_template(self, path):
         self.template = TemplateMgr()
         self.template.load(path)
@@ -516,7 +519,7 @@ class Builder(gtk.Window):
             params = self.get_parameters_sync()
             self.configuration = Configuration(params)
             self.parameters = Parameters(params)
-            self.handler.generate_configuration()
+            self.generate_configuration_async()
         elif initcmd == self.handler.GENERATE_CONFIGURATION:
             params = self.get_parameters_sync()
             self.configuration.update(params)
Signature · 1 line
1.7.6
author
#16 lore raw

PATCH 16/20 Hob: clean up and reword stop_parse()

In reply to Shane Wang
---
 bitbake/lib/bb/ui/crumbs/builder.py                |    6 +++---
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +3 -3
index b052d99..afd1d1b 100755
@@ -387,6 +387,9 @@ class Builder(gtk.Window):
     def generate_configuration_async(self):
         self.handler.generate_configuration()
 
+    def cancel_parse_sync(self):
+        self.handler.cancel_parse()
+
     def load_template(self, path):
         self.template = TemplateMgr()
         self.template.load(path)
@@ -1008,9 +1011,6 @@ class Builder(gtk.Window):
     def show_configuration(self):
         self.switch_page(self.BASEIMG_SELECTED)
 
-    def stop_parse(self):
-        self.handler.cancel_parse()
-
     def stop_build(self):
         if self.stopping:
             lbl = "<b>Force Stop build?</b>\nYou've already selected Stop once,"
bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +1 -1
index 204d1c6..c2e0f5f 100644
@@ -250,7 +250,7 @@ class ImageConfigurationPage (HobPage):
         return button_box
 
     def stop_button_clicked_cb(self, button):
-        self.builder.stop_parse()
+        self.builder.cancel_parse_sync()
 
     def machine_combo_changed_cb(self, machine_combo):
         combo_item = machine_combo.get_active_text()
Signature · 1 line
1.7.6
author
#17 lore raw

PATCH 17/20 Hob: handle some steps for build-succeeded and build-failed by hob event handler itself

In reply to Shane Wang

Changing the state of building, clearing the commands_async queue, and resetting initcmd should be the behaviours of hob event handler rather that builder, because those are the members of hob event handler. So, the patch is to put those steps from the builder into the hob event handler by adding two callback functions in it.

---
 bitbake/lib/bb/ui/crumbs/builder.py         |    2 --
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    7 +++++--
 2 files changed, 5 insertions(+), 4 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +0 -2
index afd1d1b..4997cd4 100755
@@ -668,7 +668,6 @@ class Builder(gtk.Window):
         elif self.current_step == self.PACKAGE_GENERATING:
             fraction = 1.0
         self.build_details_page.update_progress_bar("Build Completed: ", fraction)
-        self.handler.build_succeeded_async()
         self.stopping = False
 
     def build_failed(self):
@@ -688,7 +687,6 @@ class Builder(gtk.Window):
         self.build_details_page.update_progress_bar(message, fraction, status)
         self.build_details_page.show_back_button()
         self.build_details_page.hide_stop_button()
-        self.handler.build_failed_async()
         self.stopping = False
 
     def handler_build_succeeded_cb(self, running_build):
bitbake/lib/bb/ui/crumbs/hobeventhandler.py +5 -2
index 1a7427a..41ab593 100644
@@ -81,6 +81,9 @@ class HobHandler(gobject.GObject):
         self.error_msg = ""
         self.initcmd = None
 
+        self.build.connect("build-succeeded", self.build_succeeded_cb)
+        self.build.connect("build-failed",    self.build_failed_cb)
+
     def set_busy(self):
         if not self.generating:
             self.emit("generating-data")
@@ -359,10 +362,10 @@ class HobHandler(gobject.GObject):
         self.commands_async.append(self.SUB_BUILD_IMAGE)
         self.run_next_command(self.GENERATE_IMAGE)
 
-    def build_succeeded_async(self):
+    def build_succeeded_cb(self, running_build):
         self.building = False
 
-    def build_failed_async(self):
+    def build_failed_cb(self, running_build):
         self.initcmd = None
         self.commands_async = []
         self.building = False
Signature · 1 line
1.7.6
author
#19 lore raw

PATCH 19/20 Hob: add tooltips into image details screen

In reply to Shane Wang

[Yocto #2243]

---
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
bitbake/lib/bb/ui/crumbs/imagedetailspage.py +11 -5
index e550653..3eb6bcf 100755
@@ -126,19 +126,19 @@ class ImageDetailsPage (HobPage):
             "Templates",
             hic.ICON_TEMPLATES_DISPLAY_FILE,
             hic.ICON_TEMPLATES_HOVER_FILE,
-            "Load a hob building template saved before",
+            "Load a previously saved template",
             self.template_button_clicked_cb)
         my_images_button = self.append_toolbar_button(self.toolbar,
-            "My images",
+            "Images",
             hic.ICON_IMAGES_DISPLAY_FILE,
             hic.ICON_IMAGES_HOVER_FILE,
-            "Open images built out previously for running or deployment",
+            "Open previously built images",
             self.my_images_button_clicked_cb)
         settings_button = self.append_toolbar_button(self.toolbar,
             "Settings",
             hic.ICON_SETTINGS_DISPLAY_FILE,
             hic.ICON_SETTINGS_HOVER_FILE,
-            "Other advanced settings for build",
+            "View additional build settings",
             self.settings_button_clicked_cb)
 
         self.details_top_buttons = self.add_onto_top_bar(self.toolbar)
@@ -206,6 +206,7 @@ class ImageDetailsPage (HobPage):
         image_table.connect("toggled", self.toggled_cb)
         view_files_button = HobAltButton("View files")
         view_files_button.connect("clicked", self.view_files_clicked_cb, image_addr)
+        view_files_button.set_tooltip_text("Open the directory containing the image files")
         self.box_group_area.pack_start(self.DetailBox(widget=image_table, button=view_files_button), expand=True, fill=True)
 
         # Machine, Base image and Layers
@@ -233,6 +234,7 @@ class ImageDetailsPage (HobPage):
                 i += 1
 
             edit_config_button = HobAltButton("Edit configuration")
+            edit_config_button.set_tooltip_text("Edit machine, base image and recipes")
             edit_config_button.connect("clicked", self.edit_config_button_clicked_cb)
             setting_detail = self.DetailBox(varlist=varlist, vallist=vallist, button=edit_config_button)
             self.box_group_area.pack_start(setting_detail, expand=False, fill=False)
@@ -244,6 +246,7 @@ class ImageDetailsPage (HobPage):
         vallist.append(default_image_size)
         if build_succeeded:
             edit_packages_button = HobAltButton("Edit packages")
+            edit_packages_button.set_tooltip_text("Edit the packages included in your image")
             edit_packages_button.connect("clicked", self.edit_packages_button_clicked_cb)
         else: # get to this page from "My images"
             edit_packages_button = None
@@ -316,7 +319,7 @@ class ImageDetailsPage (HobPage):
         if name in buttonlist:
             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_tooltip_text("Burn a live image to a USB drive or flash memory")
             self.deploy_button.set_flags(gtk.CAN_DEFAULT)
             self.deploy_button.connect("clicked", self.deploy_button_clicked_cb)
             bottom_buttons.pack_end(self.deploy_button, expand=False, fill=False)
@@ -331,6 +334,7 @@ class ImageDetailsPage (HobPage):
 
             # create button "Run image"
             self.run_button = HobAltButton("Run image")
+            self.run_button.set_tooltip_text("Start up an image with qemu emulator")
             self.run_button.connect("clicked", self.run_button_clicked_cb)
             bottom_buttons.pack_end(self.run_button, expand=False, fill=False)
             created = True
@@ -344,6 +348,7 @@ class ImageDetailsPage (HobPage):
 
             # create button "Save as template"
             save_button = HobAltButton("Save as template")
+            save_button.set_tooltip_text("Save the image configuration for reuse")
             save_button.connect("clicked", self.save_button_clicked_cb)
             bottom_buttons.pack_end(save_button, expand=False, fill=False)
             create = True
@@ -352,6 +357,7 @@ class ImageDetailsPage (HobPage):
         if name in buttonlist:
             # create button "Build new image"
             build_new_button = HobAltButton("Build new image")
+            build_new_button.set_tooltip_text("Create a new image from scratch")
             build_new_button.connect("clicked", self.build_new_button_clicked_cb)
             bottom_buttons.pack_start(build_new_button, expand=False, fill=False)
 
Signature · 1 line
1.7.6
author
#18 lore raw

PATCH 18/20 Hob: tooltip change for "Build image" button

In reply to Shane Wang

[Yocto #2242]

---
 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 8391e29..923f53b 100755
@@ -131,7 +131,7 @@ class PackageSelectionPage (HobPage):
 
         self.build_image_button = HobButton('Build image')
         self.build_image_button.set_size_request(205, 49)
-        self.build_image_button.set_tooltip_text("Build image to get your target image")
+        self.build_image_button.set_tooltip_text("Build target image")
         self.build_image_button.set_flags(gtk.CAN_DEFAULT)
         self.build_image_button.grab_default()
         self.build_image_button.connect("clicked", self.build_image_clicked_cb)
Signature · 1 line
1.7.6
author
#20 lore raw

PATCH 20/20 Hob: change the logic for rcppkglist_populated()

In reply to Shane Wang

There are some bugs in the previous log of rcppkglist_populated. [Yocto #2255] is one of them.

Once more, when the user loads a template, changes the base image to the other one which is not the same as the one in the template, changes the machine, and then you will find the base image specified in the template disappears.

This patch changes the logic as follows:
- If any template is loaded into this Hob session, its base image will be remembered always. After the recipe list and the package list are populated, the template base image will be appended.
That is to fix the above bug.
- If the reason for reparsing recipes is any settings are changed, Hob will remember selected_recipes and selected_packages. The behaviour is the same as before, because we don't want to clear the user selection.
- If the reason for reparsing recipes is the machine is changed, including a template is loaded (which causes the machine is changed), Hob will forget selected_recipes and selected_packages the user selects. (see [Yocto #2255] for details)
- Again, we reuse the code for rcppkglist_populated() for any base image changing. I.e., when the user changes any base image, Hob will forget the previous selected_recipes and selected_packages.

In Hob code, two places will cause recipe parsing. One is settings are changed. The other is machine is changed.

[Yocto #2255]

---
 bitbake/lib/bb/ui/crumbs/builder.py                |   65 +++++++++++++++++---
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |   30 ++--------
 2 files changed, 62 insertions(+), 33 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +57 -8
index 4997cd4..849a1f0 100755
@@ -26,6 +26,7 @@ import copy
 import os
 import subprocess
 import shlex
+import glib
 from bb.ui.crumbs.template import TemplateMgr
 from bb.ui.crumbs.imageconfigurationpage import ImageConfigurationPage
 from bb.ui.crumbs.recipeselectionpage import RecipeSelectionPage
@@ -259,6 +260,7 @@ class Builder(gtk.Window):
         self.handler = hobHandler
 
         self.template = None
+        self.loaded_images = []
 
         # build step
         self.current_step = None
@@ -339,7 +341,8 @@ class Builder(gtk.Window):
         self.set_user_config()
         self.handler.parse_generate_configuration()
 
-    def populate_recipe_package_info_async(self):
+    def populate_recipe_package_info_async(self, mach_changed = True):
+        self.mach_changed = mach_changed
         self.switch_page(self.RCPPKGINFO_POPULATING)
         # Parse recipes
         self.set_user_config()
@@ -395,6 +398,12 @@ class Builder(gtk.Window):
         self.template.load(path)
         self.configuration.load(self.template)
 
+        entry = {}
+        entry["image"] = self.configuration.selected_image
+        entry["recipes"] = self.configuration.selected_recipes[:]
+        entry["packages"] = self.configuration.selected_packages[:]
+        self.loaded_images.append(entry)
+
         for layer in self.configuration.layers:
             if not os.path.exists(layer+'/conf/layer.conf'):
                 return False
@@ -589,17 +598,57 @@ class Builder(gtk.Window):
         self.window_sensitive(True)
 
     def rcppkglist_populated(self):
+        # remember those images loaded previously in this Hob session
+        for entry in self.loaded_images:
+            self.recipe_model.image_list_append(entry["image"],
+                " ".join(entry["recipes"]),
+                " ".join(entry["packages"]))
+
+        if self.mach_changed:
+            self.update_rcppkglist_forgotten(self.configuration.selected_image)
+        else:
+            self.update_rcppkglist_remembered()
+
+    def update_rcppkglist_idle(self, selected_image, selected_recipes, selected_packages):
+        self.update_recipe_model(selected_image, selected_recipes)
+        self.update_package_model(selected_packages)
+        self.window_sensitive(True)
+
+    def update_rcppkglist_forgotten(self, selected_image = None):
+        self.window_sensitive(False)
+
+        selected_recipes = selected_packages = []
+        self.recipe_model.reset()
+        self.package_model.reset()
+
+        selected_image_desc = ""
+        if selected_image:
+            image_path = self.recipe_model.pn_path[selected_image]
+            image_iter = self.recipe_model.get_iter(image_path)
+            selected_packages = self.recipe_model.get_value(image_iter, self.recipe_model.COL_INSTALL).split()
+            selected_image_desc = self.recipe_model.get_value(image_iter, self.recipe_model.COL_DESC)
+
+        self.image_configuration_page.update_image_combo(self.recipe_model, selected_image, selected_image_desc)
+
+        glib.idle_add(self.update_rcppkglist_idle, selected_image, selected_recipes, selected_packages)
+
+
+    def update_rcppkglist_remembered(self):
+        self.window_sensitive(False)
+
         selected_image = self.configuration.selected_image
         selected_recipes = self.configuration.selected_recipes[:]
         selected_packages = self.configuration.selected_packages[:]
 
-        self.recipe_model.image_list_append(selected_image,
-                                            " ".join(selected_recipes),
-                                            " ".join(selected_packages))
+        selected_image_desc = ""
+        if selected_image:
+            image_path = self.recipe_model.pn_path[selected_image]
+            image_iter = self.recipe_model.get_iter(image_path)
+            selected_image_desc = self.recipe_model.get_value(image_iter, self.recipe_model.COL_DESC)
 
-        self.image_configuration_page.update_image_combo(self.recipe_model, selected_image)
-        self.update_recipe_model(selected_image, selected_recipes)
-        self.update_package_model(selected_packages)
+        self.image_configuration_page.update_image_combo(self.recipe_model, selected_image, selected_image_desc)
+
+        glib.idle_add(self.update_rcppkglist_idle, selected_image, selected_recipes, selected_packages)
 
     def recipelist_changed_cb(self, recipe_model):
         self.recipe_details_page.refresh_selection()
@@ -905,7 +954,7 @@ class Builder(gtk.Window):
         if not self.configuration.curr_mach:
             self.update_config_async()
         else:
-            self.populate_recipe_package_info_async()
+            self.populate_recipe_package_info_async(mach_changed = False)
 
     def deploy_image(self, image_name):
         if not image_name:
bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +5 -25
index c2e0f5f..c63fc61 100644
@@ -21,7 +21,6 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 import gtk
-import glib
 from bb.ui.crumbs.progressbar import HobProgressBar
 from bb.ui.crumbs.hobcolor import HobColors
 from bb.ui.crumbs.hobwidget import hic, HobImageButton, HobInfoButton, HobAltButton, HobButton
@@ -259,7 +258,7 @@ class ImageConfigurationPage (HobPage):
 
         self.builder.configuration.curr_mach = combo_item
         # Do reparse recipes
-        self.builder.populate_recipe_package_info_async()
+        self.builder.populate_recipe_package_info_async(mach_changed = True)
 
     def update_machine_combo(self):
         all_machines = self.builder.parameters.all_machines
@@ -280,32 +279,11 @@ class ImageConfigurationPage (HobPage):
             active += 1
         self.machine_combo.set_active(-1)
 
-    def image_combo_changed_idle_cb(self, selected_image, selected_recipes, selected_packages):
-        self.builder.update_recipe_model(selected_image, selected_recipes)
-        self.builder.update_package_model(selected_packages)
-        self.builder.window_sensitive(True)
-
     def image_combo_changed_cb(self, combo):
-        self.builder.window_sensitive(False)
         selected_image = self.image_combo.get_active_text()
         if not selected_image:
             return
-
-        selected_recipes = []
-
-        image_path = self.builder.recipe_model.pn_path[selected_image]
-        image_iter = self.builder.recipe_model.get_iter(image_path)
-        selected_packages = self.builder.recipe_model.get_value(image_iter, self.builder.recipe_model.COL_INSTALL).split()
-
-        mark = ("<span %s>%s</span>\n") % (self.span_tag('small'), self.builder.recipe_model.get_value(image_iter, self.builder.recipe_model.COL_DESC))
-        self.image_desc.set_markup(mark)
-
-        self.builder.recipe_model.reset()
-        self.builder.package_model.reset()
-
-        self.show_baseimg_selected()
-
-        glib.idle_add(self.image_combo_changed_idle_cb, selected_image, selected_recipes, selected_packages)
+        self.builder.update_rcppkglist_forgotten(selected_image)
 
     def _image_combo_connect_signal(self):
         if not self.image_combo_id:
@@ -316,7 +294,7 @@ class ImageConfigurationPage (HobPage):
             self.image_combo.disconnect(self.image_combo_id)
             self.image_combo_id = None
 
-    def update_image_combo(self, recipe_model, selected_image):
+    def update_image_combo(self, recipe_model, selected_image, selected_image_desc):
         # Update the image combo according to the images in the recipe_model
         # populate image combo
         filter = {RecipeListModel.COL_TYPE : ['image']}
@@ -348,6 +326,8 @@ class ImageConfigurationPage (HobPage):
 
         if active != -1:
             self.show_baseimg_selected()
+            mark = "<span %s>%s</span>\n" % (self.span_tag('small'), selected_image_desc)
+            self.image_desc.set_markup(mark)
 
         self._image_combo_connect_signal()
 
Signature · 1 line
1.7.6
#21 lore raw

Re: [PATCH 20/20] Hob: change the logic for rcppkglist_populated()

Skip this patch only, I am going to send another version to fix the bug.

--
Shane

Shane Wang wrote on 2012-04-08:

Quoted 196 lines

There are some bugs in the previous log of rcppkglist_populated. [Yocto #2255] is one of them.

Once more, when the user loads a template, changes the base image to the other one which is not the same as the one in the template, changes the machine, and then you will find the base image specified in the template disappears.

This patch changes the logic as follows:
- If any template is loaded into this Hob session, its base image will be remembered always. After the recipe list and the package list are populated, the template base image will be appended. That is to fix the above bug. - If the reason for reparsing recipes is any settings are changed, Hob will remember selected_recipes and selected_packages. The behaviour is the same as before, because we don't want to clear the user selection. - If the reason for reparsing recipes is the machine is changed, including a template is loaded (which causes the machine is changed), Hob will forget selected_recipes and selected_packages the user selects. (see [Yocto #2255] for details)
- Again, we reuse the code for rcppkglist_populated() for any base image changing.
I.e., when the user changes any base image, Hob will forget the previous selected_recipes and selected_packages.
In Hob code, two places will cause recipe parsing. One is settings are changed. The other is machine is changed.

[Yocto #2255]

---
 bitbake/lib/bb/ui/crumbs/builder.py                |   65

+++++++++++++++++--- bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
| 30 ++-------- 2 files changed, 62 insertions(+), 33 deletions(-)

(quoted diff) +0 -0

b/bitbake/lib/bb/ui/crumbs/builder.py index 4997cd4..849a1f0 100755 --- a/bitbake/lib/bb/ui/crumbs/builder.py +++ b/bitbake/lib/bb/ui/crumbs/builder.py @@ -26,6 +26,7 @@ import copy
import os import subprocess import shlex +import glib from bb.ui.crumbs.template import TemplateMgr from bb.ui.crumbs.imageconfigurationpage import ImageConfigurationPage from bb.ui.crumbs.recipeselectionpage import RecipeSelectionPage

bitbake/lib/bb/ui/crumbs/builder.py +1 -0
@@ -259,6 +260,7 @@ class Builder(gtk.Window):
         self.handler = hobHandler
 
         self.template = None
+        self.loaded_images = []
 
         # build step self.current_step = None @@ -339,7 +341,8 @@ class
         Builder(gtk.Window): self.set_user_config()

self.handler.parse_generate_configuration()

bitbake/lib/bb/ui/crumbs/builder.py +9 -1
-    def populate_recipe_package_info_async(self):
+    def populate_recipe_package_info_async(self, mach_changed = True):
+        self.mach_changed = mach_changed
         self.switch_page(self.RCPPKGINFO_POPULATING) # Parse recipes
         self.set_user_config() @@ -395,6 +398,12 @@ class
         Builder(gtk.Window): self.template.load(path)
         self.configuration.load(self.template)
+        entry = {}
+        entry["image"] = self.configuration.selected_image
+        entry["recipes"] = self.configuration.selected_recipes[:]
+        entry["packages"] = self.configuration.selected_packages[:]
+        self.loaded_images.append(entry)
+
         for layer in self.configuration.layers:
             if not os.path.exists(layer+'/conf/layer.conf'):
                 return False
@@ -589,17 +598,57 @@ class Builder(gtk.Window):
         self.window_sensitive(True)
     def rcppkglist_populated(self):
+        # remember those images loaded previously in this Hob session +
       for entry in self.loaded_images: +           

self.recipe_model.image_list_append(entry["image"], + "
".join(entry["recipes"]), + " ".join(entry["packages"]))
+ + if self.mach_changed: +
self.update_rcppkglist_forgotten(self.configuration.selected_image) +
else: + self.update_rcppkglist_remembered() + + def
update_rcppkglist_idle(self, selected_image, selected_recipes,
selected_packages): + self.update_recipe_model(selected_image,
selected_recipes) + self.update_package_model(selected_packages)
+ self.window_sensitive(True) + + def
update_rcppkglist_forgotten(self, selected_image = None): +
self.window_sensitive(False) + + selected_recipes =
selected_packages = [] + self.recipe_model.reset() +
self.package_model.reset() + + selected_image_desc = "" +
if selected_image: + image_path =
self.recipe_model.pn_path[selected_image] + image_iter =
self.recipe_model.get_iter(image_path) + selected_packages =
self.recipe_model.get_value(image_iter,
self.recipe_model.COL_INSTALL).split() + selected_image_desc
= self.recipe_model.get_value(image_iter, self.recipe_model.COL_DESC) +
+ self.image_configuration_page.update_image_combo(self.recipe_model, selected_image, selected_image_desc) + + glib.idle_add(self.update_rcppkglist_idle, selected_image,
selected_recipes, selected_packages) + + + def
update_rcppkglist_remembered(self): + self.window_sensitive(False) +
selected_image = self.configuration.selected_image selected_recipes = self.configuration.selected_recipes[:] selected_packages = self.configuration.selected_packages[:]
- self.recipe_model.image_list_append(selected_image, -

                                 " ".join(selected_recipes), -          
                                 " ".join(selected_packages)) +       

selected_image_desc = "" + if selected_image: +
image_path = self.recipe_model.pn_path[selected_image] + image_iter = self.recipe_model.get_iter(image_path) + selected_image_desc = self.recipe_model.get_value(image_iter, self.recipe_model.COL_DESC)

- self.image_configuration_page.update_image_combo(self.recipe_model,
selected_image) - self.update_recipe_model(selected_image,
selected_recipes) - self.update_package_model(selected_packages)
+ self.image_configuration_page.update_image_combo(self.recipe_model, selected_image, selected_image_desc) + + glib.idle_add(self.update_rcppkglist_idle, selected_image, selected_recipes, selected_packages)

def recipelist_changed_cb(self, recipe_model):
self.recipe_details_page.refresh_selection() @@ -905,7 +954,7 @@ class Builder(gtk.Window): if not self.configuration.curr_mach:
self.update_config_async()
else:
- self.populate_recipe_package_info_async() +
self.populate_recipe_package_info_async(mach_changed = False)

def deploy_image(self, image_name):
if not image_name:

(quoted diff) +0 -0

b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py index c2e0f5f..c63fc61 100644 --- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py @@ -21,7 +21,6 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import gtk -import glib from bb.ui.crumbs.progressbar import HobProgressBar from bb.ui.crumbs.hobcolor import HobColors from bb.ui.crumbs.hobwidget import hic, HobImageButton, HobInfoButton,
HobAltButton, HobButton

bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +1 -1
@@ -259,7 +258,7 @@ class ImageConfigurationPage (HobPage):
 
         self.builder.configuration.curr_mach = combo_item
         # Do reparse recipes
-        self.builder.populate_recipe_package_info_async()
+        self.builder.populate_recipe_package_info_async(mach_changed
 = True)
 
     def update_machine_combo(self):

all_machines = self.builder.parameters.all_machines

bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +0 -1
@@ -280,32 +279,11 @@ class ImageConfigurationPage (HobPage):
             active += 1
         self.machine_combo.set_active(-1)
-    def image_combo_changed_idle_cb(self, selected_image,

selected_recipes, selected_packages): - self.builder.update_recipe_model(selected_image, selected_recipes) -
self.builder.update_package_model(selected_packages) -
self.builder.window_sensitive(True) -
def image_combo_changed_cb(self, combo):
- self.builder.window_sensitive(False)
selected_image = self.image_combo.get_active_text() if not selected_image:
return
- - selected_recipes = [] - - image_path =
self.builder.recipe_model.pn_path[selected_image] - image_iter =
self.builder.recipe_model.get_iter(image_path) - selected_packages = self.builder.recipe_model.get_value(image_iter,
self.builder.recipe_model.COL_INSTALL).split() - - mark = ("<span
%s>%s</span>\n") % (self.span_tag('small'), self.builder.recipe_model.get_value(image_iter, self.builder.recipe_model.COL_DESC)) - self.image_desc.set_markup(mark) - - self.builder.recipe_model.reset() - self.builder.package_model.reset() - - self.show_baseimg_selected() - - glib.idle_add(self.image_combo_changed_idle_cb, selected_image, selected_recipes, selected_packages) + self.builder.update_rcppkglist_forgotten(selected_image)

def _image_combo_connect_signal(self):
if not self.image_combo_id:

bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +1 -1
@@ -316,7 +294,7 @@ class ImageConfigurationPage (HobPage):
             self.image_combo.disconnect(self.image_combo_id)
             self.image_combo_id = None
-    def update_image_combo(self, recipe_model, selected_image):
+    def update_image_combo(self, recipe_model, selected_image,

selected_image_desc):
# Update the image combo according to the images in the recipe_model # populate image combo filter = {RecipeListModel.COL_TYPE : ['image']}

bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +1 -0
@@ -348,6 +326,8 @@ class ImageConfigurationPage (HobPage):
 
         if active != -1:
             self.show_baseimg_selected()
+            mark = "<span %s>%s</span>\n" % (self.span_tag('small'),
 selected_image_desc) +            self.image_desc.set_markup(mark)
 
         self._image_combo_connect_signal()