diff options
author | Joshua Lock <josh@linux.intel.com> | 2010-11-25 15:15:10 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-12-07 12:50:55 +0000 |
commit | 1307d64286802dbaa1d58260cc50200d5f49f92c (patch) | |
tree | 333e6c8d85154bdf1fc9b7aff86a8c8b5dd3b2bf /bitbake/lib/bb/ui | |
parent | 8cbaa9f0d98caf82a4e698abf24edc1c1a3122b2 (diff) | |
download | openembedded-core-1307d64286802dbaa1d58260cc50200d5f49f92c.tar.gz openembedded-core-1307d64286802dbaa1d58260cc50200d5f49f92c.tar.bz2 openembedded-core-1307d64286802dbaa1d58260cc50200d5f49f92c.zip |
bitbake/depexp: Factor ProgressBar into a separate class in crumbs/
ProgressBar will be useful in other UI elements so make it it's own class.
Make ProgressBar a subclass of gtk.Dialog, rather than gtk.Window, so that we
can suggest the window manager parent the ProgressBar to the widget passed at
as parent.
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/progress.py | 17 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/depexp.py | 19 |
2 files changed, 21 insertions, 15 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/progress.py b/bitbake/lib/bb/ui/crumbs/progress.py new file mode 100644 index 0000000000..8bd87108e6 --- /dev/null +++ b/bitbake/lib/bb/ui/crumbs/progress.py @@ -0,0 +1,17 @@ +import gtk + +class ProgressBar(gtk.Dialog): + def __init__(self, parent): + + gtk.Dialog.__init__(self) + self.set_title("Parsing metadata, please wait...") + self.set_default_size(500, 0) + self.set_transient_for(parent) + self.set_destroy_with_parent(True) + self.progress = gtk.ProgressBar() + self.vbox.pack_start(self.progress) + self.show_all() + + def update(self, x, y): + self.progress.set_fraction(float(x)/float(y)) + self.progress.set_text("%d/%d (%2d %%)" % (x, y, x*100/y)) diff --git a/bitbake/lib/bb/ui/depexp.py b/bitbake/lib/bb/ui/depexp.py index 1cd58cac18..6fd18d1684 100644 --- a/bitbake/lib/bb/ui/depexp.py +++ b/bitbake/lib/bb/ui/depexp.py @@ -21,6 +21,7 @@ import gobject import gtk import threading import xmlrpclib +from bb.ui.crumbs.progress import ProgressBar # Package Model (COL_PKG_NAME) = (0) @@ -171,18 +172,6 @@ def parse(depgraph, pkg_model, depends_model): COL_DEP_PARENT, package, COL_DEP_PACKAGE, rdepend) -class ProgressBar(gtk.Window): - def __init__(self): - - gtk.Window.__init__(self) - self.set_title("Parsing .bb files, please wait...") - self.set_default_size(500, 0) - self.connect("delete-event", gtk.main_quit) - - self.progress = gtk.ProgressBar() - self.add(self.progress) - self.show_all() - class gtkthread(threading.Thread): quit = threading.Event() def __init__(self, shutdown): @@ -217,8 +206,8 @@ def init(server, eventHandler): gtkgui.start() gtk.gdk.threads_enter() - pbar = ProgressBar() dep = DepExplorer() + pbar = ProgressBar(dep) gtk.gdk.threads_leave() while True: @@ -236,9 +225,9 @@ def init(server, eventHandler): print(("\nParsing finished. %d cached, %d parsed, %d skipped, %d masked, %d errors." % ( event.cached, event.parsed, event.skipped, event.masked, event.errors))) pbar.hide() + return gtk.gdk.threads_enter() - pbar.progress.set_fraction(float(x)/float(y)) - pbar.progress.set_text("%d/%d (%2d %%)" % (x, y, x*100/y)) + pbar.update(x, y) gtk.gdk.threads_leave() continue |