Skip to contentSkip to conversation

Hob: bug fixes

PATCH Superseded Liming An 2 participants 8 messages Mar 26, 2012 – Mar 27, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Liming An

author
#0 lore raw

cover Hob: bug fixes

These patches are to fix bugs for Hob.

The following changes since commit fb3e59c88eda5ee3a53ad04aafaa7b749ecc1cc2:

core-image-minimal-mtdutils.bb: Simple DESCRIPTION grammar fix. (2012-03-25 12:27:43 +0100)

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

Liming An (5):
Hob: add refresh icon as ui request in building log
Hob: fixed visually differentiate warnings and errors icon in
building log
Hob: change the recipe pasing error dialog icon from 'dialog-info' to
'dialog-error'
Hob: use hob icon checker to check the gtk icon for make the icon
constaintly
HOB: Splited configuration info of building log to a independently
page from the log page

 bitbake/lib/bb/ui/crumbs/builddetailspage.py |   10 +-
 bitbake/lib/bb/ui/crumbs/builder.py          |    2 +-
 bitbake/lib/bb/ui/crumbs/hig.py              |    8 +-
 bitbake/lib/bb/ui/crumbs/hobwidget.py        |  196 ++++++++++++++++++++++++++
 bitbake/lib/bb/ui/crumbs/runningbuild.py     |   46 ++++---
 5 files changed, 236 insertions(+), 26 deletions(-)
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH 1/5 Hob: add refresh icon as ui request in building log

add a refresh icon to indicator the running task, for avoid add more heavy to bitbake building process, increased the timer interval counter, and decreased the refresh icon render size.

---
 bitbake/lib/bb/ui/crumbs/hobwidget.py    |  169 ++++++++++++++++++++++++++++++
 bitbake/lib/bb/ui/crumbs/runningbuild.py |   20 +++-
 2 files changed, 185 insertions(+), 4 deletions(-)
bitbake/lib/bb/ui/crumbs/hobwidget.py +169 -0
index 8936f0a..ffdd551 100644
@@ -57,6 +57,7 @@ class hic:
     ICON_INDI_REMOVE_HOVER_FILE   = os.path.join(HOB_ICON_BASE_DIR, ('indicators/remove-hover.png'))
     ICON_INDI_ADD_FILE            = os.path.join(HOB_ICON_BASE_DIR, ('indicators/add.png'))
     ICON_INDI_ADD_HOVER_FILE      = os.path.join(HOB_ICON_BASE_DIR, ('indicators/add-hover.png'))
+    ICON_INDI_REFRESH_FILE        = os.path.join(HOB_ICON_BASE_DIR, ('indicators/refresh.png'))
 
 class hcc:
 
@@ -793,3 +794,171 @@ class HobWarpCellRendererText(gtk.CellRendererText):
         return adjwidth
 
 gobject.type_register(HobWarpCellRendererText)
