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 | poky-1307d64286802dbaa1d58260cc50200d5f49f92c.tar.gz |
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 @@ | |||
1 | import gtk | ||
2 | |||
3 | class ProgressBar(gtk.Dialog): | ||
4 | def __init__(self, parent): | ||
5 | |||
6 | gtk.Dialog.__init__(self) | ||
7 | self.set_title("Parsing metadata, please wait...") | ||
8 | self.set_default_size(500, 0) | ||
9 | self.set_transient_for(parent) | ||
10 | self.set_destroy_with_parent(True) | ||
11 | self.progress = gtk.ProgressBar() | ||
12 | self.vbox.pack_start(self.progress) | ||
13 | self.show_all() | ||
14 | |||
15 | def update(self, x, y): | ||
16 | self.progress.set_fraction(float(x)/float(y)) | ||
17 | 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 | |||
21 | import gtk | 21 | import gtk |
22 | import threading | 22 | import threading |
23 | import xmlrpclib | 23 | import xmlrpclib |
24 | from bb.ui.crumbs.progress import ProgressBar | ||
24 | 25 | ||
25 | # Package Model | 26 | # Package Model |
26 | (COL_PKG_NAME) = (0) | 27 | (COL_PKG_NAME) = (0) |
@@ -171,18 +172,6 @@ def parse(depgraph, pkg_model, depends_model): | |||
171 | COL_DEP_PARENT, package, | 172 | COL_DEP_PARENT, package, |
172 | COL_DEP_PACKAGE, rdepend) | 173 | COL_DEP_PACKAGE, rdepend) |
173 | 174 | ||
174 | class ProgressBar(gtk.Window): | ||
175 | def __init__(self): | ||
176 | |||
177 | gtk.Window.__init__(self) | ||
178 | self.set_title("Parsing .bb files, please wait...") | ||
179 | self.set_default_size(500, 0) | ||
180 | self.connect("delete-event", gtk.main_quit) | ||
181 | |||
182 | self.progress = gtk.ProgressBar() | ||
183 | self.add(self.progress) | ||
184 | self.show_all() | ||
185 | |||
186 | class gtkthread(threading.Thread): | 175 | class gtkthread(threading.Thread): |
187 | quit = threading.Event() | 176 | quit = threading.Event() |
188 | def __init__(self, shutdown): | 177 | def __init__(self, shutdown): |
@@ -217,8 +206,8 @@ def init(server, eventHandler): | |||
217 | gtkgui.start() | 206 | gtkgui.start() |
218 | 207 | ||
219 | gtk.gdk.threads_enter() | 208 | gtk.gdk.threads_enter() |
220 | pbar = ProgressBar() | ||
221 | dep = DepExplorer() | 209 | dep = DepExplorer() |
210 | pbar = ProgressBar(dep) | ||
222 | gtk.gdk.threads_leave() | 211 | gtk.gdk.threads_leave() |
223 | 212 | ||
224 | while True: | 213 | while True: |
@@ -236,9 +225,9 @@ def init(server, eventHandler): | |||
236 | print(("\nParsing finished. %d cached, %d parsed, %d skipped, %d masked, %d errors." | 225 | print(("\nParsing finished. %d cached, %d parsed, %d skipped, %d masked, %d errors." |
237 | % ( event.cached, event.parsed, event.skipped, event.masked, event.errors))) | 226 | % ( event.cached, event.parsed, event.skipped, event.masked, event.errors))) |
238 | pbar.hide() | 227 | pbar.hide() |
228 | return | ||
239 | gtk.gdk.threads_enter() | 229 | gtk.gdk.threads_enter() |
240 | pbar.progress.set_fraction(float(x)/float(y)) | 230 | pbar.update(x, y) |
241 | pbar.progress.set_text("%d/%d (%2d %%)" % (x, y, x*100/y)) | ||
242 | gtk.gdk.threads_leave() | 231 | gtk.gdk.threads_leave() |
243 | continue | 232 | continue |
244 | 233 | ||