summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/goggle.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/ui/goggle.py')
-rw-r--r--bitbake/lib/bb/ui/goggle.py126
1 files changed, 0 insertions, 126 deletions
diff --git a/bitbake/lib/bb/ui/goggle.py b/bitbake/lib/bb/ui/goggle.py
deleted file mode 100644
index f5f8f1668f..0000000000
--- a/bitbake/lib/bb/ui/goggle.py
+++ /dev/null
@@ -1,126 +0,0 @@
1#
2# BitBake Graphical GTK User Interface
3#
4# Copyright (C) 2008 Intel Corporation
5#
6# Authored by Rob Bradford <rob@linux.intel.com>
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License version 2 as
10# published by the Free Software Foundation.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License along
18# with this program; if not, write to the Free Software Foundation, Inc.,
19# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21from gi import pygtkcompat
22
23pygtkcompat.enable()
24pygtkcompat.enable_gtk(version='3.0')
25
26import gobject
27import gtk
28import xmlrpc.client
29from bb.ui.crumbs.runningbuild import RunningBuildTreeView, RunningBuild
30from bb.ui.crumbs.progress import ProgressBar
31
32import queue
33
34
35def event_handle_idle_func (eventHandler, build, pbar):
36
37 # Consume as many messages as we can in the time available to us
38 event = eventHandler.getEvent()
39 while event:
40 build.handle_event (event, pbar)
41 event = eventHandler.getEvent()
42
43 return True
44
45def scroll_tv_cb (model, path, iter, view):
46 view.scroll_to_cell (path)
47
48
49# @todo hook these into the GUI so the user has feedback...
50def running_build_failed_cb (running_build):
51 pass
52
53
54def running_build_succeeded_cb (running_build):
55 pass
56
57
58class MainWindow (gtk.Window):
59 def __init__ (self):
60 gtk.Window.__init__ (self, gtk.WINDOW_TOPLEVEL)
61
62 # Setup tree view and the scrolled window
63 scrolled_window = gtk.ScrolledWindow ()
64 self.add (scrolled_window)
65 self.cur_build_tv = RunningBuildTreeView()
66 self.connect("delete-event", gtk.main_quit)
67 self.set_default_size(640, 480)
68 scrolled_window.add (self.cur_build_tv)
69
70
71def main (server, eventHandler, params):
72 gobject.threads_init()
73 gtk.gdk.threads_init()
74
75 window = MainWindow ()
76 window.show_all ()
77 pbar = ProgressBar(window)
78 pbar.connect("delete-event", gtk.main_quit)
79
80 # Create the object for the current build
81 running_build = RunningBuild ()
82 window.cur_build_tv.set_model (running_build.model)
83 running_build.model.connect("row-inserted", scroll_tv_cb, window.cur_build_tv)
84 running_build.connect ("build-succeeded", running_build_succeeded_cb)
85 running_build.connect ("build-failed", running_build_failed_cb)
86
87 try:
88 params.updateFromServer(server)
89 cmdline = params.parseActions()
90 if not cmdline:
91 print("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
92 return 1
93 if 'msg' in cmdline and cmdline['msg']:
94 logger.error(cmdline['msg'])
95 return 1
96 cmdline = cmdline['action']
97 ret, error = server.runCommand(cmdline)
98 if error:
99 print("Error running command '%s': %s" % (cmdline, error))
100 return 1
101 elif ret != True:
102 print("Error running command '%s': returned %s" % (cmdline, ret))
103 return 1
104 except xmlrpcclient.Fault as x:
105 print("XMLRPC Fault getting commandline:\n %s" % x)
106 return 1
107
108 # Use a timeout function for probing the event queue to find out if we
109 # have a message waiting for us.
110 gobject.timeout_add (100,
111 event_handle_idle_func,
112 eventHandler,
113 running_build,
114 pbar)
115
116 try:
117 gtk.main()
118 except EnvironmentError as ioerror:
119 # ignore interrupted io
120 if ioerror.args[0] == 4:
121 pass
122 except KeyboardInterrupt:
123 pass
124 finally:
125 server.runCommand(["stateForceShutdown"])
126