From 656f9a07588cc00704825a78de9649ca4a1552b8 Mon Sep 17 00:00:00 2001 From: Dongxiao Xu Date: Mon, 28 Nov 2011 14:32:40 +0800 Subject: Hob: A new implemetation (v2) This commit implements a new design for hob Some of the new features: - Friendly new designed GUI. Quick response to user actions. - Two step builds support package generation and image generation. - Support running GUI seprarately from bitbake server. - Recipe/package selection and deselection. - Accurate customization for image contents and size. - Progress bars showing the parsing and build status. - Load/save user configurations from/into templates. (Bitbake rev: 4dacd29f9c957d20f4583330b51e5420f9c3338d) Signed-off-by: Dongxiao Xu Signed-off-by: Shane Wang Signed-off-by: Liming An Signed-off-by: Fengxia Hua Designed-by: Belen Barros Pena Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/crumbs/hobpages.py | 87 ++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 bitbake/lib/bb/ui/crumbs/hobpages.py (limited to 'bitbake/lib/bb/ui/crumbs/hobpages.py') diff --git a/bitbake/lib/bb/ui/crumbs/hobpages.py b/bitbake/lib/bb/ui/crumbs/hobpages.py new file mode 100755 index 0000000000..be76d0db27 --- /dev/null +++ b/bitbake/lib/bb/ui/crumbs/hobpages.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# +# BitBake Graphical GTK User Interface +# +# Copyright (C) 2012 Intel Corporation +# +# Authored by Dongxiao Xu +# Authored by Shane Wang +# +# 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.hobcolor import HobColors +from bb.ui.crumbs.hobwidget import hwc + +# +# HobPage: the super class for all Hob-related pages +# +class HobPage (gtk.VBox): + + def __init__(self, builder, title = None): + super(HobPage, self).__init__(False, 0) + self.builder = builder + self.builder_width, self.builder_height = self.builder.size_request() + + if title == None: + self.title = "HOB -- Image Creator" + else: + self.title = title + + self.box_group_area = gtk.VBox(False, 15) + self.box_group_area.set_size_request(self.builder_width - 73 - 73, self.builder_height - 88 - 15 - 15) + self.group_align = gtk.Alignment(xalign = 0, yalign=0.5, xscale=1, yscale=1) + self.group_align.set_padding(15, 15, 73, 73) + self.group_align.add(self.box_group_area) + self.box_group_area.set_homogeneous(False) + + + def add_onto_top_bar(self, widget = None, padding = 0): + # the top button occupies 1/7 of the page height + # setup an event box + eventbox = gtk.EventBox() + style = eventbox.get_style().copy() + style.bg[gtk.STATE_NORMAL] = eventbox.get_colormap().alloc_color(HobColors.LIGHT_GRAY, False, False) + eventbox.set_style(style) + eventbox.set_size_request(-1, 88) + + hbox = gtk.HBox() + + label = gtk.Label() + label.set_markup("%s" % self.title) + hbox.pack_start(label, expand=False, fill=False, padding=20) + + if widget != None: + # add the widget in the event box + hbox.pack_end(widget, expand=False, fill=False, padding=padding) + eventbox.add(hbox) + + return eventbox + + def span_tag(self, px="12px", weight="normal", forground="#1c1c1c"): + span_tag = "weight=\'%s\' foreground=\'%s\' font_desc=\'%s\'" % (weight, forground, px) + return span_tag + + def append_toolbar_button(self, toolbar, buttonname, icon_disp, icon_hovor, tip, cb): + # Create a button and append it on the toolbar according to button name + icon = gtk.Image() + icon_display = icon_disp + icon_hover = icon_hovor + pix_buffer = gtk.gdk.pixbuf_new_from_file(icon_display) + icon.set_from_pixbuf(pix_buffer) + tip_text = tip + button = toolbar.append_element(gtk.TOOLBAR_CHILD_RADIOBUTTON, None, + buttonname, tip_text, "Private text", icon, + cb, None) + return toolbar, button -- cgit v1.2.3-54-g00ecf