* [PATCH 1/6] Hob: add refresh icon as ui request in building log
2012-03-27 18:25 [PATCH 0/6] [V2] Hob: bug fixes Liming An
@ 2012-03-27 18:25 ` Liming An
2012-03-27 18:25 ` [PATCH 2/6] Hob: fixed visually differentiate warnings and errors icon " Liming An
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Liming An @ 2012-03-27 18:25 UTC (permalink / raw)
To: bitbake-devel
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.
Signed-off-by: Liming An <limingx.l.an@intel.com>
---
bitbake/lib/bb/ui/crumbs/hobwidget.py | 169 ++++++++++++++++++++++++++++++
bitbake/lib/bb/ui/crumbs/runningbuild.py | 20 +++-
2 files changed, 185 insertions(+), 4 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 8936f0a..e224762 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:
@@ -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_REFRESH_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)
@@ -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)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/6] Hob: fixed visually differentiate warnings and errors icon in building log
2012-03-27 18:25 [PATCH 0/6] [V2] Hob: bug fixes Liming An
2012-03-27 18:25 ` [PATCH 1/6] Hob: add refresh icon as ui request in building log Liming An
@ 2012-03-27 18:25 ` Liming An
2012-03-27 18:25 ` [PATCH 3/6] Hob: change the recipe pasing error dialog icon from 'dialog-info' to 'dialog-error' Liming An
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Liming An @ 2012-03-27 18:25 UTC (permalink / raw)
To: bitbake-devel
fixed the bug of 'error' and 'warning' icon is not constaintly with hob ui design
[YOCTO #2097]
Signed-off-by: Liming An <limingx.l.an@intel.com>
---
bitbake/lib/bb/ui/crumbs/hobwidget.py | 67 +++++++++++++++++++++++----------
1 files changed, 47 insertions(+), 20 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index e224762..22898fb 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -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_REFRESH_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_REFRESH_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
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/6] Hob: change the recipe pasing error dialog icon from 'dialog-info' to 'dialog-error'
2012-03-27 18:25 [PATCH 0/6] [V2] Hob: bug fixes Liming An
2012-03-27 18:25 ` [PATCH 1/6] Hob: add refresh icon as ui request in building log Liming An
2012-03-27 18:25 ` [PATCH 2/6] Hob: fixed visually differentiate warnings and errors icon " Liming An
@ 2012-03-27 18:25 ` Liming An
2012-03-27 18:25 ` [PATCH 4/6] Hob: use hob icon checker to check the gtk icon for make the icon constaintly Liming An
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Liming An @ 2012-03-27 18:25 UTC (permalink / raw)
To: bitbake-devel
[YOCTO #2109]
Signed-off-by: Liming An <limingx.l.an@intel.com>
---
bitbake/lib/bb/ui/crumbs/builder.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index f32a066..7bf12e2 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -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()
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 4/6] Hob: use hob icon checker to check the gtk icon for make the icon constaintly
2012-03-27 18:25 [PATCH 0/6] [V2] Hob: bug fixes Liming An
` (2 preceding siblings ...)
2012-03-27 18:25 ` [PATCH 3/6] Hob: change the recipe pasing error dialog icon from 'dialog-info' to 'dialog-error' Liming An
@ 2012-03-27 18:25 ` Liming An
2012-03-27 18:25 ` [PATCH 5/6] Hob: change the implementing way about get config info for building log Liming An
2012-03-27 18:25 ` [PATCH 6/6] Hob: fixed some not compatible places for make runningbuild.py can be reused by another application Liming An
5 siblings, 0 replies; 8+ messages in thread
From: Liming An @ 2012-03-27 18:25 UTC (permalink / raw)
To: bitbake-devel
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]
Signed-off-by: Liming An <limingx.l.an@intel.com>
---
bitbake/lib/bb/ui/crumbs/hig.py | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index 6ae682b..d151fc4 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -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)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 5/6] Hob: change the implementing way about get config info for building log
2012-03-27 18:25 [PATCH 0/6] [V2] Hob: bug fixes Liming An
` (3 preceding siblings ...)
2012-03-27 18:25 ` [PATCH 4/6] Hob: use hob icon checker to check the gtk icon for make the icon constaintly Liming An
@ 2012-03-27 18:25 ` Liming An
2012-03-28 3:48 ` Wang, Shane
2012-03-27 18:25 ` [PATCH 6/6] Hob: fixed some not compatible places for make runningbuild.py can be reused by another application Liming An
5 siblings, 1 reply; 8+ messages in thread
From: Liming An @ 2012-03-27 18:25 UTC (permalink / raw)
To: bitbake-devel
Make the building log config information to get from the bitbake parameters directly, and then cancel the old way of filting the building log on running
[YOCTO #2144]
Signed-off-by: Liming An <limingx.l.an@intel.com>
---
bitbake/lib/bb/ui/crumbs/builddetailspage.py | 86 ++++++++++++++++++++++++-
bitbake/lib/bb/ui/crumbs/builder.py | 7 ++
bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 6 ++
bitbake/lib/bb/ui/crumbs/runningbuild.py | 38 ++----------
4 files changed, 100 insertions(+), 37 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/builddetailspage.py b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
index c2f980f..9d967cb 100755
--- a/bitbake/lib/bb/ui/crumbs/builddetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
@@ -21,13 +21,90 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import gtk
+import pango
+import gobject
from bb.ui.crumbs.progressbar import HobProgressBar
-from bb.ui.crumbs.hobwidget import hic, HobNotebook, HobAltButton
+from bb.ui.crumbs.hobwidget import hic, HobNotebook, HobAltButton, HobWarpCellRendererText
from bb.ui.crumbs.runningbuild import RunningBuildTreeView
-from bb.ui.crumbs.runningbuild import BuildConfigurationTreeView
from bb.ui.crumbs.runningbuild import BuildFailureTreeView
from bb.ui.crumbs.hobpages import HobPage
+class BuildConfigurationTreeView(gtk.TreeView):
+ def __init__ (self):
+ gtk.TreeView.__init__(self)
+ self.set_rules_hint(False)
+ self.set_headers_visible(False)
+ self.set_property("hover-expand", True)
+ self.get_selection().set_mode(gtk.SELECTION_SINGLE)
+
+ # The icon that indicates whether we're building or failed.
+ renderer0 = gtk.CellRendererText()
+ renderer0.set_property('font-desc', pango.FontDescription('courier bold 12'))
+ col0 = gtk.TreeViewColumn ("Name", renderer0, text=0)
+ self.append_column (col0)
+
+ # The message of configuration.
+ renderer1 = HobWarpCellRendererText(col_number=1)
+ col1 = gtk.TreeViewColumn ("Values", renderer1, text=1)
+ self.append_column (col1)
+
+ def set_vars(self, key="", var=[""]):
+ d = {}
+ if type(var) == str:
+ d = {key: [var]}
+ elif type(var) == list and len(var) > 1:
+ #create the sub item line
+ l = []
+ text = ""
+ for item in var:
+ text = " - " + item
+ l.append(text)
+ d = {key: var}
+
+ return d
+
+ def set_config_model(self, show_vars):
+ listmodel = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
+ parent = None
+ for var in show_vars:
+ for subitem in var.items():
+ name = subitem[0]
+ is_parent = True
+ for value in subitem[1]:
+ if is_parent:
+ parent = listmodel.append(parent, (name, value))
+ is_parent = False
+ else:
+ listmodel.append(parent, (None, value))
+ name = " - "
+ parent = None
+ # renew the tree model after get the configuration messages
+ self.set_model(listmodel)
+
+ def show(self, src_config_info, src_params):
+ vars = []
+ vars.append(self.set_vars("BB VERSION:", src_params.bb_version))
+ vars.append(self.set_vars("TARGET_ARCH:", src_params.target_arch))
+ vars.append(self.set_vars("TARGET_OS:", src_params.target_os))
+ vars.append(self.set_vars("MACHINE:", src_config_info.curr_mach))
+ vars.append(self.set_vars("DISTRO:", src_config_info.curr_distro))
+ vars.append(self.set_vars("DISTRO_VERSION:", src_params.distro_version))
+ vars.append(self.set_vars("SDK_MACHINE:", src_config_info.curr_sdk_machine))
+ vars.append(self.set_vars("TUNE_FEATURE:", src_params.tune_pkgarch))
+ vars.append(self.set_vars("META:", src_config_info.layers))
+
+ for path in src_config_info.layers:
+ import os, os.path
+ if os.path.exists(path):
+ f = os.popen('cd %s; git branch 2>&1 | grep "^* " | tr -d "* "' % path)
+ if f:
+ branch = f.readline()
+ vars.append(self.set_vars("META-HOB:", branch))
+ f.close()
+ break
+
+ self.set_config_model(vars)
+
#
# BuildDetailsPage
#
@@ -60,8 +137,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)
@@ -158,3 +233,6 @@ 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 show_configurations(self, configurations, params):
+ self.config_tv.show(configurations, params)
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 7bf12e2..017f532 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -140,6 +140,12 @@ class Parameters:
self.runnable_machine_patterns = params["runnable_machine_patterns"].split()
self.deployable_image_types = params["deployable_image_types"].split()
self.tmpdir = params["tmpdir"]
+ self.distro_version = params["distro_version"]
+ self.target_os = params["target_os"]
+ self.target_arch = params["target_arch"]
+ self.tune_pkgarch = params["tune_pkgarch"]
+ self.bb_version = params["bb_version"]
+ self.tune_arch = params["tune_arch"]
class Builder(gtk.Window):
@@ -545,6 +551,7 @@ class Builder(gtk.Window):
self.build_details_page.update_progress_bar("Build Started: ", fraction)
self.build_details_page.reset_build_status()
self.build_details_page.reset_issues()
+ self.build_details_page.show_configurations(self.configuration, self.parameters)
def build_succeeded(self):
if self.current_step == self.FAST_IMAGE_GENERATING:
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 8042fbd..8583fa4 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -440,4 +440,10 @@ class HobHandler(gobject.GObject):
params["runnable_machine_patterns"] = self.server.runCommand(["getVariable", "RUNNABLE_MACHINE_PATTERNS"]) or ""
params["deployable_image_types"] = self.server.runCommand(["getVariable", "DEPLOYABLE_IMAGE_TYPES"]) or ""
params["tmpdir"] = self.server.runCommand(["getVariable", "TMPDIR"]) or ""
+ params["distro_version"] = self.server.runCommand(["getVariable", "DISTRO_VERSION"]) or ""
+ params["target_os"] = self.server.runCommand(["getVariable", "TARGET_OS"]) or ""
+ params["target_arch"] = self.server.runCommand(["getVariable", "TARGET_ARCH"]) or ""
+ params["tune_pkgarch"] = self.server.runCommand(["getVariable", "TUNE_PKGARCH"]) or ""
+ params["bb_version"] = self.server.runCommand(["getVariable", "BB_MIN_VERSION"]) or ""
+ params["tune_arch"] = self.server.runCommand(["getVariable", "TUNE_ARCH"]) or ""
return params
diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py
index aecfadf..b69f0ca 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)
+ __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,7 +67,6 @@ class RunningBuildModel (gtk.TreeStore):
def close_task_refresh(self):
self.foreach(self.foreach_cell_func, None)
-
class RunningBuild (gobject.GObject):
__gsignals__ = {
'build-started' : (gobject.SIGNAL_RUN_LAST,
@@ -422,25 +413,6 @@ class RunningBuildTreeView (gtk.TreeView):
self._add_to_clipboard(message)
-
-class BuildConfigurationTreeView(gtk.TreeView):
-
- def __init__ (self):
- gtk.TreeView.__init__(self)
- self.set_rules_hint(False)
- self.set_headers_visible(False)
- self.set_property("hover-expand", True)
- self.get_selection().set_mode(gtk.SELECTION_SINGLE)
-
- # 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)
- font = self.get_style().font_desc
- font.set_size(pango.SCALE * 13)
- self.message_renderer.set_property('font-desc', font)
- self.append_column (self.message_column)
-
-
class BuildFailureTreeView(gtk.TreeView):
def __init__ (self):
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 5/6] Hob: change the implementing way about get config info for building log
2012-03-27 18:25 ` [PATCH 5/6] Hob: change the implementing way about get config info for building log Liming An
@ 2012-03-28 3:48 ` Wang, Shane
0 siblings, 0 replies; 8+ messages in thread
From: Wang, Shane @ 2012-03-28 3:48 UTC (permalink / raw)
To: An, LimingX L, bitbake-devel@lists.openembedded.org
> -----Original Message-----
> From: bitbake-devel-bounces@lists.openembedded.org
> [mailto:bitbake-devel-bounces@lists.openembedded.org] On Behalf Of
> Liming An
> Sent: Wednesday, March 28, 2012 2:26 AM
> To: bitbake-devel@lists.openembedded.org
> Subject: [bitbake-devel] [PATCH 5/6] Hob: change the implementing way
> about get config info for building log
>
> Make the building log config information to get from the bitbake parameters
> directly, and then cancel the old way of filting the building log on running
>
> [YOCTO #2144]
>
> Signed-off-by: Liming An <limingx.l.an@intel.com>
> ---
> bitbake/lib/bb/ui/crumbs/builddetailspage.py | 86
> ++++++++++++++++++++++++-
> bitbake/lib/bb/ui/crumbs/builder.py | 7 ++
> bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 6 ++
> bitbake/lib/bb/ui/crumbs/runningbuild.py | 38 ++----------
> 4 files changed, 100 insertions(+), 37 deletions(-)
>
> diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py
> b/bitbake/lib/bb/ui/crumbs/runningbuild.py
> index aecfadf..b69f0ca 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)
>
> + __gsignals__ = {
> + 'update-config-info' : (gobject.SIGNAL_RUN_LAST,
> + gobject.TYPE_NONE,
> + (gobject.TYPE_STRING,)),
> + }
That is not necessary any more.
I am going to remove it.
--
Shane
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 6/6] Hob: fixed some not compatible places for make runningbuild.py can be reused by another application
2012-03-27 18:25 [PATCH 0/6] [V2] Hob: bug fixes Liming An
` (4 preceding siblings ...)
2012-03-27 18:25 ` [PATCH 5/6] Hob: change the implementing way about get config info for building log Liming An
@ 2012-03-27 18:25 ` Liming An
5 siblings, 0 replies; 8+ messages in thread
From: Liming An @ 2012-03-27 18:25 UTC (permalink / raw)
To: bitbake-devel
The runningbuild.py has been shared by different applications, not only hob, so fixed the some not compatibled codes
Signed-off-by: Liming An <limingx.l.an@intel.com>
---
bitbake/lib/bb/ui/crumbs/builddetailspage.py | 2 +-
bitbake/lib/bb/ui/crumbs/hobwidget.py | 10 +++++-----
bitbake/lib/bb/ui/crumbs/runningbuild.py | 20 ++++++++++++++------
3 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/builddetailspage.py b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
index 9d967cb..6b2cef4 100755
--- a/bitbake/lib/bb/ui/crumbs/builddetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
@@ -150,7 +150,7 @@ class BuildDetailsPage (HobPage):
self.scrolled_view_failure.add(self.failure_tv)
self.notebook.append_page(self.scrolled_view_failure, gtk.Label("Issues"))
- self.build_tv = RunningBuildTreeView(readonly=True)
+ self.build_tv = RunningBuildTreeView(readonly=True, hob=True)
self.build_tv.set_model(self.builder.handler.build.model)
self.scrolled_view_build = gtk.ScrolledWindow ()
self.scrolled_view_build.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 22898fb..89ff23e 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -824,6 +824,7 @@ class HobIconChecker(hic):
('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,
+ ('hic-task-refresh', 'gtk-execute', 'execute') : self.ICON_INDI_REFRESH_FILE,
}
valid_stock_id = stock_name
if stock_name:
@@ -924,9 +925,8 @@ class HobCellRendererPixbuf(gtk.CellRendererPixbuf):
def __init__(self):
gtk.CellRendererPixbuf.__init__(self)
self.control = RefreshRuningController()
- # create default refrensh stock icon
+ # add icon checker for make the gtk-icon transfer to hob-icon
self.checker = HobIconChecker()
- self.checker.set_hob_icon_to_stock_icon(hic.ICON_INDI_REFRESH_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):
@@ -938,7 +938,7 @@ class HobCellRendererPixbuf(gtk.CellRendererPixbuf):
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":
+ if name.startswith("hic") or name.startswith("gtk"):
stock_id = name
else:
stock_id = 'gtk-' + name
@@ -946,7 +946,7 @@ class HobCellRendererPixbuf(gtk.CellRendererPixbuf):
return stock_id
''' render cell exactly, "icon-name" is priority
- if use the 'task-refresh' will make the pix animation
+ if use the 'hic-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):
@@ -971,7 +971,7 @@ class HobCellRendererPixbuf(gtk.CellRendererPixbuf):
if stock_id:
pix = self.get_pixbuf_from_stock_icon(tree, stock_id, self.props.stock_size)
- if stock_id == 'task-refresh':
+ if stock_id == 'hic-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)
diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py
index b69f0ca..629da8c 100644
--- a/bitbake/lib/bb/ui/crumbs/runningbuild.py
+++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py
@@ -61,7 +61,7 @@ class RunningBuildModel (gtk.TreeStore):
return model
def foreach_cell_func(self, model, path, iter, usr_data=None):
- if model.get_value(iter, self.COL_ICON) == "task-refresh":
+ if model.get_value(iter, self.COL_ICON) == "gtk-execute":
model.set(iter, self.COL_ICON, "")
def close_task_refresh(self):
@@ -188,7 +188,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, "task-refresh",
+ self.model.set(parent, self.model.COL_ICON, "gtk-execute",
self.model.COL_COLOR, HobColors.RUNNING)
# Add an entry in the model for this task
@@ -196,7 +196,7 @@ class RunningBuild (gobject.GObject):
package,
task,
"Task: %s" % (task),
- "task-refresh",
+ "gtk-execute",
HobColors.RUNNING,
0))
@@ -344,18 +344,26 @@ class RunningBuildTreeView (gtk.TreeView):
__gsignals__ = {
"button_press_event" : "override"
}
- def __init__ (self, readonly=False):
+ def __init__ (self, readonly=False, hob=False):
gtk.TreeView.__init__ (self)
self.readonly = readonly
# The icon that indicates whether we're building or failed.
- renderer = HobCellRendererPixbuf ()
+ # add 'hob' flag because there has not only hob to share this code
+ if hob:
+ renderer = HobCellRendererPixbuf ()
+ else:
+ renderer = gtk.CellRendererPixbuf()
col = gtk.TreeViewColumn ("Status", renderer)
col.add_attribute (renderer, "icon-name", 4)
self.append_column (col)
# The message of the build.
- self.message_renderer = HobWarpCellRendererText (col_number=1)
+ # add 'hob' flag because there has not only hob to share this code
+ if hob:
+ self.message_renderer = HobWarpCellRendererText (col_number=1)
+ else:
+ self.message_renderer = gtk.CellRendererText ()
self.message_column = gtk.TreeViewColumn ("Message", self.message_renderer, text=3)
self.message_column.add_attribute(self.message_renderer, 'background', 5)
self.message_renderer.set_property('editable', (not self.readonly))
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread