Hob: show indicators on the tabs of the Hob notebook

This patch is to show the indicators (e.g., the number of the issues) in the build details page to highlight.

(From Poky rev: 2e08a8e6818b8f1df7eaac499ebc3a5854efe7be)

(Bitbake rev: f2eead1bc20c48b2f36e880a879a5a50e6e6567b)

Signed-off-by: Liming An <limingx.l.an@intel.com>
Signed-off-by: Shane Wang <shane.wang@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Shane Wang 2012-03-12 20:55:44 +08:00 committed by Richard Purdie
parent c4017bc518
commit dab638e150
4 changed files with 33 additions and 0 deletions

View File

@ -37,6 +37,8 @@ class BuildDetailsPage (HobPage):
def __init__(self, builder):
super(BuildDetailsPage, self).__init__(builder, "Building ...")
self.num_of_issues = 0
# create visual elements
self.create_visual_elements()
@ -80,6 +82,14 @@ class BuildDetailsPage (HobPage):
self.back_button.connect("clicked", self.back_button_clicked_cb)
self.button_box.pack_start(self.back_button, expand=False, fill=False)
def show_issues(self):
self.num_of_issues += 1
self.notebook.show_indicator_icon("Issues", self.num_of_issues)
def reset_issues(self):
self.num_of_issues = 0
self.notebook.hide_indicator_icon("Issues")
def _remove_all_widget(self):
children = self.vbox.get_children() or []
for child in children:

View File

@ -212,6 +212,7 @@ class Builder(gtk.Window):
self.handler.build.connect("build-succeeded", self.handler_build_succeeded_cb)
self.handler.build.connect("build-failed", self.handler_build_failed_cb)
self.handler.build.connect("task-started", self.handler_task_started_cb)
self.handler.build.connect("log-error", self.handler_build_failure_cb)
self.handler.connect("generating-data", self.handler_generating_data_cb)
self.handler.connect("data-generated", self.handler_data_generated_cb)
self.handler.connect("command-succeeded", self.handler_command_succeeded_cb)
@ -533,6 +534,7 @@ class Builder(gtk.Window):
elif self.current_step == self.PACKAGE_GENERATING:
fraction = 0
self.build_details_page.update_progress_bar("Build Started: ", fraction)
self.build_details_page.reset_issues()
def build_succeeded(self):
if self.current_step == self.FAST_IMAGE_GENERATING:
@ -600,6 +602,9 @@ class Builder(gtk.Window):
fraction = 0.2 + 0.8 * fraction
self.build_details_page.update_progress_bar(title + ": ", fraction)
def handler_build_failure_cb(self, running_build):
self.build_details_page.show_issues()
def destroy_window_cb(self, widget, event):
lbl = "<b>Do you really want to exit the Hob image creator?</b>"
dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)

View File

@ -619,6 +619,20 @@ class HobNotebook(gtk.VBox):
self.tb.show()
def show_indicator_icon(self, title, number):
for i, child in enumerate(self.tabbar.children):
if child["toggled_page"] == -1:
continue
if child["title"] == title:
self.tabbar.show_indicator_icon(i, number)
def hide_indicator_icon(self, title):
for i, child in enumerate(self.tabbar.children):
if child["toggled_page"] == -1:
continue
if child["title"] == title:
self.tabbar.hide_indicator_icon(i)
def tab_switched_cb(self, widget, page):
self.notebook.set_current_page(page)

View File

@ -84,6 +84,9 @@ class RunningBuild (gobject.GObject):
'task-started' : (gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
(gobject.TYPE_PYOBJECT,)),
'log-error' : (gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
()),
}
pids_to_task = {}
tasks_to_iter = {}
@ -134,6 +137,7 @@ class RunningBuild (gobject.GObject):
if event.levelno >= logging.ERROR:
icon = "dialog-error"
color = HobColors.ERROR
self.emit("log-error")
elif event.levelno >= logging.WARNING:
icon = "dialog-warning"
color = HobColors.WARNING