2011-11-28 06:32:40 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#
|
|
|
|
# BitBake Graphical GTK User Interface
|
|
|
|
#
|
|
|
|
# Copyright (C) 2012 Intel Corporation
|
|
|
|
#
|
|
|
|
# Authored by Dongxiao Xu <dongxiao.xu@intel.com>
|
|
|
|
# Authored by Shane Wang <shane.wang@intel.com>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License version 2 as
|
|
|
|
# published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
|
|
|
import gtk
|
|
|
|
from bb.ui.crumbs.progressbar import HobProgressBar
|
2012-03-22 01:42:35 +00:00
|
|
|
from bb.ui.crumbs.hobwidget import hic, HobNotebook, HobAltButton
|
2011-11-28 06:32:40 +00:00
|
|
|
from bb.ui.crumbs.runningbuild import RunningBuildTreeView
|
2012-03-12 12:47:06 +00:00
|
|
|
from bb.ui.crumbs.runningbuild import BuildConfigurationTreeView
|
|
|
|
from bb.ui.crumbs.runningbuild import BuildFailureTreeView
|
2011-11-28 06:32:40 +00:00
|
|
|
from bb.ui.crumbs.hobpages import HobPage
|
|
|
|
|
|
|
|
#
|
|
|
|
# BuildDetailsPage
|
|
|
|
#
|
|
|
|
|
|
|
|
class BuildDetailsPage (HobPage):
|
|
|
|
|
|
|
|
def __init__(self, builder):
|
|
|
|
super(BuildDetailsPage, self).__init__(builder, "Building ...")
|
|
|
|
|
2012-03-12 12:55:44 +00:00
|
|
|
self.num_of_issues = 0
|
2012-03-22 11:08:40 +00:00
|
|
|
self.endpath = (0,)
|
2011-11-28 06:32:40 +00:00
|
|
|
# create visual elements
|
|
|
|
self.create_visual_elements()
|
|
|
|
|
|
|
|
def create_visual_elements(self):
|
|
|
|
# create visual elements
|
2012-03-15 06:56:45 +00:00
|
|
|
self.vbox = gtk.VBox(False, 12)
|
2011-11-28 06:32:40 +00:00
|
|
|
|
2012-03-15 06:56:45 +00:00
|
|
|
self.progress_box = gtk.HBox(False, 6)
|
2011-11-28 06:32:40 +00:00
|
|
|
self.progress_bar = HobProgressBar()
|
|
|
|
self.progress_box.pack_start(self.progress_bar, expand=True, fill=True)
|
2012-03-22 01:42:35 +00:00
|
|
|
self.stop_button = HobAltButton("Stop")
|
2011-11-28 06:32:40 +00:00
|
|
|
self.stop_button.connect("clicked", self.stop_button_clicked_cb)
|
|
|
|
self.progress_box.pack_end(self.stop_button, expand=False, fill=False)
|
|
|
|
|
2012-03-12 12:47:06 +00:00
|
|
|
self.notebook = HobNotebook()
|
|
|
|
self.config_tv = BuildConfigurationTreeView()
|
|
|
|
self.config_model = self.builder.handler.build.model.config_model()
|
|
|
|
self.config_tv.set_model(self.config_model)
|
|
|
|
self.scrolled_view_config = gtk.ScrolledWindow ()
|
2012-03-22 11:03:35 +00:00
|
|
|
self.scrolled_view_config.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
|
2012-03-12 12:47:06 +00:00
|
|
|
self.scrolled_view_config.add(self.config_tv)
|
|
|
|
self.notebook.append_page(self.scrolled_view_config, gtk.Label("Build Configuration"))
|
|
|
|
|
|
|
|
self.failure_tv = BuildFailureTreeView()
|
|
|
|
self.failure_model = self.builder.handler.build.model.failure_model()
|
|
|
|
self.failure_tv.set_model(self.failure_model)
|
|
|
|
self.scrolled_view_failure = gtk.ScrolledWindow ()
|
2012-03-22 11:03:35 +00:00
|
|
|
self.scrolled_view_failure.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
|
2012-03-12 12:47:06 +00:00
|
|
|
self.scrolled_view_failure.add(self.failure_tv)
|
|
|
|
self.notebook.append_page(self.scrolled_view_failure, gtk.Label("Issues"))
|
|
|
|
|
2011-11-28 06:32:40 +00:00
|
|
|
self.build_tv = RunningBuildTreeView(readonly=True)
|
|
|
|
self.build_tv.set_model(self.builder.handler.build.model)
|
2012-03-12 12:47:06 +00:00
|
|
|
self.scrolled_view_build = gtk.ScrolledWindow ()
|
2012-03-22 11:03:35 +00:00
|
|
|
self.scrolled_view_build.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
|
2012-03-12 12:47:06 +00:00
|
|
|
self.scrolled_view_build.add(self.build_tv)
|
|
|
|
self.notebook.append_page(self.scrolled_view_build, gtk.Label("Log"))
|
2011-11-28 06:32:40 +00:00
|
|
|
|
2012-03-22 11:08:40 +00:00
|
|
|
self.builder.handler.build.model.connect_after("row-changed", self.scroll_to_present_row, self.scrolled_view_build.get_vadjustment(), self.build_tv)
|
|
|
|
|
2012-03-15 06:56:45 +00:00
|
|
|
self.button_box = gtk.HBox(False, 6)
|
2012-03-22 01:42:35 +00:00
|
|
|
self.back_button = HobAltButton("Back to image configuration")
|
2011-11-28 06:32:40 +00:00
|
|
|
self.back_button.connect("clicked", self.back_button_clicked_cb)
|
|
|
|
self.button_box.pack_start(self.back_button, expand=False, fill=False)
|
|
|
|
|
2012-03-12 12:55:44 +00:00
|
|
|
def show_issues(self):
|
|
|
|
self.num_of_issues += 1
|
|
|
|
self.notebook.show_indicator_icon("Issues", self.num_of_issues)
|
|
|
|
|
|
|
|
def reset_issues(self):
|
|
|
|
self.num_of_issues = 0
|
|
|
|
self.notebook.hide_indicator_icon("Issues")
|
|
|
|
|
2011-11-28 06:32:40 +00:00
|
|
|
def _remove_all_widget(self):
|
|
|
|
children = self.vbox.get_children() or []
|
|
|
|
for child in children:
|
|
|
|
self.vbox.remove(child)
|
|
|
|
children = self.box_group_area.get_children() or []
|
|
|
|
for child in children:
|
|
|
|
self.box_group_area.remove(child)
|
|
|
|
children = self.get_children() or []
|
|
|
|
for child in children:
|
|
|
|
self.remove(child)
|
|
|
|
|
|
|
|
def show_page(self, step):
|
|
|
|
self._remove_all_widget()
|
|
|
|
if step == self.builder.PACKAGE_GENERATING or step == self.builder.FAST_IMAGE_GENERATING:
|
|
|
|
self.title = "Building packages ..."
|
|
|
|
else:
|
|
|
|
self.title = "Building image ..."
|
|
|
|
self.build_details_top = self.add_onto_top_bar(None)
|
|
|
|
self.pack_start(self.build_details_top, expand=False, fill=False)
|
|
|
|
self.pack_start(self.group_align, expand=True, fill=True)
|
|
|
|
|
|
|
|
self.box_group_area.pack_start(self.vbox, expand=True, fill=True)
|
|
|
|
|
|
|
|
self.progress_bar.reset()
|
|
|
|
self.vbox.pack_start(self.progress_box, expand=False, fill=False)
|
|
|
|
|
2012-03-12 12:47:06 +00:00
|
|
|
self.vbox.pack_start(self.notebook, expand=True, fill=True)
|
2011-11-28 06:32:40 +00:00
|
|
|
|
|
|
|
self.box_group_area.pack_end(self.button_box, expand=False, fill=False)
|
|
|
|
self.show_all()
|
|
|
|
self.back_button.hide()
|
|
|
|
|
|
|
|
def update_progress_bar(self, title, fraction, status=True):
|
|
|
|
self.progress_bar.update(fraction)
|
|
|
|
self.progress_bar.set_title(title)
|
|
|
|
self.progress_bar.set_rcstyle(status)
|
|
|
|
|
|
|
|
def back_button_clicked_cb(self, button):
|
|
|
|
self.builder.show_configuration()
|
|
|
|
|
|
|
|
def show_back_button(self):
|
|
|
|
self.back_button.show()
|
|
|
|
|
|
|
|
def stop_button_clicked_cb(self, button):
|
|
|
|
self.builder.stop_build()
|
|
|
|
|
|
|
|
def hide_stop_button(self):
|
|
|
|
self.stop_button.hide()
|
2012-03-22 11:08:40 +00:00
|
|
|
|
|
|
|
def scroll_to_present_row(self, model, path, iter, v_adj, treeview):
|
|
|
|
if treeview and v_adj:
|
|
|
|
if path[0] > self.endpath[0]: # check the event is a new row append or not
|
|
|
|
self.endpath = path
|
|
|
|
if v_adj.value == (v_adj.upper - v_adj.page_size): # check the gtk.adjustment position is at end boundary or not
|
|
|
|
treeview.scroll_to_cell(path)
|