From patchwork Thu Mar 29 00:30:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [bitbake-devel, 5/6] lib/bb/ui/crumbs: hob progress bar should not be red when user stops build Date: Thu, 29 Mar 2012 00:30:26 -0000 From: Joshua Lock X-Patchwork-Id: 24787 Message-Id: To: bitbake-devel@lists.openembedded.org If the user explicitly stops the build telling them the build failed is a misnomer. Signed-off-by: Joshua Lock --- lib/bb/ui/crumbs/builddetailspage.py | 2 +- lib/bb/ui/crumbs/builder.py | 21 ++++++++++++++------- lib/bb/ui/crumbs/hig.py | 2 +- lib/bb/ui/crumbs/imageconfigurationpage.py | 2 +- lib/bb/ui/crumbs/progressbar.py | 8 +++++--- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/lib/bb/ui/crumbs/builddetailspage.py b/lib/bb/ui/crumbs/builddetailspage.py index e8dbad7..d3d07d8 100755 --- a/lib/bb/ui/crumbs/builddetailspage.py +++ b/lib/bb/ui/crumbs/builddetailspage.py @@ -213,7 +213,7 @@ class BuildDetailsPage (HobPage): self.show_all() self.back_button.hide() - def update_progress_bar(self, title, fraction, status=True): + def update_progress_bar(self, title, fraction, status=None): self.progress_bar.update(fraction) self.progress_bar.set_title(title) self.progress_bar.set_rcstyle(status) diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py index 1d203fe..3dccf06 100755 --- a/lib/bb/ui/crumbs/builder.py +++ b/lib/bb/ui/crumbs/builder.py @@ -608,13 +608,20 @@ class Builder(gtk.Window): self.stopping = False def build_failed(self): - if self.current_step == self.FAST_IMAGE_GENERATING: - fraction = 0.9 - elif self.current_step == self.IMAGE_GENERATING: - fraction = 1.0 - elif self.current_step == self.PACKAGE_GENERATING: - fraction = 1.0 - self.build_details_page.update_progress_bar("Build Failed: ", fraction, False) + if self.stopping: + status = "stop" + message = "Build stopped: " + fraction = self.build_details_page.progress_bar.get_fraction() + else: + if self.current_step == self.FAST_IMAGE_GENERATING: + fraction = 0.9 + elif self.current_step == self.IMAGE_GENERATING: + fraction = 1.0 + elif self.current_step == self.PACKAGE_GENERATING: + fraction = 1.0 + status = "fail" + message = "Build failed: " + 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() diff --git a/lib/bb/ui/crumbs/hig.py b/lib/bb/ui/crumbs/hig.py index 4753c92..0ea5c0d 100644 --- a/lib/bb/ui/crumbs/hig.py +++ b/lib/bb/ui/crumbs/hig.py @@ -735,7 +735,7 @@ class DeployImageDialog (CrumbsDialog): cmdline += "\"sudo dd if=" + self.image_path + " of=" + combo_item + "; bash\"" subprocess.Popen(args=shlex.split(cmdline)) - def update_progress_bar(self, title, fraction, status=True): + def update_progress_bar(self, title, fraction, status=None): self.progress_bar.update(fraction) self.progress_bar.set_title(title) self.progress_bar.set_rcstyle(status) diff --git a/lib/bb/ui/crumbs/imageconfigurationpage.py b/lib/bb/ui/crumbs/imageconfigurationpage.py index f66bcd6..d5aaf83 100644 --- a/lib/bb/ui/crumbs/imageconfigurationpage.py +++ b/lib/bb/ui/crumbs/imageconfigurationpage.py @@ -105,7 +105,7 @@ class ImageConfigurationPage (HobPage): self.set_config_machine_layout(show_progress_bar = False) self.show_all() - def update_progress_bar(self, title, fraction, status=True): + def update_progress_bar(self, title, fraction, status=None): self.progress_bar.update(fraction) self.progress_bar.set_title(title) self.progress_bar.set_rcstyle(status) diff --git a/lib/bb/ui/crumbs/progressbar.py b/lib/bb/ui/crumbs/progressbar.py index 882d461..f75818a 100644 --- a/lib/bb/ui/crumbs/progressbar.py +++ b/lib/bb/ui/crumbs/progressbar.py @@ -29,10 +29,12 @@ class HobProgressBar (gtk.ProgressBar): def set_rcstyle(self, status): rcstyle = gtk.RcStyle() rcstyle.fg[2] = gtk.gdk.Color(HobColors.BLACK) - if status: - rcstyle.bg[3] = gtk.gdk.Color(HobColors.RUNNING) - else: + if status == "stop": + rcstyle.bg[3] = gtk.gdk.Color(HobColors.WARNING) + elif status == "fail": rcstyle.bg[3] = gtk.gdk.Color(HobColors.ERROR) + else: + rcstyle.bg[3] = gtk.gdk.Color(HobColors.RUNNING) self.modify_style(rcstyle) def set_title(self, text=None):