Patchwork [bitbake-devel,1/1] ui/depexp.py: use the new progressbar in Hob

login
register
mail settings
Submitter Kang Kai
Date June 19, 2012, 9:39 a.m.
Message ID <8a6196c93278c9272e44420f190eff1cb2357e73.1340098628.git.kai.kang@windriver.com>
Download mbox | patch
Permalink /patch/30109/
State New
Headers show

Comments

Kang Kai - June 19, 2012, 9:39 a.m.
[Yocto 2149]

Use the new progressbar in Hob, so that we can reduce the maintenance
burden of the multiple GUIs.

Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
 bitbake/lib/bb/ui/depexp.py |   29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)
Richard Purdie - June 21, 2012, 12:17 p.m.
On Tue, 2012-06-19 at 17:39 +0800, Kang Kai wrote:
> [Yocto 2149]
> 
> Use the new progressbar in Hob, so that we can reduce the maintenance
> burden of the multiple GUIs.
> 
> Signed-off-by: Kang Kai <kai.kang@windriver.com>
> ---
>  bitbake/lib/bb/ui/depexp.py |   29 ++++++++++++++++++-----------
>  1 files changed, 18 insertions(+), 11 deletions(-)

Merged to master, thanks.

Richard

Patch

diff --git a/bitbake/lib/bb/ui/depexp.py b/bitbake/lib/bb/ui/depexp.py
index b62adbf..425302e 100644
--- a/bitbake/lib/bb/ui/depexp.py
+++ b/bitbake/lib/bb/ui/depexp.py
@@ -24,7 +24,7 @@  import threading
 import xmlrpclib
 import bb
 import bb.event
-from bb.ui.crumbs.progress import ProgressBar
+from bb.ui.crumbs.progressbar import HobProgressBar
 
 # Package Model
 (COL_PKG_NAME) = (0)
@@ -220,8 +220,12 @@  def main(server, eventHandler):
 
     gtk.gdk.threads_enter()
     dep = DepExplorer()
-    pbar = ProgressBar(dep)
-    pbar.connect("delete-event", gtk.main_quit)
+    bardialog = gtk.Dialog(parent=dep)
+    bardialog.set_default_size(400, 50)
+    pbar = HobProgressBar()
+    bardialog.vbox.pack_start(pbar)
+    bardialog.show_all()
+    bardialog.connect("delete-event", gtk.main_quit)
     gtk.gdk.threads_leave()
 
     progress_total = 0
@@ -238,19 +242,20 @@  def main(server, eventHandler):
             if isinstance(event, bb.event.CacheLoadStarted):
                 progress_total = event.total
                 gtk.gdk.threads_enter()
-                pbar.set_title("Loading Cache")
-                pbar.update(0, progress_total)
+                bardialog.set_title("Loading Cache")
+                pbar.update(0)
                 gtk.gdk.threads_leave()
 
             if isinstance(event, bb.event.CacheLoadProgress):
                 x = event.current
                 gtk.gdk.threads_enter()
-                pbar.update(x, progress_total)
+                pbar.update(x * 1.0 / progress_total)
+                pbar.set_title('')
                 gtk.gdk.threads_leave()
                 continue
 
             if isinstance(event, bb.event.CacheLoadCompleted):
-                pbar.hide()
+                bardialog.hide()
                 continue
 
             if isinstance(event, bb.event.ParseStarted):
@@ -258,19 +263,21 @@  def main(server, eventHandler):
                 if progress_total == 0:
                     continue
                 gtk.gdk.threads_enter()
-                pbar.set_title("Processing recipes")
-                pbar.update(0, progress_total)
+                pbar.update(0)
+                bardialog.set_title("Processing recipes")
+
                 gtk.gdk.threads_leave()
 
             if isinstance(event, bb.event.ParseProgress):
                 x = event.current
                 gtk.gdk.threads_enter()
-                pbar.update(x, progress_total)
+                pbar.update(x * 1.0 / progress_total)
+                pbar.set_title('')
                 gtk.gdk.threads_leave()
                 continue
 
             if isinstance(event, bb.event.ParseCompleted):
-                pbar.hide()
+                bardialog.hide()
                 continue
 
             if isinstance(event, bb.event.DepTreeGenerated):