+
+class RefreshRuningController(gobject.GObject):
+    def __init__(self, widget=None, iter=None):
+        gobject.GObject.__init__(self)
+        self.timeout_id = None
+        self.current_angle_pos = 0.0
+        self.step_angle = 0.0
+        self.tree_headers_height = 0
+        self.running_cell_areas = []
+
+    def is_active(self):
+        if self.timeout_id:
+            return True
+        else:
+            return False
+
+    def reset(self):
+        self.force_stop(True)
+        self.current_angle_pos = 0.0
+        self.timeout_id = None
+        self.step_angle = 0.0
+
+    ''' time_iterval: (1~1000)ms, which will be as the basic interval count for timer
+        init_usrdata: the current data which related the progress-bar will be at
+        min_usrdata: the range of min of user data
+        max_usrdata: the range of max of user data
+        step: each step which you want to progress
+        Note: the init_usrdata should in the range of from min to max, and max should > min
+             step should < (max - min)
+    '''
+    def start_run(self, time_iterval, init_usrdata, min_usrdata, max_usrdata, step, tree):
+        if (not time_iterval) or (not max_usrdata):
+            return
+        usr_range = (max_usrdata - min_usrdata) * 1.0
+        self.current_angle_pos = (init_usrdata * 1.0) / usr_range
+        self.step_angle = (step * 1) / usr_range
+        self.timeout_id = gobject.timeout_add(int(time_iterval),
+        self.make_image_on_progressing_cb, tree)
+        self.tree_headers_height = self.get_treeview_headers_height(tree)
+
+    def force_stop(self, after_hide_or_not=False):
+        if self.timeout_id:
+            gobject.source_remove(self.timeout_id)
+            self.timeout_id = None
+        if self.running_cell_areas:
+            self.running_cell_areas = []
+
+    def on_draw_cb(self, pixbuf, cr, x, y, img_width, img_height, do_refresh=True):
+        if pixbuf:
+            r = max(img_width/2, img_height/2)
+            cr.translate(x + r, y + r)
+            if do_refresh:
+                cr.rotate(2 * math.pi * self.current_angle_pos)
+
+            cr.set_source_pixbuf(pixbuf, -img_width/2, -img_height/2)
+            cr.paint()
+
+    def get_treeview_headers_height(self, tree):
+        if tree and (tree.get_property("headers-visible") == True):
+            height = tree.get_allocation().height - tree.get_bin_window().get_size()[1]
+            return height
+
+        return 0
+
+    def make_image_on_progressing_cb(self, tree):
+        self.current_angle_pos += self.step_angle
+        if (self.current_angle_pos >= 1):
+            self.current_angle_pos = self.step_angle
+
+        for rect in self.running_cell_areas:
+            tree.queue_draw_area(rect.x, rect.y + self.tree_headers_height, rect.width, rect.height)
+
+        return True
+
+    def append_running_cell_area(self, cell_area):
+        if cell_area and (cell_area not in self.running_cell_areas):
+            self.running_cell_areas.append(cell_area)
+
+    def remove_running_cell_area(self, cell_area):
+        if cell_area in self.running_cell_areas:
+            self.running_cell_areas.remove(cell_area)
+        if not self.running_cell_areas:
+            self.reset()
+
+gobject.type_register(RefreshRuningController)
+
+class HobCellRendererPixbuf(gtk.CellRendererPixbuf):
+    def __init__(self):
+        gtk.CellRendererPixbuf.__init__(self)
+        self.control = RefreshRuningController()
+        # create default refrensh stock icon
+        self.set_hob_icon_to_stock_icon(hic.ICON_INDI_REFERENCE_FILE, "task-refresh")
+
+    def set_hob_icon_to_stock_icon(self, file_path, stock_id=""):
+        try:
+            pixbuf = gtk.gdk.pixbuf_new_from_file(file_path)
+        except Exception, e:
+            return None
+
+        if pixbuf and stock_id and (gtk.icon_factory_lookup_default(stock_id) == None):
+            icon_factory = gtk.IconFactory()
+            icon_factory.add_default()
+            icon_factory.add(stock_id, gtk.IconSet(pixbuf))
+            gtk.stock_add([(stock_id, '_label', 0, 0, '')])
+
+            return icon_factory.lookup(stock_id)
+
+        return None
+
+    def get_pixbuf_from_stock_icon(self, widget, stock_id="", size=gtk.ICON_SIZE_DIALOG):
+        if widget and stock_id and gtk.icon_factory_lookup_default(stock_id):
+            return widget.render_icon(stock_id, size)
+
+        return None
+
+    def set_icon_name_to_id(self, name):
+        if name and type(name) == str:
+            if name.startswith("gtk") or name == "task-refresh":
+                stock_id = name
+            else:
+                stock_id = 'gtk-' + name
+
+        return stock_id
+
+    ''' render cell exactly, "icon-name" is priority
+        if use the 'task-refresh' will make the pix animation
+        if 'pix' will change the pixbuf for it from the pixbuf or image.
+    '''
+    def do_render(self, window, tree, background_area,cell_area, expose_area, flags):
+        if (not self.control) or (not tree):
+            return
+
+        x, y, w, h = self.on_get_size(tree, cell_area)
+        x += cell_area.x
+        y += cell_area.y
+        w -= 2 * self.get_property("xpad")
+        h -= 2 * self.get_property("ypad")
+
+        stock_id = ""
+        if self.props.icon_name:
+            stock_id = self.set_icon_name_to_id(self.props.icon_name)
+        elif self.props.stock_id:
+            stock_id = self.props.stock_id
+        elif self.props.pixbuf:
+            pix = self.props.pixbuf
+        else:
+            return
+
+        if stock_id:
+            pix = self.get_pixbuf_from_stock_icon(tree, stock_id, self.props.stock_size)
+        if stock_id == 'task-refresh':
+            self.control.append_running_cell_area(cell_area)
+            if self.control.is_active():
+                self.control.on_draw_cb(pix, window.cairo_create(), x, y, w, h, True)
+            else:
+                self.control.start_run(200, 0, 0, 1000, 200, tree)
+        else:
+            self.control.remove_running_cell_area(cell_area)
+            self.control.on_draw_cb(pix, window.cairo_create(), x, y, w, h, False)
+
+    def on_get_size(self, widget, cell_area):
+        if self.props.icon_name or self.props.pixbuf or self.props.stock_id:
+            w, h = gtk.icon_size_lookup(self.props.stock_size)
+            return 0, 0, w, h
+
+        return 0, 0, 0, 0
+
+gobject.type_register(HobCellRendererPixbuf)
bitbake/lib/bb/ui/crumbs/runningbuild.py +16 -4
index 0f58e4e..aecfadf 100644
@@ -27,7 +27,7 @@ import urllib
 import urllib2
 import pango
 from bb.ui.crumbs.hobcolor import HobColors
-from bb.ui.crumbs.hobwidget import HobWarpCellRendererText
+from bb.ui.crumbs.hobwidget import HobWarpCellRendererText, HobCellRendererPixbuf
 
 class RunningBuildModel (gtk.TreeStore):
     (COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_COLOR, COL_NUM_ACTIVE) = range(7)
@@ -68,6 +68,14 @@ class RunningBuildModel (gtk.TreeStore):
         model.set_visible_func(self.failure_model_filter)
         return model
 
