diff options
author | Bob Foerster <robert@erafx.com> | 2010-12-17 23:20:39 +0800 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-05 11:13:48 +0000 |
commit | 2e0ef25a50c6a31cd6de52dfb31a04b77e694da3 (patch) | |
tree | fee195184ef180928f6712b05c1ed223382a6c96 /bitbake/lib/bb/ui/depexp.py | |
parent | 25ac24e02e3e96945e8ac83e16fe27a6b24789b1 (diff) | |
download | poky-2e0ef25a50c6a31cd6de52dfb31a04b77e694da3.tar.gz |
Resurrect alternative UIs
The various alternative UIs have been updated to once again be functional
with the latest bitbake internals. Each of the UIs still have much room for
functional improvement.
In particular, they have been updated to:
- interact with the new process based server
- handle the current set of events and notifications fired from the server
and its associated subsystems
(Bitbake rev: b947e7aa405966262c0614cae02e7978ec637095)
Signed-off-by: Bob Foerster <robert@erafx.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/ui/depexp.py')
-rw-r--r-- | bitbake/lib/bb/ui/depexp.py | 66 |
1 files changed, 54 insertions, 12 deletions
diff --git a/bitbake/lib/bb/ui/depexp.py b/bitbake/lib/bb/ui/depexp.py index 48f6f792db..66ef96cdbc 100644 --- a/bitbake/lib/bb/ui/depexp.py +++ b/bitbake/lib/bb/ui/depexp.py | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | import gobject | 20 | import gobject |
21 | import gtk | 21 | import gtk |
22 | import Queue | ||
22 | import threading | 23 | import threading |
23 | import xmlrpclib | 24 | import xmlrpclib |
24 | import bb | 25 | import bb |
@@ -32,6 +33,7 @@ from bb.ui.crumbs.progress import ProgressBar | |||
32 | (TYPE_DEP, TYPE_RDEP) = (0, 1) | 33 | (TYPE_DEP, TYPE_RDEP) = (0, 1) |
33 | (COL_DEP_TYPE, COL_DEP_PARENT, COL_DEP_PACKAGE) = (0, 1, 2) | 34 | (COL_DEP_TYPE, COL_DEP_PARENT, COL_DEP_PACKAGE) = (0, 1, 2) |
34 | 35 | ||
36 | |||
35 | class PackageDepView(gtk.TreeView): | 37 | class PackageDepView(gtk.TreeView): |
36 | def __init__(self, model, dep_type, label): | 38 | def __init__(self, model, dep_type, label): |
37 | gtk.TreeView.__init__(self) | 39 | gtk.TreeView.__init__(self) |
@@ -52,6 +54,7 @@ class PackageDepView(gtk.TreeView): | |||
52 | self.current = package | 54 | self.current = package |
53 | self.filter_model.refilter() | 55 | self.filter_model.refilter() |
54 | 56 | ||
57 | |||
55 | class PackageReverseDepView(gtk.TreeView): | 58 | class PackageReverseDepView(gtk.TreeView): |
56 | def __init__(self, model, label): | 59 | def __init__(self, model, label): |
57 | gtk.TreeView.__init__(self) | 60 | gtk.TreeView.__init__(self) |
@@ -69,6 +72,7 @@ class PackageReverseDepView(gtk.TreeView): | |||
69 | self.current = package | 72 | self.current = package |
70 | self.filter_model.refilter() | 73 | self.filter_model.refilter() |
71 | 74 | ||
75 | |||
72 | class DepExplorer(gtk.Window): | 76 | class DepExplorer(gtk.Window): |
73 | def __init__(self): | 77 | def __init__(self): |
74 | gtk.Window.__init__(self) | 78 | gtk.Window.__init__(self) |
@@ -90,9 +94,12 @@ class DepExplorer(gtk.Window): | |||
90 | scrolled = gtk.ScrolledWindow() | 94 | scrolled = gtk.ScrolledWindow() |
91 | scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) | 95 | scrolled.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) |
92 | scrolled.set_shadow_type(gtk.SHADOW_IN) | 96 | scrolled.set_shadow_type(gtk.SHADOW_IN) |
97 | |||
93 | self.pkg_treeview = gtk.TreeView(self.pkg_model) | 98 | self.pkg_treeview = gtk.TreeView(self.pkg_model) |
94 | self.pkg_treeview.get_selection().connect("changed", self.on_cursor_changed) | 99 | self.pkg_treeview.get_selection().connect("changed", self.on_cursor_changed) |
95 | self.pkg_treeview.append_column(gtk.TreeViewColumn("Package", gtk.CellRendererText(), text=COL_PKG_NAME)) | 100 | column = gtk.TreeViewColumn("Package", gtk.CellRendererText(), text=COL_PKG_NAME) |
101 | self.pkg_treeview.append_column(column) | ||
102 | column.set_sort_column_id(COL_PKG_NAME) | ||
96 | pane.add1(scrolled) | 103 | pane.add1(scrolled) |
97 | scrolled.add(self.pkg_treeview) | 104 | scrolled.add(self.pkg_treeview) |
98 | 105 | ||
@@ -158,7 +165,6 @@ class DepExplorer(gtk.Window): | |||
158 | 165 | ||
159 | 166 | ||
160 | def parse(depgraph, pkg_model, depends_model): | 167 | def parse(depgraph, pkg_model, depends_model): |
161 | |||
162 | for package in depgraph["pn"]: | 168 | for package in depgraph["pn"]: |
163 | pkg_model.set(pkg_model.append(), COL_PKG_NAME, package) | 169 | pkg_model.set(pkg_model.append(), COL_PKG_NAME, package) |
164 | 170 | ||
@@ -176,6 +182,7 @@ def parse(depgraph, pkg_model, depends_model): | |||
176 | COL_DEP_PARENT, package, | 182 | COL_DEP_PARENT, package, |
177 | COL_DEP_PACKAGE, rdepend) | 183 | COL_DEP_PACKAGE, rdepend) |
178 | 184 | ||
185 | |||
179 | class gtkthread(threading.Thread): | 186 | class gtkthread(threading.Thread): |
180 | quit = threading.Event() | 187 | quit = threading.Event() |
181 | def __init__(self, shutdown): | 188 | def __init__(self, shutdown): |
@@ -189,8 +196,8 @@ class gtkthread(threading.Thread): | |||
189 | gtk.main() | 196 | gtk.main() |
190 | gtkthread.quit.set() | 197 | gtkthread.quit.set() |
191 | 198 | ||
192 | def main(server, eventHandler): | ||
193 | 199 | ||
200 | def main(server, eventHandler): | ||
194 | try: | 201 | try: |
195 | cmdline = server.runCommand(["getCmdLineAction"]) | 202 | cmdline = server.runCommand(["getCmdLineAction"]) |
196 | if not cmdline or cmdline[0] != "generateDotGraph": | 203 | if not cmdline or cmdline[0] != "generateDotGraph": |
@@ -214,25 +221,54 @@ def main(server, eventHandler): | |||
214 | pbar = ProgressBar(dep) | 221 | pbar = ProgressBar(dep) |
215 | gtk.gdk.threads_leave() | 222 | gtk.gdk.threads_leave() |
216 | 223 | ||
224 | progress_total = 0 | ||
217 | while True: | 225 | while True: |
218 | try: | 226 | try: |
219 | event = eventHandler.waitEvent(0.25) | 227 | event = eventHandler.waitEvent(0.25) |
220 | if gtkthread.quit.isSet(): | 228 | if gtkthread.quit.isSet(): |
229 | server.runCommand(["stateStop"]) | ||
221 | break | 230 | break |
222 | 231 | ||
223 | if event is None: | 232 | if event is None: |
224 | continue | 233 | continue |
234 | |||
235 | if isinstance(event, bb.event.CacheLoadStarted): | ||
236 | progress_total = event.total | ||
237 | gtk.gdk.threads_enter() | ||
238 | pbar.set_title("Loading Cache") | ||
239 | pbar.update(0, progress_total) | ||
240 | gtk.gdk.threads_leave() | ||
241 | |||
242 | if isinstance(event, bb.event.CacheLoadProgress): | ||
243 | x = event.current | ||
244 | gtk.gdk.threads_enter() | ||
245 | pbar.update(x, progress_total) | ||
246 | gtk.gdk.threads_leave() | ||
247 | continue | ||
248 | |||
249 | if isinstance(event, bb.event.CacheLoadCompleted): | ||
250 | gtk.gdk.threads_enter() | ||
251 | pbar.update(progress_total, progress_total) | ||
252 | gtk.gdk.threads_leave() | ||
253 | continue | ||
254 | |||
255 | if isinstance(event, bb.event.ParseStarted): | ||
256 | progress_total = event.total | ||
257 | gtk.gdk.threads_enter() | ||
258 | pbar.set_title("Processing recipes") | ||
259 | pbar.update(0, progress_total) | ||
260 | gtk.gdk.threads_leave() | ||
261 | |||
225 | if isinstance(event, bb.event.ParseProgress): | 262 | if isinstance(event, bb.event.ParseProgress): |
226 | x = event.sofar | 263 | x = event.current |
227 | y = event.total | ||
228 | if x == y: | ||
229 | print(("\nParsing finished. %d cached, %d parsed, %d skipped, %d masked, %d errors." | ||
230 | % ( event.cached, event.parsed, event.skipped, event.masked, event.errors))) | ||
231 | pbar.hide() | ||
232 | continue | ||
233 | gtk.gdk.threads_enter() | 264 | gtk.gdk.threads_enter() |
234 | pbar.update(x, y) | 265 | pbar.update(x, progress_total) |
235 | gtk.gdk.threads_leave() | 266 | gtk.gdk.threads_leave() |
267 | |||
268 | continue | ||
269 | |||
270 | if isinstance(event, bb.event.ParseCompleted): | ||
271 | pbar.hide() | ||
236 | continue | 272 | continue |
237 | 273 | ||
238 | if isinstance(event, bb.event.DepTreeGenerated): | 274 | if isinstance(event, bb.event.DepTreeGenerated): |
@@ -242,16 +278,22 @@ def main(server, eventHandler): | |||
242 | 278 | ||
243 | if isinstance(event, bb.command.CommandCompleted): | 279 | if isinstance(event, bb.command.CommandCompleted): |
244 | continue | 280 | continue |
281 | |||
245 | if isinstance(event, bb.command.CommandFailed): | 282 | if isinstance(event, bb.command.CommandFailed): |
246 | print("Command execution failed: %s" % event.error) | 283 | print("Command execution failed: %s" % event.error) |
247 | return event.exitcode | 284 | return event.exitcode |
285 | |||
248 | if isinstance(event, bb.command.CommandExit): | 286 | if isinstance(event, bb.command.CommandExit): |
249 | return event.exitcode | 287 | return event.exitcode |
288 | |||
250 | if isinstance(event, bb.cooker.CookerExit): | 289 | if isinstance(event, bb.cooker.CookerExit): |
251 | break | 290 | break |
252 | 291 | ||
253 | continue | 292 | continue |
254 | 293 | except EnvironmentError as ioerror: | |
294 | # ignore interrupted io | ||
295 | if ioerror.args[0] == 4: | ||
296 | pass | ||
255 | except KeyboardInterrupt: | 297 | except KeyboardInterrupt: |
256 | if shutdown == 2: | 298 | if shutdown == 2: |
257 | print("\nThird Keyboard Interrupt, exit.\n") | 299 | print("\nThird Keyboard Interrupt, exit.\n") |