diff options
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/__init__.py | 18 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/buildmanager.py | 457 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/puccho.glade | 606 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/runningbuild.py | 180 |
4 files changed, 1261 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/__init__.py b/bitbake/lib/bb/ui/crumbs/__init__.py new file mode 100644 index 0000000000..c6a377a8e6 --- /dev/null +++ b/bitbake/lib/bb/ui/crumbs/__init__.py | |||
@@ -0,0 +1,18 @@ | |||
1 | # | ||
2 | # BitBake UI Implementation | ||
3 | # | ||
4 | # Copyright (C) 2006-2007 Richard Purdie | ||
5 | # | ||
6 | # This program is free software; you can redistribute it and/or modify | ||
7 | # it under the terms of the GNU General Public License version 2 as | ||
8 | # published by the Free Software Foundation. | ||
9 | # | ||
10 | # This program is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | # GNU General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License along | ||
16 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
18 | |||
diff --git a/bitbake/lib/bb/ui/crumbs/buildmanager.py b/bitbake/lib/bb/ui/crumbs/buildmanager.py new file mode 100644 index 0000000000..f89e8eefd4 --- /dev/null +++ b/bitbake/lib/bb/ui/crumbs/buildmanager.py | |||
@@ -0,0 +1,457 @@ | |||
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 | |||
21 | import gtk | ||
22 | import gobject | ||
23 | import threading | ||
24 | import os | ||
25 | import datetime | ||
26 | import time | ||
27 | |||
28 | class BuildConfiguration: | ||
29 | """ Represents a potential *or* historic *or* concrete build. It | ||
30 | encompasses all the things that we need to tell bitbake to do to make it | ||
31 | build what we want it to build. | ||
32 | |||
33 | It also stored the metadata URL and the set of possible machines (and the | ||
34 | distros / images / uris for these. Apart from the metdata URL these are | ||
35 | not serialised to file (since they may be transient). In some ways this | ||
36 | functionality might be shifted to the loader class.""" | ||
37 | |||
38 | def __init__ (self): | ||
39 | self.metadata_url = None | ||
40 | |||
41 | # Tuple of (distros, image, urls) | ||
42 | self.machine_options = {} | ||
43 | |||
44 | self.machine = None | ||
45 | self.distro = None | ||
46 | self.image = None | ||
47 | self.urls = [] | ||
48 | self.extra_urls = [] | ||
49 | self.extra_pkgs = [] | ||
50 | |||
51 | def get_machines_model (self): | ||
52 | model = gtk.ListStore (gobject.TYPE_STRING) | ||
53 | for machine in self.machine_options.keys(): | ||
54 | model.append ([machine]) | ||
55 | |||
56 | return model | ||
57 | |||
58 | def get_distro_and_images_models (self, machine): | ||
59 | distro_model = gtk.ListStore (gobject.TYPE_STRING) | ||
60 | |||
61 | for distro in self.machine_options[machine][0]: | ||
62 | distro_model.append ([distro]) | ||
63 | |||
64 | image_model = gtk.ListStore (gobject.TYPE_STRING) | ||
65 | |||
66 | for image in self.machine_options[machine][1]: | ||
67 | image_model.append ([image]) | ||
68 | |||
69 | return (distro_model, image_model) | ||
70 | |||
71 | def get_repos (self): | ||
72 | self.urls = self.machine_options[self.machine][2] | ||
73 | return self.urls | ||
74 | |||
75 | # It might be a lot lot better if we stored these in like, bitbake conf | ||
76 | # file format. | ||
77 | @staticmethod | ||
78 | def load_from_file (filename): | ||
79 | f = open (filename, "r") | ||
80 | |||
81 | conf = BuildConfiguration() | ||
82 | for line in f.readlines(): | ||
83 | data = line.split (";")[1] | ||
84 | if (line.startswith ("metadata-url;")): | ||
85 | conf.metadata_url = data.strip() | ||
86 | continue | ||
87 | if (line.startswith ("url;")): | ||
88 | conf.urls += [data.strip()] | ||
89 | continue | ||
90 | if (line.startswith ("extra-url;")): | ||
91 | conf.extra_urls += [data.strip()] | ||
92 | continue | ||
93 | if (line.startswith ("machine;")): | ||
94 | conf.machine = data.strip() | ||
95 | continue | ||
96 | if (line.startswith ("distribution;")): | ||
97 | conf.distro = data.strip() | ||
98 | continue | ||
99 | if (line.startswith ("image;")): | ||
100 | conf.image = data.strip() | ||
101 | continue | ||
102 | |||
103 | f.close () | ||
104 | return conf | ||
105 | |||
106 | # Serialise to a file. This is part of the build process and we use this | ||
107 | # to be able to repeat a given build (using the same set of parameters) | ||
108 | # but also so that we can include the details of the image / machine / | ||
109 | # distro in the build manager tree view. | ||
110 | def write_to_file (self, filename): | ||
111 | f = open (filename, "w") | ||
112 | |||
113 | lines = [] | ||
114 | |||
115 | if (self.metadata_url): | ||
116 | lines += ["metadata-url;%s\n" % (self.metadata_url)] | ||
117 | |||
118 | for url in self.urls: | ||
119 | lines += ["url;%s\n" % (url)] | ||
120 | |||
121 | for url in self.extra_urls: | ||
122 | lines += ["extra-url;%s\n" % (url)] | ||
123 | |||
124 | if (self.machine): | ||
125 | lines += ["machine;%s\n" % (self.machine)] | ||
126 | |||
127 | if (self.distro): | ||
128 | lines += ["distribution;%s\n" % (self.distro)] | ||
129 | |||
130 | if (self.image): | ||
131 | lines += ["image;%s\n" % (self.image)] | ||
132 | |||
133 | f.writelines (lines) | ||
134 | f.close () | ||
135 | |||
136 | class BuildResult(gobject.GObject): | ||
137 | """ Represents an historic build. Perhaps not successful. But it includes | ||
138 | things such as the files that are in the directory (the output from the | ||
139 | build) as well as a deserialised BuildConfiguration file that is stored in | ||
140 | ".conf" in the directory for the build. | ||
141 | |||
142 | This is GObject so that it can be included in the TreeStore.""" | ||
143 | |||
144 | (STATE_COMPLETE, STATE_FAILED, STATE_ONGOING) = \ | ||
145 | (0, 1, 2) | ||
146 | |||
147 | def __init__ (self, parent, identifier): | ||
148 | gobject.GObject.__init__ (self) | ||
149 | self.date = None | ||
150 | |||
151 | self.files = [] | ||
152 | self.status = None | ||
153 | self.identifier = identifier | ||
154 | self.path = os.path.join (parent, identifier) | ||
155 | |||
156 | # Extract the date, since the directory name is of the | ||
157 | # format build-<year><month><day>-<ordinal> we can easily | ||
158 | # pull it out. | ||
159 | # TODO: Better to stat a file? | ||
160 | (_ , date, revision) = identifier.split ("-") | ||
161 | print date | ||
162 | |||
163 | year = int (date[0:4]) | ||
164 | month = int (date[4:6]) | ||
165 | day = int (date[6:8]) | ||
166 | |||
167 | self.date = datetime.date (year, month, day) | ||
168 | |||
169 | self.conf = None | ||
170 | |||
171 | # By default builds are STATE_FAILED unless we find a "complete" file | ||
172 | # in which case they are STATE_COMPLETE | ||
173 | self.state = BuildResult.STATE_FAILED | ||
174 | for file in os.listdir (self.path): | ||
175 | if (file.startswith (".conf")): | ||
176 | conffile = os.path.join (self.path, file) | ||
177 | self.conf = BuildConfiguration.load_from_file (conffile) | ||
178 | elif (file.startswith ("complete")): | ||
179 | self.state = BuildResult.STATE_COMPLETE | ||
180 | else: | ||
181 | self.add_file (file) | ||
182 | |||
183 | def add_file (self, file): | ||
184 | # Just add the file for now. Don't care about the type. | ||
185 | self.files += [(file, None)] | ||
186 | |||
187 | class BuildManagerModel (gtk.TreeStore): | ||
188 | """ Model for the BuildManagerTreeView. This derives from gtk.TreeStore | ||
189 | but it abstracts nicely what the columns mean and the setup of the columns | ||
190 | in the model. """ | ||
191 | |||
192 | (COL_IDENT, COL_DESC, COL_MACHINE, COL_DISTRO, COL_BUILD_RESULT, COL_DATE, COL_STATE) = \ | ||
193 | (0, 1, 2, 3, 4, 5, 6) | ||
194 | |||
195 | def __init__ (self): | ||
196 | gtk.TreeStore.__init__ (self, | ||
197 | gobject.TYPE_STRING, | ||
198 | gobject.TYPE_STRING, | ||
199 | gobject.TYPE_STRING, | ||
200 | gobject.TYPE_STRING, | ||
201 | gobject.TYPE_OBJECT, | ||
202 | gobject.TYPE_INT64, | ||
203 | gobject.TYPE_INT) | ||
204 | |||
205 | class BuildManager (gobject.GObject): | ||
206 | """ This class manages the historic builds that have been found in the | ||
207 | "results" directory but is also used for starting a new build.""" | ||
208 | |||
209 | __gsignals__ = { | ||
210 | 'population-finished' : (gobject.SIGNAL_RUN_LAST, | ||
211 | gobject.TYPE_NONE, | ||
212 | ()), | ||
213 | 'populate-error' : (gobject.SIGNAL_RUN_LAST, | ||
214 | gobject.TYPE_NONE, | ||
215 | ()) | ||
216 | } | ||
217 | |||
218 | def update_build_result (self, result, iter): | ||
219 | # Convert the date into something we can sort by. | ||
220 | date = long (time.mktime (result.date.timetuple())) | ||
221 | |||
222 | # Add a top level entry for the build | ||
223 | |||
224 | self.model.set (iter, | ||
225 | BuildManagerModel.COL_IDENT, result.identifier, | ||
226 | BuildManagerModel.COL_DESC, result.conf.image, | ||
227 | BuildManagerModel.COL_MACHINE, result.conf.machine, | ||
228 | BuildManagerModel.COL_DISTRO, result.conf.distro, | ||
229 | BuildManagerModel.COL_BUILD_RESULT, result, | ||
230 | BuildManagerModel.COL_DATE, date, | ||
231 | BuildManagerModel.COL_STATE, result.state) | ||
232 | |||
233 | # And then we use the files in the directory as the children for the | ||
234 | # top level iter. | ||
235 | for file in result.files: | ||
236 | self.model.append (iter, (None, file[0], None, None, None, date, -1)) | ||
237 | |||
238 | # This function is called as an idle by the BuildManagerPopulaterThread | ||
239 | def add_build_result (self, result): | ||
240 | gtk.gdk.threads_enter() | ||
241 | self.known_builds += [result] | ||
242 | |||
243 | self.update_build_result (result, self.model.append (None)) | ||
244 | |||
245 | gtk.gdk.threads_leave() | ||
246 | |||
247 | def notify_build_finished (self): | ||
248 | # This is a bit of a hack. If we have a running build running then we | ||
249 | # will have a row in the model in STATE_ONGOING. Find it and make it | ||
250 | # as if it was a proper historic build (well, it is completed now....) | ||
251 | |||
252 | # We need to use the iters here rather than the Python iterator | ||
253 | # interface to the model since we need to pass it into | ||
254 | # update_build_result | ||
255 | |||
256 | iter = self.model.get_iter_first() | ||
257 | |||
258 | while (iter): | ||
259 | (ident, state) = self.model.get(iter, | ||
260 | BuildManagerModel.COL_IDENT, | ||
261 | BuildManagerModel.COL_STATE) | ||
262 | |||
263 | if state == BuildResult.STATE_ONGOING: | ||
264 | result = BuildResult (self.results_directory, ident) | ||
265 | self.update_build_result (result, iter) | ||
266 | iter = self.model.iter_next(iter) | ||
267 | |||
268 | def notify_build_succeeded (self): | ||
269 | # Write the "complete" file so that when we create the BuildResult | ||
270 | # object we put into the model | ||
271 | |||
272 | complete_file_path = os.path.join (self.cur_build_directory, "complete") | ||
273 | f = file (complete_file_path, "w") | ||
274 | f.close() | ||
275 | self.notify_build_finished() | ||
276 | |||
277 | def notify_build_failed (self): | ||
278 | # Without a "complete" file then this will mark the build as failed: | ||
279 | self.notify_build_finished() | ||
280 | |||
281 | # This function is called as an idle | ||
282 | def emit_population_finished_signal (self): | ||
283 | gtk.gdk.threads_enter() | ||
284 | self.emit ("population-finished") | ||
285 | gtk.gdk.threads_leave() | ||
286 | |||
287 | class BuildManagerPopulaterThread (threading.Thread): | ||
288 | def __init__ (self, manager, directory): | ||
289 | threading.Thread.__init__ (self) | ||
290 | self.manager = manager | ||
291 | self.directory = directory | ||
292 | |||
293 | def run (self): | ||
294 | # For each of the "build-<...>" directories .. | ||
295 | |||
296 | if os.path.exists (self.directory): | ||
297 | for directory in os.listdir (self.directory): | ||
298 | |||
299 | if not directory.startswith ("build-"): | ||
300 | continue | ||
301 | |||
302 | build_result = BuildResult (self.directory, directory) | ||
303 | self.manager.add_build_result (build_result) | ||
304 | |||
305 | gobject.idle_add (BuildManager.emit_population_finished_signal, | ||
306 | self.manager) | ||
307 | |||
308 | def __init__ (self, server, results_directory): | ||
309 | gobject.GObject.__init__ (self) | ||
310 | |||
311 | # The builds that we've found from walking the result directory | ||
312 | self.known_builds = [] | ||
313 | |||
314 | # Save out the bitbake server, we need this for issuing commands to | ||
315 | # the cooker: | ||
316 | self.server = server | ||
317 | |||
318 | # The TreeStore that we use | ||
319 | self.model = BuildManagerModel () | ||
320 | |||
321 | # The results directory is where we create (and look for) the | ||
322 | # build-<xyz>-<n> directories. We need to populate ourselves from | ||
323 | # directory | ||
324 | self.results_directory = results_directory | ||
325 | self.populate_from_directory (self.results_directory) | ||
326 | |||
327 | def populate_from_directory (self, directory): | ||
328 | thread = BuildManager.BuildManagerPopulaterThread (self, directory) | ||
329 | thread.start() | ||
330 | |||
331 | # Come up with the name for the next build ident by combining "build-" | ||
332 | # with the date formatted as yyyymmdd and then an ordinal. We do this by | ||
333 | # an optimistic algorithm incrementing the ordinal if we find that it | ||
334 | # already exists. | ||
335 | def get_next_build_ident (self): | ||
336 | today = datetime.date.today () | ||
337 | datestr = str (today.year) + str (today.month) + str (today.day) | ||
338 | |||
339 | revision = 0 | ||
340 | test_name = "build-%s-%d" % (datestr, revision) | ||
341 | test_path = os.path.join (self.results_directory, test_name) | ||
342 | |||
343 | while (os.path.exists (test_path)): | ||
344 | revision += 1 | ||
345 | test_name = "build-%s-%d" % (datestr, revision) | ||
346 | test_path = os.path.join (self.results_directory, test_name) | ||
347 | |||
348 | return test_name | ||
349 | |||
350 | # Take a BuildConfiguration and then try and build it based on the | ||
351 | # parameters of that configuration. S | ||
352 | def do_build (self, conf): | ||
353 | server = self.server | ||
354 | |||
355 | # Work out the build directory. Note we actually create the | ||
356 | # directories here since we need to write the ".conf" file. Otherwise | ||
357 | # we could have relied on bitbake's builder thread to actually make | ||
358 | # the directories as it proceeds with the build. | ||
359 | ident = self.get_next_build_ident () | ||
360 | build_directory = os.path.join (self.results_directory, | ||
361 | ident) | ||
362 | self.cur_build_directory = build_directory | ||
363 | os.makedirs (build_directory) | ||
364 | |||
365 | conffile = os.path.join (build_directory, ".conf") | ||
366 | conf.write_to_file (conffile) | ||
367 | |||
368 | # Add a row to the model representing this ongoing build. It's kinda a | ||
369 | # fake entry. If this build completes or fails then this gets updated | ||
370 | # with the real stuff like the historic builds | ||
371 | date = long (time.time()) | ||
372 | self.model.append (None, (ident, conf.image, conf.machine, conf.distro, | ||
373 | None, date, BuildResult.STATE_ONGOING)) | ||
374 | try: | ||
375 | server.runCommand(["setVariable", "BUILD_IMAGES_FROM_FEEDS", 1]) | ||
376 | server.runCommand(["setVariable", "MACHINE", conf.machine]) | ||
377 | server.runCommand(["setVariable", "DISTRO", conf.distro]) | ||
378 | server.runCommand(["setVariable", "PACKAGE_CLASSES", "package_ipk"]) | ||
379 | server.runCommand(["setVariable", "BBFILES", \ | ||
380 | """${OEROOT}/meta/packages/*/*.bb ${OEROOT}/meta-moblin/packages/*/*.bb"""]) | ||
381 | server.runCommand(["setVariable", "TMPDIR", "${OEROOT}/build/tmp"]) | ||
382 | server.runCommand(["setVariable", "IPK_FEED_URIS", \ | ||
383 | " ".join(conf.get_repos())]) | ||
384 | server.runCommand(["setVariable", "DEPLOY_DIR_IMAGE", | ||
385 | build_directory]) | ||
386 | server.runCommand(["buildTargets", [conf.image], "rootfs"]) | ||
387 | |||
388 | except Exception, e: | ||
389 | print e | ||
390 | |||
391 | class BuildManagerTreeView (gtk.TreeView): | ||
392 | """ The tree view for the build manager. This shows the historic builds | ||
393 | and so forth. """ | ||
394 | |||
395 | # We use this function to control what goes in the cell since we store | ||
396 | # the date in the model as seconds since the epoch (for sorting) and so we | ||
397 | # need to make it human readable. | ||
398 | def date_format_custom_cell_data_func (self, col, cell, model, iter): | ||
399 | date = model.get (iter, BuildManagerModel.COL_DATE)[0] | ||
400 | datestr = time.strftime("%A %d %B %Y", time.localtime(date)) | ||
401 | cell.set_property ("text", datestr) | ||
402 | |||
403 | # This format function controls what goes in the cell. We use this to map | ||
404 | # the integer state to a string and also to colourise the text | ||
405 | def state_format_custom_cell_data_fun (self, col, cell, model, iter): | ||
406 | state = model.get (iter, BuildManagerModel.COL_STATE)[0] | ||
407 | |||
408 | if (state == BuildResult.STATE_ONGOING): | ||
409 | cell.set_property ("text", "Active") | ||
410 | cell.set_property ("foreground", "#000000") | ||
411 | elif (state == BuildResult.STATE_FAILED): | ||
412 | cell.set_property ("text", "Failed") | ||
413 | cell.set_property ("foreground", "#ff0000") | ||
414 | elif (state == BuildResult.STATE_COMPLETE): | ||
415 | cell.set_property ("text", "Complete") | ||
416 | cell.set_property ("foreground", "#00ff00") | ||
417 | else: | ||
418 | cell.set_property ("text", "") | ||
419 | |||
420 | def __init__ (self): | ||
421 | gtk.TreeView.__init__(self) | ||
422 | |||
423 | # Misc descriptiony thing | ||
424 | renderer = gtk.CellRendererText () | ||
425 | col = gtk.TreeViewColumn (None, renderer, | ||
426 | text=BuildManagerModel.COL_DESC) | ||
427 | self.append_column (col) | ||
428 | |||
429 | # Machine | ||
430 | renderer = gtk.CellRendererText () | ||
431 | col = gtk.TreeViewColumn ("Machine", renderer, | ||
432 | text=BuildManagerModel.COL_MACHINE) | ||
433 | self.append_column (col) | ||
434 | |||
435 | # distro | ||
436 | renderer = gtk.CellRendererText () | ||
437 | col = gtk.TreeViewColumn ("Distribution", renderer, | ||
438 | text=BuildManagerModel.COL_DISTRO) | ||
439 | self.append_column (col) | ||
440 | |||
441 | # date (using a custom function for formatting the cell contents it | ||
442 | # takes epoch -> human readable string) | ||
443 | renderer = gtk.CellRendererText () | ||
444 | col = gtk.TreeViewColumn ("Date", renderer, | ||
445 | text=BuildManagerModel.COL_DATE) | ||
446 | self.append_column (col) | ||
447 | col.set_cell_data_func (renderer, | ||
448 | self.date_format_custom_cell_data_func) | ||
449 | |||
450 | # For status. | ||
451 | renderer = gtk.CellRendererText () | ||
452 | col = gtk.TreeViewColumn ("Status", renderer, | ||
453 | text = BuildManagerModel.COL_STATE) | ||
454 | self.append_column (col) | ||
455 | col.set_cell_data_func (renderer, | ||
456 | self.state_format_custom_cell_data_fun) | ||
457 | |||
diff --git a/bitbake/lib/bb/ui/crumbs/puccho.glade b/bitbake/lib/bb/ui/crumbs/puccho.glade new file mode 100644 index 0000000000..d7553a6e14 --- /dev/null +++ b/bitbake/lib/bb/ui/crumbs/puccho.glade | |||
@@ -0,0 +1,606 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
2 | <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> | ||
3 | <!--Generated with glade3 3.4.5 on Mon Nov 10 12:24:12 2008 --> | ||
4 | <glade-interface> | ||
5 | <widget class="GtkDialog" id="build_dialog"> | ||
6 | <property name="title" translatable="yes">Start a build</property> | ||
7 | <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> | ||
8 | <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> | ||
9 | <property name="has_separator">False</property> | ||
10 | <child internal-child="vbox"> | ||
11 | <widget class="GtkVBox" id="dialog-vbox1"> | ||
12 | <property name="visible">True</property> | ||
13 | <property name="spacing">2</property> | ||
14 | <child> | ||
15 | <widget class="GtkTable" id="build_table"> | ||
16 | <property name="visible">True</property> | ||
17 | <property name="border_width">6</property> | ||
18 | <property name="n_rows">7</property> | ||
19 | <property name="n_columns">3</property> | ||
20 | <property name="column_spacing">5</property> | ||
21 | <property name="row_spacing">6</property> | ||
22 | <child> | ||
23 | <widget class="GtkAlignment" id="status_alignment"> | ||
24 | <property name="visible">True</property> | ||
25 | <property name="left_padding">12</property> | ||
26 | <child> | ||
27 | <widget class="GtkHBox" id="status_hbox"> | ||
28 | <property name="spacing">6</property> | ||
29 | <child> | ||
30 | <widget class="GtkImage" id="status_image"> | ||
31 | <property name="visible">True</property> | ||
32 | <property name="no_show_all">True</property> | ||
33 | <property name="xalign">0</property> | ||
34 | <property name="stock">gtk-dialog-error</property> | ||
35 | </widget> | ||
36 | <packing> | ||
37 | <property name="expand">False</property> | ||
38 | <property name="fill">False</property> | ||
39 | </packing> | ||
40 | </child> | ||
41 | <child> | ||
42 | <widget class="GtkLabel" id="status_label"> | ||
43 | <property name="visible">True</property> | ||
44 | <property name="xalign">0</property> | ||
45 | <property name="label" translatable="yes">If you see this text something is wrong...</property> | ||
46 | <property name="use_markup">True</property> | ||
47 | <property name="use_underline">True</property> | ||
48 | </widget> | ||
49 | <packing> | ||
50 | <property name="position">1</property> | ||
51 | </packing> | ||
52 | </child> | ||
53 | </widget> | ||
54 | </child> | ||
55 | </widget> | ||
56 | <packing> | ||
57 | <property name="right_attach">3</property> | ||
58 | <property name="top_attach">2</property> | ||
59 | <property name="bottom_attach">3</property> | ||
60 | </packing> | ||
61 | </child> | ||
62 | <child> | ||
63 | <widget class="GtkLabel" id="label2"> | ||
64 | <property name="visible">True</property> | ||
65 | <property name="xalign">0</property> | ||
66 | <property name="label" translatable="yes"><b>Build configuration</b></property> | ||
67 | <property name="use_markup">True</property> | ||
68 | </widget> | ||
69 | <packing> | ||
70 | <property name="right_attach">3</property> | ||
71 | <property name="top_attach">3</property> | ||
72 | <property name="bottom_attach">4</property> | ||
73 | <property name="y_options"></property> | ||
74 | </packing> | ||
75 | </child> | ||
76 | <child> | ||
77 | <widget class="GtkComboBox" id="image_combo"> | ||
78 | <property name="visible">True</property> | ||
79 | <property name="sensitive">False</property> | ||
80 | </widget> | ||
81 | <packing> | ||
82 | <property name="left_attach">1</property> | ||
83 | <property name="right_attach">2</property> | ||
84 | <property name="top_attach">6</property> | ||
85 | <property name="bottom_attach">7</property> | ||
86 | <property name="y_options"></property> | ||
87 | </packing> | ||
88 | </child> | ||
89 | <child> | ||
90 | <widget class="GtkLabel" id="image_label"> | ||
91 | <property name="visible">True</property> | ||
92 | <property name="sensitive">False</property> | ||
93 | <property name="xalign">0</property> | ||
94 | <property name="xpad">12</property> | ||
95 | <property name="label" translatable="yes">Image:</property> | ||
96 | </widget> | ||
97 | <packing> | ||
98 | <property name="top_attach">6</property> | ||
99 | <property name="bottom_attach">7</property> | ||
100 | <property name="y_options"></property> | ||
101 | </packing> | ||
102 | </child> | ||
103 | <child> | ||
104 | <widget class="GtkComboBox" id="distribution_combo"> | ||
105 | <property name="visible">True</property> | ||
106 | <property name="sensitive">False</property> | ||
107 | </widget> | ||
108 | <packing> | ||
109 | <property name="left_attach">1</property> | ||
110 | <property name="right_attach">2</property> | ||
111 | <property name="top_attach">5</property> | ||
112 | <property name="bottom_attach">6</property> | ||
113 | <property name="y_options"></property> | ||
114 | </packing> | ||
115 | </child> | ||
116 | <child> | ||
117 | <widget class="GtkLabel" id="distribution_label"> | ||
118 | <property name="visible">True</property> | ||
119 | <property name="sensitive">False</property> | ||
120 | <property name="xalign">0</property> | ||
121 | <property name="xpad">12</property> | ||
122 | <property name="label" translatable="yes">Distribution:</property> | ||
123 | </widget> | ||
124 | <packing> | ||
125 | <property name="top_attach">5</property> | ||
126 | <property name="bottom_attach">6</property> | ||
127 | <property name="y_options"></property> | ||
128 | </packing> | ||
129 | </child> | ||
130 | <child> | ||
131 | <widget class="GtkComboBox" id="machine_combo"> | ||
132 | <property name="visible">True</property> | ||
133 | <property name="sensitive">False</property> | ||
134 | </widget> | ||
135 | <packing> | ||
136 | <property name="left_attach">1</property> | ||
137 | <property name="right_attach">2</property> | ||
138 | <property name="top_attach">4</property> | ||
139 | <property name="bottom_attach">5</property> | ||
140 | <property name="y_options"></property> | ||
141 | </packing> | ||
142 | </child> | ||
143 | <child> | ||
144 | <widget class="GtkLabel" id="machine_label"> | ||
145 | <property name="visible">True</property> | ||
146 | <property name="sensitive">False</property> | ||
147 | <property name="xalign">0</property> | ||
148 | <property name="xpad">12</property> | ||
149 | <property name="label" translatable="yes">Machine:</property> | ||
150 | </widget> | ||
151 | <packing> | ||
152 | <property name="top_attach">4</property> | ||
153 | <property name="bottom_attach">5</property> | ||
154 | <property name="y_options"></property> | ||
155 | </packing> | ||
156 | </child> | ||
157 | <child> | ||
158 | <widget class="GtkButton" id="refresh_button"> | ||
159 | <property name="visible">True</property> | ||
160 | <property name="sensitive">False</property> | ||
161 | <property name="can_focus">True</property> | ||
162 | <property name="receives_default">True</property> | ||
163 | <property name="label" translatable="yes">gtk-refresh</property> | ||
164 | <property name="use_stock">True</property> | ||
165 | <property name="response_id">0</property> | ||
166 | </widget> | ||
167 | <packing> | ||
168 | <property name="left_attach">2</property> | ||
169 | <property name="right_attach">3</property> | ||
170 | <property name="top_attach">1</property> | ||
171 | <property name="bottom_attach">2</property> | ||
172 | <property name="y_options"></property> | ||
173 | </packing> | ||
174 | </child> | ||
175 | <child> | ||
176 | <widget class="GtkEntry" id="location_entry"> | ||
177 | <property name="visible">True</property> | ||
178 | <property name="can_focus">True</property> | ||
179 | <property name="width_chars">32</property> | ||
180 | </widget> | ||
181 | <packing> | ||
182 | <property name="left_attach">1</property> | ||
183 | <property name="right_attach">2</property> | ||
184 | <property name="top_attach">1</property> | ||
185 | <property name="bottom_attach">2</property> | ||
186 | <property name="y_options"></property> | ||
187 | </packing> | ||
188 | </child> | ||
189 | <child> | ||
190 | <widget class="GtkLabel" id="label3"> | ||
191 | <property name="visible">True</property> | ||
192 | <property name="xalign">0</property> | ||
193 | <property name="xpad">12</property> | ||
194 | <property name="label" translatable="yes">Location:</property> | ||
195 | </widget> | ||
196 | <packing> | ||
197 | <property name="top_attach">1</property> | ||
198 | <property name="bottom_attach">2</property> | ||
199 | <property name="y_options"></property> | ||
200 | </packing> | ||
201 | </child> | ||
202 | <child> | ||
203 | <widget class="GtkLabel" id="label1"> | ||
204 | <property name="visible">True</property> | ||
205 | <property name="xalign">0</property> | ||
206 | <property name="label" translatable="yes"><b>Repository</b></property> | ||
207 | <property name="use_markup">True</property> | ||
208 | </widget> | ||
209 | <packing> | ||
210 | <property name="right_attach">3</property> | ||
211 | <property name="y_options"></property> | ||
212 | </packing> | ||
213 | </child> | ||
214 | <child> | ||
215 | <widget class="GtkAlignment" id="alignment1"> | ||
216 | <property name="visible">True</property> | ||
217 | <child> | ||
218 | <placeholder/> | ||
219 | </child> | ||
220 | </widget> | ||
221 | <packing> | ||
222 | <property name="left_attach">2</property> | ||
223 | <property name="right_attach">3</property> | ||
224 | <property name="top_attach">4</property> | ||
225 | <property name="bottom_attach">5</property> | ||
226 | <property name="y_options"></property> | ||
227 | </packing> | ||
228 | </child> | ||
229 | <child> | ||
230 | <widget class="GtkAlignment" id="alignment2"> | ||
231 | <property name="visible">True</property> | ||
232 | <child> | ||
233 | <placeholder/> | ||
234 | </child> | ||
235 | </widget> | ||
236 | <packing> | ||
237 | <property name="left_attach">2</property> | ||
238 | <property name="right_attach">3</property> | ||
239 | <property name="top_attach">5</property> | ||
240 | <property name="bottom_attach">6</property> | ||
241 | <property name="y_options"></property> | ||
242 | </packing> | ||
243 | </child> | ||
244 | <child> | ||
245 | <widget class="GtkAlignment" id="alignment3"> | ||
246 | <property name="visible">True</property> | ||
247 | <child> | ||
248 | <placeholder/> | ||
249 | </child> | ||
250 | </widget> | ||
251 | <packing> | ||
252 | <property name="left_attach">2</property> | ||
253 | <property name="right_attach">3</property> | ||
254 | <property name="top_attach">6</property> | ||
255 | <property name="bottom_attach">7</property> | ||
256 | <property name="y_options"></property> | ||
257 | </packing> | ||
258 | </child> | ||
259 | </widget> | ||
260 | <packing> | ||
261 | <property name="position">1</property> | ||
262 | </packing> | ||
263 | </child> | ||
264 | <child internal-child="action_area"> | ||
265 | <widget class="GtkHButtonBox" id="dialog-action_area1"> | ||
266 | <property name="visible">True</property> | ||
267 | <property name="layout_style">GTK_BUTTONBOX_END</property> | ||
268 | <child> | ||
269 | <placeholder/> | ||
270 | </child> | ||
271 | <child> | ||
272 | <placeholder/> | ||
273 | </child> | ||
274 | <child> | ||
275 | <placeholder/> | ||
276 | </child> | ||
277 | </widget> | ||
278 | <packing> | ||
279 | <property name="expand">False</property> | ||
280 | <property name="pack_type">GTK_PACK_END</property> | ||
281 | </packing> | ||
282 | </child> | ||
283 | </widget> | ||
284 | </child> | ||
285 | </widget> | ||
286 | <widget class="GtkDialog" id="dialog2"> | ||
287 | <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> | ||
288 | <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> | ||
289 | <property name="has_separator">False</property> | ||
290 | <child internal-child="vbox"> | ||
291 | <widget class="GtkVBox" id="dialog-vbox2"> | ||
292 | <property name="visible">True</property> | ||
293 | <property name="spacing">2</property> | ||
294 | <child> | ||
295 | <widget class="GtkTable" id="table2"> | ||
296 | <property name="visible">True</property> | ||
297 | <property name="border_width">6</property> | ||
298 | <property name="n_rows">7</property> | ||
299 | <property name="n_columns">3</property> | ||
300 | <property name="column_spacing">6</property> | ||
301 | <property name="row_spacing">6</property> | ||
302 | <child> | ||
303 | <widget class="GtkLabel" id="label7"> | ||
304 | <property name="visible">True</property> | ||
305 | <property name="xalign">0</property> | ||
306 | <property name="label" translatable="yes"><b>Repositories</b></property> | ||
307 | <property name="use_markup">True</property> | ||
308 | </widget> | ||
309 | <packing> | ||
310 | <property name="right_attach">3</property> | ||
311 | <property name="y_options"></property> | ||
312 | </packing> | ||
313 | </child> | ||
314 | <child> | ||
315 | <widget class="GtkAlignment" id="alignment4"> | ||
316 | <property name="visible">True</property> | ||
317 | <property name="xalign">0</property> | ||
318 | <property name="left_padding">12</property> | ||
319 | <child> | ||
320 | <widget class="GtkScrolledWindow" id="scrolledwindow1"> | ||
321 | <property name="visible">True</property> | ||
322 | <property name="can_focus">True</property> | ||
323 | <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
324 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
325 | <child> | ||
326 | <widget class="GtkTreeView" id="treeview1"> | ||
327 | <property name="visible">True</property> | ||
328 | <property name="can_focus">True</property> | ||
329 | <property name="headers_clickable">True</property> | ||
330 | </widget> | ||
331 | </child> | ||
332 | </widget> | ||
333 | </child> | ||
334 | </widget> | ||
335 | <packing> | ||
336 | <property name="right_attach">3</property> | ||
337 | <property name="top_attach">2</property> | ||
338 | <property name="bottom_attach">3</property> | ||
339 | <property name="y_options"></property> | ||
340 | </packing> | ||
341 | </child> | ||
342 | <child> | ||
343 | <widget class="GtkEntry" id="entry1"> | ||
344 | <property name="visible">True</property> | ||
345 | <property name="can_focus">True</property> | ||
346 | </widget> | ||
347 | <packing> | ||
348 | <property name="left_attach">1</property> | ||
349 | <property name="right_attach">3</property> | ||
350 | <property name="top_attach">1</property> | ||
351 | <property name="bottom_attach">2</property> | ||
352 | <property name="y_options"></property> | ||
353 | </packing> | ||
354 | </child> | ||
355 | <child> | ||
356 | <widget class="GtkLabel" id="label9"> | ||
357 | <property name="visible">True</property> | ||
358 | <property name="xalign">0</property> | ||
359 | <property name="label" translatable="yes"><b>Additional packages</b></property> | ||
360 | <property name="use_markup">True</property> | ||
361 | </widget> | ||
362 | <packing> | ||
363 | <property name="right_attach">3</property> | ||
364 | <property name="top_attach">4</property> | ||
365 | <property name="bottom_attach">5</property> | ||
366 | <property name="y_options"></property> | ||
367 | </packing> | ||
368 | </child> | ||
369 | <child> | ||
370 | <widget class="GtkAlignment" id="alignment6"> | ||
371 | <property name="visible">True</property> | ||
372 | <property name="xalign">0</property> | ||
373 | <property name="xscale">0</property> | ||
374 | <child> | ||
375 | <widget class="GtkLabel" id="label8"> | ||
376 | <property name="visible">True</property> | ||
377 | <property name="xalign">0</property> | ||
378 | <property name="yalign">0</property> | ||
379 | <property name="xpad">12</property> | ||
380 | <property name="label" translatable="yes">Location: </property> | ||
381 | </widget> | ||
382 | </child> | ||
383 | </widget> | ||
384 | <packing> | ||
385 | <property name="top_attach">1</property> | ||
386 | <property name="bottom_attach">2</property> | ||
387 | <property name="y_options"></property> | ||
388 | </packing> | ||
389 | </child> | ||
390 | <child> | ||
391 | <widget class="GtkAlignment" id="alignment7"> | ||
392 | <property name="visible">True</property> | ||
393 | <property name="xalign">1</property> | ||
394 | <property name="xscale">0</property> | ||
395 | <child> | ||
396 | <widget class="GtkHButtonBox" id="hbuttonbox1"> | ||
397 | <property name="visible">True</property> | ||
398 | <property name="spacing">5</property> | ||
399 | <child> | ||
400 | <widget class="GtkButton" id="button7"> | ||
401 | <property name="visible">True</property> | ||
402 | <property name="can_focus">True</property> | ||
403 | <property name="receives_default">True</property> | ||
404 | <property name="label" translatable="yes">gtk-remove</property> | ||
405 | <property name="use_stock">True</property> | ||
406 | <property name="response_id">0</property> | ||
407 | </widget> | ||
408 | </child> | ||
409 | <child> | ||
410 | <widget class="GtkButton" id="button6"> | ||
411 | <property name="visible">True</property> | ||
412 | <property name="can_focus">True</property> | ||
413 | <property name="receives_default">True</property> | ||
414 | <property name="label" translatable="yes">gtk-edit</property> | ||
415 | <property name="use_stock">True</property> | ||
416 | <property name="response_id">0</property> | ||
417 | </widget> | ||
418 | <packing> | ||
419 | <property name="position">1</property> | ||
420 | </packing> | ||
421 | </child> | ||
422 | <child> | ||
423 | <widget class="GtkButton" id="button5"> | ||
424 | <property name="visible">True</property> | ||
425 | <property name="can_focus">True</property> | ||
426 | <property name="receives_default">True</property> | ||
427 | <property name="label" translatable="yes">gtk-add</property> | ||
428 | <property name="use_stock">True</property> | ||
429 | <property name="response_id">0</property> | ||
430 | </widget> | ||
431 | <packing> | ||
432 | <property name="position">2</property> | ||
433 | </packing> | ||
434 | </child> | ||
435 | </widget> | ||
436 | </child> | ||
437 | </widget> | ||
438 | <packing> | ||
439 | <property name="left_attach">1</property> | ||
440 | <property name="right_attach">3</property> | ||
441 | <property name="top_attach">3</property> | ||
442 | <property name="bottom_attach">4</property> | ||
443 | <property name="y_options"></property> | ||
444 | </packing> | ||
445 | </child> | ||
446 | <child> | ||
447 | <widget class="GtkAlignment" id="alignment5"> | ||
448 | <property name="visible">True</property> | ||
449 | <child> | ||
450 | <placeholder/> | ||
451 | </child> | ||
452 | </widget> | ||
453 | <packing> | ||
454 | <property name="top_attach">3</property> | ||
455 | <property name="bottom_attach">4</property> | ||
456 | <property name="y_options"></property> | ||
457 | </packing> | ||
458 | </child> | ||
459 | <child> | ||
460 | <widget class="GtkLabel" id="label10"> | ||
461 | <property name="visible">True</property> | ||
462 | <property name="xalign">0</property> | ||
463 | <property name="yalign">0</property> | ||
464 | <property name="xpad">12</property> | ||
465 | <property name="label" translatable="yes">Search:</property> | ||
466 | </widget> | ||
467 | <packing> | ||
468 | <property name="top_attach">5</property> | ||
469 | <property name="bottom_attach">6</property> | ||
470 | <property name="y_options"></property> | ||
471 | </packing> | ||
472 | </child> | ||
473 | <child> | ||
474 | <widget class="GtkEntry" id="entry2"> | ||
475 | <property name="visible">True</property> | ||
476 | <property name="can_focus">True</property> | ||
477 | </widget> | ||
478 | <packing> | ||
479 | <property name="left_attach">1</property> | ||
480 | <property name="right_attach">3</property> | ||
481 | <property name="top_attach">5</property> | ||
482 | <property name="bottom_attach">6</property> | ||
483 | <property name="y_options"></property> | ||
484 | </packing> | ||
485 | </child> | ||
486 | <child> | ||
487 | <widget class="GtkAlignment" id="alignment8"> | ||
488 | <property name="visible">True</property> | ||
489 | <property name="xalign">0</property> | ||
490 | <property name="left_padding">12</property> | ||
491 | <child> | ||
492 | <widget class="GtkScrolledWindow" id="scrolledwindow2"> | ||
493 | <property name="visible">True</property> | ||
494 | <property name="can_focus">True</property> | ||
495 | <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
496 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
497 | <child> | ||
498 | <widget class="GtkTreeView" id="treeview2"> | ||
499 | <property name="visible">True</property> | ||
500 | <property name="can_focus">True</property> | ||
501 | <property name="headers_clickable">True</property> | ||
502 | </widget> | ||
503 | </child> | ||
504 | </widget> | ||
505 | </child> | ||
506 | </widget> | ||
507 | <packing> | ||
508 | <property name="right_attach">3</property> | ||
509 | <property name="top_attach">6</property> | ||
510 | <property name="bottom_attach">7</property> | ||
511 | <property name="y_options"></property> | ||
512 | </packing> | ||
513 | </child> | ||
514 | </widget> | ||
515 | <packing> | ||
516 | <property name="position">1</property> | ||
517 | </packing> | ||
518 | </child> | ||
519 | <child internal-child="action_area"> | ||
520 | <widget class="GtkHButtonBox" id="dialog-action_area2"> | ||
521 | <property name="visible">True</property> | ||
522 | <property name="layout_style">GTK_BUTTONBOX_END</property> | ||
523 | <child> | ||
524 | <widget class="GtkButton" id="button4"> | ||
525 | <property name="visible">True</property> | ||
526 | <property name="can_focus">True</property> | ||
527 | <property name="receives_default">True</property> | ||
528 | <property name="label" translatable="yes">gtk-close</property> | ||
529 | <property name="use_stock">True</property> | ||
530 | <property name="response_id">0</property> | ||
531 | </widget> | ||
532 | </child> | ||
533 | </widget> | ||
534 | <packing> | ||
535 | <property name="expand">False</property> | ||
536 | <property name="pack_type">GTK_PACK_END</property> | ||
537 | </packing> | ||
538 | </child> | ||
539 | </widget> | ||
540 | </child> | ||
541 | </widget> | ||
542 | <widget class="GtkWindow" id="main_window"> | ||
543 | <child> | ||
544 | <widget class="GtkVBox" id="main_window_vbox"> | ||
545 | <property name="visible">True</property> | ||
546 | <child> | ||
547 | <widget class="GtkToolbar" id="main_toolbar"> | ||
548 | <property name="visible">True</property> | ||
549 | <child> | ||
550 | <widget class="GtkToolButton" id="main_toolbutton_build"> | ||
551 | <property name="visible">True</property> | ||
552 | <property name="label" translatable="yes">Build</property> | ||
553 | <property name="stock_id">gtk-execute</property> | ||
554 | </widget> | ||
555 | <packing> | ||
556 | <property name="expand">False</property> | ||
557 | </packing> | ||
558 | </child> | ||
559 | </widget> | ||
560 | <packing> | ||
561 | <property name="expand">False</property> | ||
562 | </packing> | ||
563 | </child> | ||
564 | <child> | ||
565 | <widget class="GtkVPaned" id="vpaned1"> | ||
566 | <property name="visible">True</property> | ||
567 | <property name="can_focus">True</property> | ||
568 | <child> | ||
569 | <widget class="GtkScrolledWindow" id="results_scrolledwindow"> | ||
570 | <property name="visible">True</property> | ||
571 | <property name="can_focus">True</property> | ||
572 | <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
573 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
574 | <child> | ||
575 | <placeholder/> | ||
576 | </child> | ||
577 | </widget> | ||
578 | <packing> | ||
579 | <property name="resize">False</property> | ||
580 | <property name="shrink">True</property> | ||
581 | </packing> | ||
582 | </child> | ||
583 | <child> | ||
584 | <widget class="GtkScrolledWindow" id="progress_scrolledwindow"> | ||
585 | <property name="visible">True</property> | ||
586 | <property name="can_focus">True</property> | ||
587 | <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
588 | <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> | ||
589 | <child> | ||
590 | <placeholder/> | ||
591 | </child> | ||
592 | </widget> | ||
593 | <packing> | ||
594 | <property name="resize">True</property> | ||
595 | <property name="shrink">True</property> | ||
596 | </packing> | ||
597 | </child> | ||
598 | </widget> | ||
599 | <packing> | ||
600 | <property name="position">1</property> | ||
601 | </packing> | ||
602 | </child> | ||
603 | </widget> | ||
604 | </child> | ||
605 | </widget> | ||
606 | </glade-interface> | ||
diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py new file mode 100644 index 0000000000..401559255b --- /dev/null +++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py | |||
@@ -0,0 +1,180 @@ | |||
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 | |||
21 | import gtk | ||
22 | import gobject | ||
23 | |||
24 | class RunningBuildModel (gtk.TreeStore): | ||
25 | (COL_TYPE, COL_PACKAGE, COL_TASK, COL_MESSAGE, COL_ICON, COL_ACTIVE) = (0, 1, 2, 3, 4, 5) | ||
26 | def __init__ (self): | ||
27 | gtk.TreeStore.__init__ (self, | ||
28 | gobject.TYPE_STRING, | ||
29 | gobject.TYPE_STRING, | ||
30 | gobject.TYPE_STRING, | ||
31 | gobject.TYPE_STRING, | ||
32 | gobject.TYPE_STRING, | ||
33 | gobject.TYPE_BOOLEAN) | ||
34 | |||
35 | class RunningBuild (gobject.GObject): | ||
36 | __gsignals__ = { | ||
37 | 'build-succeeded' : (gobject.SIGNAL_RUN_LAST, | ||
38 | gobject.TYPE_NONE, | ||
39 | ()), | ||
40 | 'build-failed' : (gobject.SIGNAL_RUN_LAST, | ||
41 | gobject.TYPE_NONE, | ||
42 | ()) | ||
43 | } | ||
44 | pids_to_task = {} | ||
45 | tasks_to_iter = {} | ||
46 | |||
47 | def __init__ (self): | ||
48 | gobject.GObject.__init__ (self) | ||
49 | self.model = RunningBuildModel() | ||
50 | |||
51 | def handle_event (self, event): | ||
52 | # Handle an event from the event queue, this may result in updating | ||
53 | # the model and thus the UI. Or it may be to tell us that the build | ||
54 | # has finished successfully (or not, as the case may be.) | ||
55 | |||
56 | parent = None | ||
57 | pid = 0 | ||
58 | package = None | ||
59 | task = None | ||
60 | |||
61 | # If we have a pid attached to this message/event try and get the | ||
62 | # (package, task) pair for it. If we get that then get the parent iter | ||
63 | # for the message. | ||
64 | if hassattr(event, 'pid'): | ||
65 | pid = event.pid | ||
66 | if self.pids_to_task.has_key(pid): | ||
67 | (package, task) = self.pids_to_task[pid] | ||
68 | parent = self.tasks_to_iter[(package, task)] | ||
69 | |||
70 | if isinstance(event, bb.msg.Msg): | ||
71 | # Set a pretty icon for the message based on it's type. | ||
72 | if isinstance(event, bb.msg.MsgWarn): | ||
73 | icon = "dialog-warning" | ||
74 | elif isinstance(event, bb.msg.MsgErr): | ||
75 | icon = "dialog-error" | ||
76 | else: | ||
77 | icon = None | ||
78 | |||
79 | # Ignore the "Running task i of n .." messages | ||
80 | if (event._message.startswith ("Running task")): | ||
81 | return | ||
82 | |||
83 | # Add the message to the tree either at the top level if parent is | ||
84 | # None otherwise as a descendent of a task. | ||
85 | self.model.append (parent, | ||
86 | (event.__name__.split()[-1], # e.g. MsgWarn, MsgError | ||
87 | package, | ||
88 | task, | ||
89 | event._message, | ||
90 | icon, | ||
91 | False)) | ||
92 | elif isinstance(event, bb.build.TaskStarted): | ||
93 | (package, task) = (event._package, event._task) | ||
94 | |||
95 | # Save out this PID. | ||
96 | self.pids_to_task[pid] = (package,task) | ||
97 | |||
98 | # Check if we already have this package in our model. If so then | ||
99 | # that can be the parent for the task. Otherwise we create a new | ||
100 | # top level for the package. | ||
101 | if (self.tasks_to_iter.has_key ((package, None))): | ||
102 | parent = self.tasks_to_iter[(package, None)] | ||
103 | else: | ||
104 | parent = self.model.append (None, (None, | ||
105 | package, | ||
106 | None, | ||
107 | "Package: %s" % (package), | ||
108 | None, | ||
109 | False)) | ||
110 | self.tasks_to_iter[(package, None)] = parent | ||
111 | |||
112 | # Because this parent package now has an active child mark it as | ||
113 | # such. | ||
114 | self.model.set(parent, self.model.COL_ICON, "gtk-execute") | ||
115 | |||
116 | # Add an entry in the model for this task | ||
117 | i = self.model.append (parent, (None, | ||
118 | package, | ||
119 | task, | ||
120 | "Task: %s" % (task), | ||
121 | None, | ||
122 | False)) | ||
123 | |||
124 | # Save out the iter so that we can find it when we have a message | ||
125 | # that we need to attach to a task. | ||
126 | self.tasks_to_iter[(package, task)] = i | ||
127 | |||
128 | # Mark this task as active. | ||
129 | self.model.set(i, self.model.COL_ICON, "gtk-execute") | ||
130 | |||
131 | elif isinstance(event, bb.build.Task): | ||
132 | |||
133 | if isinstance(event, bb.build.TaskFailed): | ||
134 | # Mark the task as failed | ||
135 | i = self.tasks_to_iter[(package, task)] | ||
136 | self.model.set(i, self.model.COL_ICON, "dialog-error") | ||
137 | |||
138 | # Mark the parent package as failed | ||
139 | i = self.tasks_to_iter[(package, None)] | ||
140 | self.model.set(i, self.model.COL_ICON, "dialog-error") | ||
141 | else: | ||
142 | # Mark the task as inactive | ||
143 | i = self.tasks_to_iter[(package, task)] | ||
144 | self.model.set(i, self.model.COL_ICON, None) | ||
145 | |||
146 | # Mark the parent package as inactive | ||
147 | i = self.tasks_to_iter[(package, None)] | ||
148 | self.model.set(i, self.model.COL_ICON, None) | ||
149 | |||
150 | |||
151 | # Clear the iters and the pids since when the task goes away the | ||
152 | # pid will no longer be used for messages | ||
153 | del self.tasks_to_iter[(package, task)] | ||
154 | del self.pids_to_task[pid] | ||
155 | |||
156 | elif isinstance(event, bb.event.BuildCompleted): | ||
157 | failures = int (event._failures) | ||
158 | |||
159 | # Emit the appropriate signal depending on the number of failures | ||
160 | if (failures > 1): | ||
161 | self.emit ("build-failed") | ||
162 | else: | ||
163 | self.emit ("build-succeeded") | ||
164 | |||
165 | class RunningBuildTreeView (gtk.TreeView): | ||
166 | def __init__ (self): | ||
167 | gtk.TreeView.__init__ (self) | ||
168 | |||
169 | # The icon that indicates whether we're building or failed. | ||
170 | renderer = gtk.CellRendererPixbuf () | ||
171 | col = gtk.TreeViewColumn ("Status", renderer) | ||
172 | col.add_attribute (renderer, "icon-name", 4) | ||
173 | self.append_column (col) | ||
174 | |||
175 | # The message of the build. | ||
176 | renderer = gtk.CellRendererText () | ||
177 | col = gtk.TreeViewColumn ("Message", renderer, text=3) | ||
178 | self.append_column (col) | ||
179 | |||
180 | |||