+    def foreach_cell_func(self, model, path, iter, usr_data=None):
+        if model.get_value(iter, self.COL_ICON) == "task-refresh":
+            model.set(iter, self.COL_ICON, "")
+
+    def close_task_refresh(self):
+        self.foreach(self.foreach_cell_func, None)
+
+
 class RunningBuild (gobject.GObject):
     __gsignals__ = {
           'build-started'   :  (gobject.SIGNAL_RUN_LAST,
@@ -189,7 +197,7 @@ class RunningBuild (gobject.GObject):
             # Because this parent package now has an active child mark it as
             # such.
             # @todo if parent is already in error, don't mark it green
-            self.model.set(parent, self.model.COL_ICON, "gtk-execute",
+            self.model.set(parent, self.model.COL_ICON, "task-refresh",
                            self.model.COL_COLOR, HobColors.RUNNING)
 
             # Add an entry in the model for this task
@@ -197,7 +205,7 @@ class RunningBuild (gobject.GObject):
                                             package,
                                             task,
                                             "Task: %s" % (task),
-                                            "gtk-execute",
+                                            "task-refresh",
                                             HobColors.RUNNING,
                                             0))
 
@@ -284,6 +292,8 @@ class RunningBuild (gobject.GObject):
             # Emit a generic "build-complete" signal for things wishing to
             # handle when the build is finished
             self.emit("build-complete")
+            # reset the all cell's icon indicator
+            self.model.close_task_refresh()
             if pbar:
                 pbar.set_text(event.msg)
 
@@ -292,6 +302,8 @@ class RunningBuild (gobject.GObject):
                 # If the command fails with an exit code we're done, emit the
                 # generic signal for the UI to notify the user
                 self.emit("build-complete")
+                # reset the all cell's icon indicator
+                self.model.close_task_refresh()
 
         elif isinstance(event, bb.event.CacheLoadStarted) and pbar:
             pbar.set_title("Loading cache")
@@ -346,7 +358,7 @@ class RunningBuildTreeView (gtk.TreeView):
         self.readonly = readonly
 
         # The icon that indicates whether we're building or failed.
-        renderer = gtk.CellRendererPixbuf ()
+        renderer = HobCellRendererPixbuf ()
         col = gtk.TreeViewColumn ("Status", renderer)
         col.add_attribute (renderer, "icon-name", 4)
         self.append_column (col)
Signature · 1 line
1.7.5.4
author
#2 lore raw

PATCH 2/5 Hob: fixed visually differentiate warnings and errors icon in building log

fixed the bug of 'error' and 'warning' icon is not constaintly with hob ui design

[YOCTO #2097]

---
 bitbake/lib/bb/ui/crumbs/hobwidget.py |   67 +++++++++++++++++++++++----------
 1 files changed, 47 insertions(+), 20 deletions(-)
bitbake/lib/bb/ui/crumbs/hobwidget.py +47 -20
index ffdd551..21c54d6 100644
@@ -58,6 +58,8 @@ class hic:
     ICON_INDI_ADD_FILE            = os.path.join(HOB_ICON_BASE_DIR, ('indicators/add.png'))
     ICON_INDI_ADD_HOVER_FILE      = os.path.join(HOB_ICON_BASE_DIR, ('indicators/add-hover.png'))
     ICON_INDI_REFRESH_FILE        = os.path.join(HOB_ICON_BASE_DIR, ('indicators/refresh.png'))
+    ICON_INDI_ALERT_FILE          = os.path.join(HOB_ICON_BASE_DIR, ('indicators/alert.png'))
+    ICON_INDI_TICK_FILE           = os.path.join(HOB_ICON_BASE_DIR, ('indicators/tick.png'))
 
 class hcc:
 
@@ -795,6 +797,44 @@ class HobWarpCellRendererText(gtk.CellRendererText):
 
 gobject.type_register(HobWarpCellRendererText)
 
+class HobIconChecker(hic):
+    def set_hob_icon_to_stock_icon(self, file_path, stock_id=""):
+        try:
+            pixbuf = gtk.gdk.pixbuf_new_from_file(file_path)
+        except Exception, e:
+            return None
+
+        if stock_id and (gtk.icon_factory_lookup_default(stock_id) == None):
+            icon_factory = gtk.IconFactory()
+            icon_factory.add_default()
+            icon_factory.add(stock_id, gtk.IconSet(pixbuf))
+            gtk.stock_add([(stock_id, '_label', 0, 0, '')])
+
+            return icon_factory.lookup(stock_id)
+
+        return None
+
+    """
+    For make hob icon consistently by request, and avoid icon view diff by system or gtk version, we use some 'hob icon' to replace the 'gtk icon'.
+    this function check the stock_id and make hob_id to replaced the gtk_id then return it or ""
+    """
+    def check_stock_icon(self, stock_name=""):
+        HOB_CHECK_STOCK_NAME = {
+            ('hic-dialog-info', 'gtk-dialog-info', 'dialog-info')           : self.ICON_INFO_DISPLAY_FILE,
+            ('hic-ok',          'gtk-ok',           'ok')                   : self.ICON_INDI_TICK_FILE,
+            ('hic-dialog-error', 'gtk-dialog-error', 'dialog-error')        : self.ICON_INDI_ERROR_FILE,
+            ('hic-dialog-warning', 'gtk-dialog-warning', 'dialog-warning')  : self.ICON_INDI_ALERT_FILE,
+        }
+        valid_stock_id = stock_name
+        if stock_name:
+            for names, path in HOB_CHECK_STOCK_NAME.iteritems():
+                if stock_name in names:
+                    valid_stock_id = names[0]
+                    if not gtk.icon_factory_lookup_default(valid_stock_id):
+                        self.set_hob_icon_to_stock_icon(path, valid_stock_id)
+
+        return valid_stock_id
+
 class RefreshRuningController(gobject.GObject):
     def __init__(self, widget=None, iter=None):
         gobject.GObject.__init__(self)
@@ -885,23 +925,8 @@ class HobCellRendererPixbuf(gtk.CellRendererPixbuf):
         gtk.CellRendererPixbuf.__init__(self)
         self.control = RefreshRuningController()
         # create default refrensh stock icon
-        self.set_hob_icon_to_stock_icon(hic.ICON_INDI_REFERENCE_FILE, "task-refresh")
-
-    def set_hob_icon_to_stock_icon(self, file_path, stock_id=""):
-        try:
-            pixbuf = gtk.gdk.pixbuf_new_from_file(file_path)
-        except Exception, e:
-            return None
-
-        if pixbuf and stock_id and (gtk.icon_factory_lookup_default(stock_id) == None):
-            icon_factory = gtk.IconFactory()
-            icon_factory.add_default()
-            icon_factory.add(stock_id, gtk.IconSet(pixbuf))
-            gtk.stock_add([(stock_id, '_label', 0, 0, '')])
-
-            return icon_factory.lookup(stock_id)
-
-        return None
+        self.checker = HobIconChecker()
+        self.checker.set_hob_icon_to_stock_icon(hic.ICON_INDI_REFERENCE_FILE, "task-refresh")
 
     def get_pixbuf_from_stock_icon(self, widget, stock_id="", size=gtk.ICON_SIZE_DIALOG):
         if widget and stock_id and gtk.icon_factory_lookup_default(stock_id):
@@ -909,9 +934,11 @@ class HobCellRendererPixbuf(gtk.CellRendererPixbuf):
 
         return None
 
-    def set_icon_name_to_id(self, name):
-        if name and type(name) == str:
-            if name.startswith("gtk") or name == "task-refresh":
+    def set_icon_name_to_id(self, new_name):
+        if new_name and type(new_name) == str:
+            # check the name is need to transfer to hob icon or not
+            name = self.checker.check_stock_icon(new_name)
+            if name.startswith("hic") or name.startswith("gtk") or name == "task-refresh":
                 stock_id = name
             else:
                 stock_id = 'gtk-' + name
Signature · 1 line
1.7.5.4
author
#3 lore raw

PATCH 3/5 Hob: change the recipe pasing error dialog icon from 'dialog-info' to 'dialog-error'

In reply to Liming An

[YOCTO #2109]

---
 bitbake/lib/bb/ui/crumbs/builder.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +1 -1
index f32a066..7bf12e2 100755
@@ -834,7 +834,7 @@ class Builder(gtk.Window):
                 lbl = lbl + "kernel path:" + kernel_path + "\n"
                 lbl = lbl + "source environment path:" + source_env_path + "\n"
                 lbl = lbl + "tmp path: " + tmp_path + "."
-                dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
+                dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
                 dialog.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
                 dialog.run()
                 dialog.destroy()
Signature · 1 line
1.7.5.4
author
#4 lore raw

PATCH 4/5 Hob: use hob icon checker to check the gtk icon for make the icon constaintly

In reply to Liming An

Because we have hob icon, so need to make some gtk icon to transfer to hob icon. so use hob icon checker to fixed the gtk icon

[YOCTO #2108]

---
 bitbake/lib/bb/ui/crumbs/hig.py |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
bitbake/lib/bb/ui/crumbs/hig.py +3 -5
index 6ae682b..d151fc4 100644
@@ -28,7 +28,7 @@ import re
 import subprocess
 import shlex
 from bb.ui.crumbs.hobcolor import HobColors
-from bb.ui.crumbs.hobwidget import hcc, hic, HobViewTable, HobInfoButton
+from bb.ui.crumbs.hobwidget import hcc, hic, HobViewTable, HobInfoButton, HobAltButton, HobIconChecker
 from bb.ui.crumbs.progressbar import HobProgressBar
 
 """
@@ -75,10 +75,8 @@ class CrumbsMessageDialog(CrumbsDialog):
 
         self.icon = gtk.Image()
         # We have our own Info icon which should be used in preference of the stock icon
-        if icon == gtk.STOCK_INFO or icon == "gtk-dialog-info":
-            self.icon.set_from_file(hic.ICON_INFO_DISPLAY_FILE)
-        else:
-            self.icon.set_from_stock(icon, gtk.ICON_SIZE_DIALOG)
+        self.icon_chk = HobIconChecker()
+        self.icon.set_from_stock(self.icon_chk.check_stock_icon(icon), gtk.ICON_SIZE_DIALOG)
         self.icon.set_property("yalign", 0.00)
         self.icon.show()
         first_row.add(self.icon)
Signature · 1 line
1.7.5.4
author
#5 lore raw

PATCH 5/5 HOB: Splited configuration info of building log to a independently page from the log page

In reply to Liming An

Make the building log config information to a new page as request

[YOCTO #2144]

---
 bitbake/lib/bb/ui/crumbs/builddetailspage.py |   10 ++++++++--
 bitbake/lib/bb/ui/crumbs/runningbuild.py     |   26 ++++++++++++--------------
 2 files changed, 20 insertions(+), 16 deletions(-)
bitbake/lib/bb/ui/crumbs/builddetailspage.py +8 -2
index c2f980f..362f63d 100755
@@ -60,8 +60,6 @@ class BuildDetailsPage (HobPage):
 
         self.notebook = HobNotebook()
         self.config_tv = BuildConfigurationTreeView()
-        self.config_model = self.builder.handler.build.model.config_model()
-        self.config_tv.set_model(self.config_model)
         self.scrolled_view_config = gtk.ScrolledWindow ()
         self.scrolled_view_config.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
         self.scrolled_view_config.add(self.config_tv)
@@ -82,6 +80,7 @@ class BuildDetailsPage (HobPage):
         self.scrolled_view_build.add(self.build_tv)
         self.notebook.append_page(self.scrolled_view_build, gtk.Label("Log"))
 
+        self.builder.handler.build.model.connect('update-config-info', self.update_config_model_cb)
         self.builder.handler.build.model.connect_after("row-changed", self.scroll_to_present_row, self.scrolled_view_build.get_vadjustment(), self.build_tv)
 
         self.button_box = gtk.HBox(False, 6)
@@ -158,3 +157,10 @@ class BuildDetailsPage (HobPage):
                 self.endpath = path
                 if v_adj.value == (v_adj.upper - v_adj.page_size): # check the gtk.adjustment position is at end boundary or not
                     treeview.scroll_to_cell(path)
+
+    def update_config_model_cb(self, origin, msg):
+        if msg and type(msg) == str:
+            import gobject
+            config_model = gtk.ListStore(gobject.TYPE_STRING)
+            config_model.append([msg])
+            self.config_tv.set_model(config_model)
bitbake/lib/bb/ui/crumbs/runningbuild.py +12 -14
index aecfadf..98cba79 100644
@@ -32,6 +32,11 @@ from bb.ui.crumbs.hobwidget import HobWarpCellRendererText, HobCellRendererPixbu
 class RunningBuildModel (gtk.TreeStore):
     (COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_COLOR, COL_NUM_ACTIVE) = range(7)
 
+    __gsignals__ = {
+          'update-config-info' : (gobject.SIGNAL_RUN_LAST,
+                               gobject.TYPE_NONE,
+                               (gobject.TYPE_STRING,)),
+    }
     def __init__ (self):
         gtk.TreeStore.__init__ (self,
                                 gobject.TYPE_STRING,
@@ -42,14 +47,6 @@ class RunningBuildModel (gtk.TreeStore):
                                 gobject.TYPE_STRING,
                                 gobject.TYPE_INT)
 
-    def config_model_filter(self, model, it):
-        msg = model.get(it, self.COL_MESSAGE)[0]
-        if not msg or type(msg) != str:
-            return False
-        if msg.startswith("\nOE Build Configuration:\n"):
-            return True
-        return False
-
     def failure_model_filter(self, model, it):
         color = model.get(it, self.COL_COLOR)[0]
         if not color:
@@ -58,11 +55,6 @@ class RunningBuildModel (gtk.TreeStore):
             return True
         return False
 
-    def config_model(self):
-        model = self.filter_new()
-        model.set_visible_func(self.config_model_filter)
-        return model
-
     def failure_model(self):
         model = self.filter_new()
         model.set_visible_func(self.failure_model_filter)
@@ -75,6 +67,8 @@ class RunningBuildModel (gtk.TreeStore):
     def close_task_refresh(self):
         self.foreach(self.foreach_cell_func, None)
 
+    def update_configuration_info(self, msg):
+        self.emit("update-config-info", msg)
 
 class RunningBuild (gobject.GObject):
     __gsignals__ = {
@@ -138,6 +132,10 @@ class RunningBuild (gobject.GObject):
             # mask the error message as it's not informative for the user.
             if event.msg.startswith("Execution of event handler 'run_buildstats' failed"):
                 return
+            # split the configuration info to a independent view page
+            if event.msg.startswith("\nOE Build Configuration:\n"):
+                self.model.update_configuration_info(event.msg)
+                return
 
             if (event.levelno < logging.INFO or
                 event.msg.startswith("Running task")):
@@ -434,7 +432,7 @@ class BuildConfigurationTreeView(gtk.TreeView):
 
         # The message of the build.
         self.message_renderer = HobWarpCellRendererText (col_number=0)
-        self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=RunningBuildModel.COL_MESSAGE, background=RunningBuildModel.COL_COLOR)
+        self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=0)
         font = self.get_style().font_desc
         font.set_size(pango.SCALE * 13)
         self.message_renderer.set_property('font-desc', font)
Signature · 1 line
1.7.5.4
#6 lore raw

Re: [PATCH 5/5] HOB: Splited configuration info of building log to a independently page from the log page

Liming An wrote on 2012-03-26:

Quoted 103 lines

Make the building log config information to a new page as request

[YOCTO #2144]

---
 bitbake/lib/bb/ui/crumbs/builddetailspage.py |   10 ++++++++--
 bitbake/lib/bb/ui/crumbs/runningbuild.py     |   26

++++++++++++-------------- 2 files changed, 20 insertions(+), 16 deletions(-)

(quoted diff) +0 -0

b/bitbake/lib/bb/ui/crumbs/builddetailspage.py index c2f980f..362f63d 100755 --- a/bitbake/lib/bb/ui/crumbs/builddetailspage.py +++ b/bitbake/lib/bb/ui/crumbs/builddetailspage.py @@ -60,8 +60,6 @@ class BuildDetailsPage (HobPage):

self.notebook = HobNotebook()
self.config_tv = BuildConfigurationTreeView()
- self.config_model =
self.builder.handler.build.model.config_model() - self.config_tv.set_model(self.config_model)
self.scrolled_view_config = gtk.ScrolledWindow () self.scrolled_view_config.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS) self.scrolled_view_config.add(self.config_tv) @@ -82,6 +80,7 @@ class BuildDetailsPage (HobPage):
self.scrolled_view_build.add(self.build_tv) self.notebook.append_page(self.scrolled_view_build,
gtk.Label("Log"))

+ self.builder.handler.build.model.connect('update-config-info',
self.update_config_model_cb)
self.builder.handler.build.model.connect_after("row-changed",
self.scroll_to_present_row, self.scrolled_view_build.get_vadjustment(), self.build_tv)

self.button_box = gtk.HBox(False, 6)

(quoted diff) +0 -0
@@ -158,3 +157,10 @@ class BuildDetailsPage (HobPage):
                 self.endpath = path
                 if v_adj.value == (v_adj.upper - v_adj.page_size): #

check the gtk.adjustment position is at end boundary or not
treeview.scroll_to_cell(path)
+ + def update_config_model_cb(self, origin, msg): + if msg
and type(msg) == str: + import gobject +
config_model = gtk.ListStore(gobject.TYPE_STRING) + config_model.append([msg]) + self.config_tv.set_model(config_model) diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py index aecfadf..98cba79 100644 --- a/bitbake/lib/bb/ui/crumbs/runningbuild.py +++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py @@ -32,6 +32,11 @@ from bb.ui.crumbs.hobwidget import HobWarpCellRendererText, HobCellRendererPixbu
class RunningBuildModel (gtk.TreeStore):
(COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON,
COL_COLOR, COL_NUM_ACTIVE) = range(7)

bitbake/lib/bb/ui/crumbs/runningbuild.py +7 -13
+    __gsignals__ = {
+          'update-config-info' : (gobject.SIGNAL_RUN_LAST,
+                               gobject.TYPE_NONE,
+                               (gobject.TYPE_STRING,)),
+    }
     def __init__ (self):
         gtk.TreeStore.__init__ (self,
                                 gobject.TYPE_STRING, @@ -42,14 +47,6 @@
                                 class RunningBuildModel
                                 (gtk.TreeStore): gobject.TYPE_STRING,
                                 gobject.TYPE_INT)
-    def config_model_filter(self, model, it):
-        msg = model.get(it, self.COL_MESSAGE)[0]
-        if not msg or type(msg) != str:
-            return False
-        if msg.startswith("\nOE Build Configuration:\n"):
-            return True
-        return False
-
     def failure_model_filter(self, model, it):
         color = model.get(it, self.COL_COLOR)[0]
         if not color:
@@ -58,11 +55,6 @@ class RunningBuildModel (gtk.TreeStore):
             return True
         return False
-    def config_model(self):
-        model = self.filter_new()
-        model.set_visible_func(self.config_model_filter)
-        return model
-
     def failure_model(self):
         model = self.filter_new()
         model.set_visible_func(self.failure_model_filter)
@@ -75,6 +67,8 @@ class RunningBuildModel (gtk.TreeStore):
     def close_task_refresh(self):
         self.foreach(self.foreach_cell_func, None)
+    def update_configuration_info(self, msg):
+        self.emit("update-config-info", msg)
 
 class RunningBuild (gobject.GObject):
     __gsignals__ = {
@@ -138,6 +132,10 @@ class RunningBuild (gobject.GObject):
             # mask the error message as it's not informative for the user.
             if event.msg.startswith("Execution of event handler

'run_buildstats' failed"):
return

bitbake/lib/bb/ui/crumbs/runningbuild.py class RunningBuild (gobject.GObject): · line 138

Quoted 4 lines
bitbake/lib/bb/ui/crumbs/runningbuild.py +4 -0
+            # split the configuration info to a independent view page
+            if event.msg.startswith("\nOE Build Configuration:\n"):
+                self.model.update_configuration_info(event.msg)
+                return

Still heavy? A better way we can do is to collect self.configuration from builder.py and show it on the build details screen when build starts.

Quoted 14 lines

if (event.levelno < logging.INFO or
event.msg.startswith("Running task")):

bitbake/lib/bb/ui/crumbs/runningbuild.py +0 -0
@@ -434,7 +432,7 @@ class BuildConfigurationTreeView(gtk.TreeView):
 
         # The message of the build.
         self.message_renderer = HobWarpCellRendererText

(col_number=0) - self.message_column = gtk.TreeViewColumn
("Message", self.message_renderer, text=RunningBuildModel.COL_MESSAGE,
background=RunningBuildModel.COL_COLOR) + self.message_column =
gtk.TreeViewColumn ("Message", self.message_renderer, text=0)
font = self.get_style().font_desc font.set_size(pango.SCALE * 13) self.message_renderer.set_property('font-desc', font)

#7 lore raw

Re: [PATCH 1/5] Hob: add refresh icon as ui request in building log

In reply to Liming An

Liming An wrote on 2012-03-26:

Quoted 189 lines

add a refresh icon to indicator the running task, for avoid add more heavy to bitbake building process, increased the timer interval counter, and decreased the refresh icon render size.

---
 bitbake/lib/bb/ui/crumbs/hobwidget.py    |  169

++++++++++++++++++++++++++++++ bitbake/lib/bb/ui/crumbs/runningbuild.py
| 20 +++- 2 files changed, 185 insertions(+), 4 deletions(-)

(quoted diff) +0 -0

b/bitbake/lib/bb/ui/crumbs/hobwidget.py index 8936f0a..ffdd551 100644 --- a/bitbake/lib/bb/ui/crumbs/hobwidget.py +++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py @@ -57,6 +57,7 @@ class hic:
ICON_INDI_REMOVE_HOVER_FILE = os.path.join(HOB_ICON_BASE_DIR,
('indicators/remove-hover.png')) ICON_INDI_ADD_FILE =
os.path.join(HOB_ICON_BASE_DIR, ('indicators/add.png'))
ICON_INDI_ADD_HOVER_FILE =
os.path.join(HOB_ICON_BASE_DIR, ('indicators/add-hover.png'))
+ ICON_INDI_REFRESH_FILE =
os.path.join(HOB_ICON_BASE_DIR, ('indicators/refresh.png'))

class hcc:

(quoted diff) +0 -0
@@ -793,3 +794,171 @@ class

HobWarpCellRendererText(gtk.CellRendererText):
return adjwidth
gobject.type_register(HobWarpCellRendererText)
+ +class RefreshRuningController(gobject.GObject): + def
__init__(self, widget=None, iter=None): +
gobject.GObject.__init__(self) + self.timeout_id = None +
self.current_angle_pos = 0.0 + self.step_angle = 0.0 +
self.tree_headers_height = 0 + self.running_cell_areas = [] + +
def is_active(self): + if self.timeout_id: + return
True + else: + return False + + def reset(self): +
self.force_stop(True) + self.current_angle_pos = 0.0 +
self.timeout_id = None + self.step_angle = 0.0 + + '''
time_iterval: (1~1000)ms, which will be as the basic interval count for
timer + init_usrdata: the current data which related the
progress-bar will be at + min_usrdata: the range of min of user
data + max_usrdata: the range of max of user data + step:
each step which you want to progress + Note: the init_usrdata
should in the range of from min to max, and max should > min +
step should < (max - min) + ''' + def start_run(self,
time_iterval, init_usrdata, min_usrdata, max_usrdata, step, tree): +
if (not time_iterval) or (not max_usrdata): + return +
usr_range = (max_usrdata - min_usrdata) * 1.0 +
self.current_angle_pos = (init_usrdata * 1.0) / usr_range +
self.step_angle = (step * 1) / usr_range + self.timeout_id =
gobject.timeout_add(int(time_iterval), + self.make_image_on_progressing_cb, tree) + self.tree_headers_height = self.get_treeview_headers_height(tree) + +
def force_stop(self, after_hide_or_not=False): + if
self.timeout_id: + gobject.source_remove(self.timeout_id) +
self.timeout_id = None + if self.running_cell_areas: +
self.running_cell_areas = [] + + def on_draw_cb(self,
pixbuf, cr, x, y, img_width, img_height, do_refresh=True): + if
pixbuf: + r = max(img_width/2, img_height/2) +
cr.translate(x + r, y + r) + if do_refresh: +
cr.rotate(2 * math.pi * self.current_angle_pos) + + cr.set_source_pixbuf(pixbuf, -img_width/2, -img_height/2) +
cr.paint() + + def get_treeview_headers_height(self, tree): +
if tree and (tree.get_property("headers-visible") == True): + height = tree.get_allocation().height -
tree.get_bin_window().get_size()[1] + return height + +
return 0 + + def make_image_on_progressing_cb(self, tree): +
self.current_angle_pos += self.step_angle + if
(self.current_angle_pos >= 1): + self.current_angle_pos =
self.step_angle + + for rect in self.running_cell_areas: +
tree.queue_draw_area(rect.x, rect.y + self.tree_headers_height,
rect.width, rect.height) + + return True + + def
append_running_cell_area(self, cell_area): + if cell_area and
(cell_area not in self.running_cell_areas): +
self.running_cell_areas.append(cell_area) + + def
remove_running_cell_area(self, cell_area): + if cell_area in
self.running_cell_areas: +
self.running_cell_areas.remove(cell_area) + if not
self.running_cell_areas: + self.reset() +
+gobject.type_register(RefreshRuningController) + +class
HobCellRendererPixbuf(gtk.CellRendererPixbuf): + def __init__(self):
+ gtk.CellRendererPixbuf.__init__(self) + self.control =
RefreshRuningController() + # create default refrensh stock icon
+ self.set_hob_icon_to_stock_icon(hic.ICON_INDI_REFERENCE_FILE,
"task-refresh") + + def set_hob_icon_to_stock_icon(self, file_path,
stock_id=""): + try: + pixbuf =
gtk.gdk.pixbuf_new_from_file(file_path) + except Exception, e: +
return None + + if pixbuf and stock_id and
(gtk.icon_factory_lookup_default(stock_id) == None): +
icon_factory = gtk.IconFactory() + icon_factory.add_default()
+ icon_factory.add(stock_id, gtk.IconSet(pixbuf)) +
gtk.stock_add([(stock_id, '_label', 0, 0, '')]) + + return
icon_factory.lookup(stock_id) + + return None + + def
get_pixbuf_from_stock_icon(self, widget, stock_id="",
size=gtk.ICON_SIZE_DIALOG): + if widget and stock_id and
gtk.icon_factory_lookup_default(stock_id): + return
widget.render_icon(stock_id, size) + + return None + + def
set_icon_name_to_id(self, name): + if name and type(name) == str:
+ if name.startswith("gtk") or name == "task-refresh": +
stock_id = name + else: + stock_id =
'gtk-' + name + + return stock_id + + ''' render cell exactly,
"icon-name" is priority + if use the 'task-refresh' will make the
pix animation + if 'pix' will change the pixbuf for it from the
pixbuf or image. + ''' + def do_render(self, window, tree,
background_area,cell_area, expose_area, flags): + if (not
self.control) or (not tree): + return + + x, y, w, h =
self.on_get_size(tree, cell_area) + x += cell_area.x + y

+= cell_area.y +        w -= 2 * self.get_property("xpad") +        h -=
2 * self.get_property("ypad") + +        stock_id = "" +        if
self.props.icon_name: +            stock_id =
self.set_icon_name_to_id(self.props.icon_name) +        elif
self.props.stock_id: +            stock_id = self.props.stock_id +      
 elif self.props.pixbuf: +            pix = self.props.pixbuf +       
else: +            return + +        if stock_id: +            pix =
self.get_pixbuf_from_stock_icon(tree, stock_id, self.props.stock_size) +
       if stock_id == 'task-refresh': +           
self.control.append_running_cell_area(cell_area) +            if
self.control.is_active(): +                self.control.on_draw_cb(pix,
window.cairo_create(), x, y, w, h, True) +            else: +           
    self.control.start_run(200, 0, 0, 1000, 200, tree) +        else: + 
          self.control.remove_running_cell_area(cell_area) +           

self.control.on_draw_cb(pix, window.cairo_create(), x, y, w, h, False) +
+ def on_get_size(self, widget, cell_area): + if
self.props.icon_name or self.props.pixbuf or self.props.stock_id: +
w, h = gtk.icon_size_lookup(self.props.stock_size) +
return 0, 0, w, h + + return 0, 0, 0, 0 +
+gobject.type_register(HobCellRendererPixbuf) diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py index 0f58e4e..aecfadf 100644 --- a/bitbake/lib/bb/ui/crumbs/runningbuild.py +++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py @@ -27,7 +27,7 @@ import urllib
import urllib2
import pango
from bb.ui.crumbs.hobcolor import HobColors
-from bb.ui.crumbs.hobwidget import HobWarpCellRendererText +from bb.ui.crumbs.hobwidget import HobWarpCellRendererText, HobCellRendererPixbuf

class RunningBuildModel (gtk.TreeStore):
(COL_LOG, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON,
COL_COLOR, COL_NUM_ACTIVE) = range(7)

bitbake/lib/bb/ui/crumbs/runningbuild.py +9 -1
@@ -68,6 +68,14 @@ class RunningBuildModel (gtk.TreeStore):
         model.set_visible_func(self.failure_model_filter)
         return model
+    def foreach_cell_func(self, model, path, iter, usr_data=None):
+        if model.get_value(iter, self.COL_ICON) == "task-refresh":
+            model.set(iter, self.COL_ICON, "")
+
+    def close_task_refresh(self):
+        self.foreach(self.foreach_cell_func, None)
+
+
 class RunningBuild (gobject.GObject):
     __gsignals__ = {
           'build-started'   :  (gobject.SIGNAL_RUN_LAST,
@@ -189,7 +197,7 @@ class RunningBuild (gobject.GObject):
             # Because this parent package now has an active child mark
             it as # such. # @todo if parent is already in error, don't
             mark it green
-            self.model.set(parent, self.model.COL_ICON, "gtk-execute",
+            self.model.set(parent, self.model.COL_ICON, "task-refresh",
                            self.model.COL_COLOR,
 HobColors.RUNNING)
 

# Add an entry in the model for this task

bitbake/lib/bb/ui/crumbs/runningbuild.py +5 -1
@@ -197,7 +205,7 @@ class RunningBuild (gobject.GObject):
                                             package,
                                             task,
                                             "Task: %s" % (task),
-                                            "gtk-execute",
+                                            "task-refresh",
                                             HobColors.RUNNING,
                                             0))
@@ -284,6 +292,8 @@ class RunningBuild (gobject.GObject):
             # Emit a generic "build-complete" signal for things wishing to
             # handle when the build is finished
             self.emit("build-complete")
+            # reset the all cell's icon indicator
+            self.model.close_task_refresh()
             if pbar:
                 pbar.set_text(event.msg)
@@ -292,6 +302,8 @@ class RunningBuild (gobject.GObject):
                 # If the command fails with an exit code we're done,
                 emit the # generic signal for the UI to notify the user
                 self.emit("build-complete")
+                # reset the all cell's icon indicator
+                self.model.close_task_refresh()
 
         elif isinstance(event, bb.event.CacheLoadStarted) and pbar:
             pbar.set_title("Loading cache")

bitbake/lib/bb/ui/crumbs/runningbuild.py class RunningBuildTreeView (gtk.TreeView): · line 361

Quoted 5 lines
bitbake/lib/bb/ui/crumbs/runningbuild.py +1 -1
@@ -346,7 +358,7 @@ class RunningBuildTreeView (gtk.TreeView):
         self.readonly = readonly
 
         # The icon that indicates whether we're building or failed.
-        renderer = gtk.CellRendererPixbuf ()
+        renderer = HobCellRendererPixbuf ()

This change will break goggle and puccho, because they are reusing RunningBuildTreeView. I asked him to send another version of the patches.

Quoted 3 lines
bitbake/lib/bb/ui/crumbs/runningbuild.py +0 -0
         col = gtk.TreeViewColumn ("Status", renderer)
         col.add_attribute (renderer, "icon-name", 4)
         self.append_column (col)