lib/bb/ui/crumbs: Add HobAltButton and use it

This adds a gtk.Button subclass for secondary actions which unsets the
relief so that the user is aware that the button is clickable and yet it is
more subtle than the primary action (such that the primary action is the
most obvious one) - this is per the interaction design.

Further we replace all uses of gtk.LinkButton with the new HobAltButton

Partially addresses [YOCTO #2105], a follow on patch will theme the button
so that it matches the visual design.

(From Poky rev: c3f17fed243180678264168968333463b203bfa0)

(Bitbake rev: 601521c2d7f5568d94529a77b2cbe19fef7cbf48)

Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Lock 2012-03-21 18:42:35 -07:00 committed by Richard Purdie
parent 457ec75e39
commit 21970f4755
7 changed files with 28 additions and 22 deletions

View File

@ -22,7 +22,7 @@
import gtk
from bb.ui.crumbs.progressbar import HobProgressBar
from bb.ui.crumbs.hobwidget import hic, HobNotebook
from bb.ui.crumbs.hobwidget import hic, HobNotebook, HobAltButton
from bb.ui.crumbs.runningbuild import RunningBuildTreeView
from bb.ui.crumbs.runningbuild import BuildConfigurationTreeView
from bb.ui.crumbs.runningbuild import BuildFailureTreeView
@ -49,7 +49,7 @@ class BuildDetailsPage (HobPage):
self.progress_box = gtk.HBox(False, 6)
self.progress_bar = HobProgressBar()
self.progress_box.pack_start(self.progress_bar, expand=True, fill=True)
self.stop_button = gtk.LinkButton("Stop the build process", "Stop")
self.stop_button = HobAltButton("Stop")
self.stop_button.connect("clicked", self.stop_button_clicked_cb)
self.progress_box.pack_end(self.stop_button, expand=False, fill=False)
@ -78,7 +78,7 @@ class BuildDetailsPage (HobPage):
self.notebook.append_page(self.scrolled_view_build, gtk.Label("Log"))
self.button_box = gtk.HBox(False, 6)
self.back_button = gtk.LinkButton("Go back to Image Configuration screen", "<< Back to image configuration")
self.back_button = HobAltButton("Back to image configuration")
self.back_button.connect("clicked", self.back_button_clicked_cb)
self.button_box.pack_start(self.back_button, expand=False, fill=False)

View File

@ -28,7 +28,7 @@ import re
import subprocess
import shlex
from bb.ui.crumbs.hobcolor import HobColors
from bb.ui.crumbs.hobwidget import hcc, hic, HobViewTable, HobInfoButton
from bb.ui.crumbs.hobwidget import hcc, hic, HobViewTable, HobInfoButton, HobAltButton
from bb.ui.crumbs.progressbar import HobProgressBar
"""

View File

@ -171,11 +171,18 @@ class HobViewTable (gtk.VBox):
if not view_column.get_title() in self.toggle_columns:
self.emit("row-activated", tree.get_model(), path)
class HobAltButton(gtk.Button):
"""
A gtk.Button subclass which has no relief, and so is more discrete
"""
def __init__(self, label=None):
gtk.Button.__init__(self, label)
self.set_relief(gtk.RELIEF_NONE)
class HobXpmLabelButtonBox(gtk.EventBox):
""" label: name of buttonbox
description: the simple description
"""
def __init__(self, display_file="", hover_file="", label="", description=""):
gtk.EventBox.__init__(self)
self._base_state_flags = gtk.STATE_NORMAL

View File

@ -24,7 +24,7 @@ import gtk
import glib
from bb.ui.crumbs.progressbar import HobProgressBar
from bb.ui.crumbs.hobcolor import HobColors
from bb.ui.crumbs.hobwidget import hic, HobXpmLabelButtonBox, HobInfoButton
from bb.ui.crumbs.hobwidget import hic, HobXpmLabelButtonBox, HobInfoButton, HobAltButton
from bb.ui.crumbs.hoblistmodel import RecipeListModel
from bb.ui.crumbs.hobpages import HobPage
@ -153,7 +153,7 @@ class ImageConfigurationPage (HobPage):
self.progress_box = gtk.HBox(False, 6)
self.progress_bar = HobProgressBar()
self.progress_box.pack_start(self.progress_bar, expand=True, fill=True)
self.stop_button = gtk.LinkButton("Stop the parsing process", "Stop")
self.stop_button = HobAltButton("Stop")
self.stop_button.connect("clicked", self.stop_button_clicked_cb)
self.progress_box.pack_end(self.stop_button, expand=False, fill=False)
@ -241,8 +241,7 @@ class ImageConfigurationPage (HobPage):
button_box.pack_end(label, expand=False, fill=False)
# create button "Build Packages"
build_packages_button = gtk.LinkButton("Build packages first based on recipe selection "
"for late customization on packages for the target image", "Build Packages")
build_packages_button = HobAltButton("Build Packages")
build_packages_button.connect("clicked", self.build_packages_button_clicked_cb)
button_box.pack_end(build_packages_button, expand=False, fill=False)
@ -344,14 +343,14 @@ class ImageConfigurationPage (HobPage):
self.image_combo.set_active(-1)
self.image_combo.set_active(active)
def layer_button_clicked_cb(self, event, data):
def layer_button_clicked_cb(self, button):
# Create a layer selection dialog
self.builder.show_layer_selection_dialog()
def view_recipes_button_clicked_cb(self, event, data):
def view_recipes_button_clicked_cb(self, button):
self.builder.show_recipes()
def view_packages_button_clicked_cb(self, event, data):
def view_packages_button_clicked_cb(self, button):
self.builder.show_packages()
def just_bake_button_clicked_cb(self, button):

View File

@ -23,7 +23,7 @@
import gobject
import gtk
from bb.ui.crumbs.hobcolor import HobColors
from bb.ui.crumbs.hobwidget import hic, HobViewTable
from bb.ui.crumbs.hobwidget import hic, HobViewTable, HobAltButton
from bb.ui.crumbs.hobpages import HobPage
#
@ -213,7 +213,7 @@ class ImageDetailsPage (HobPage):
vallist.append(layer)
i += 1
edit_config_button = gtk.LinkButton("Changes settings for build", "Edit configuration")
edit_config_button = HobAltButton("Edit configuration")
edit_config_button.connect("clicked", self.edit_config_button_clicked_cb)
setting_detail = self.DetailBox(varlist=varlist, vallist=vallist, button=edit_config_button)
self.box_group_area.pack_start(setting_detail, expand=False, fill=False)
@ -224,7 +224,7 @@ class ImageDetailsPage (HobPage):
vallist.append(pkg_num)
vallist.append(image_size)
if build_succeeded:
edit_packages_button = gtk.LinkButton("Change package selection for customization", "Edit packages")
edit_packages_button = HobAltButton("Edit packages")
edit_packages_button.connect("clicked", self.edit_packages_button_clicked_cb)
else: # get to this page from "My images"
edit_packages_button = None
@ -288,7 +288,7 @@ class ImageDetailsPage (HobPage):
bottom_buttons.pack_end(label, expand=False, fill=False)
# create button "Run image"
run_button = gtk.LinkButton("Launch and boot the image in the QEMU emulator", "Run image")
run_button = HobAltButton("Run image")
run_button.connect("clicked", self.run_button_clicked_cb)
bottom_buttons.pack_end(run_button, expand=False, fill=False)
created = True
@ -301,7 +301,7 @@ class ImageDetailsPage (HobPage):
bottom_buttons.pack_end(label, expand=False, fill=False)
# create button "Save as template"
save_button = gtk.LinkButton("Save the hob build template for future use", "Save as template")
save_button = HobAltButton("Save as template")
save_button.connect("clicked", self.save_button_clicked_cb)
bottom_buttons.pack_end(save_button, expand=False, fill=False)
create = True
@ -309,7 +309,7 @@ class ImageDetailsPage (HobPage):
name = "Build new image"
if name in buttonlist:
# create button "Build new image"
build_new_button = gtk.LinkButton("Initiate another new build from the beginning", "Build new image")
build_new_button = HobAltButton("Build new image")
build_new_button.connect("clicked", self.build_new_button_clicked_cb)
bottom_buttons.pack_start(build_new_button, expand=False, fill=False)

View File

@ -23,7 +23,7 @@
import gtk
import glib
from bb.ui.crumbs.hobcolor import HobColors
from bb.ui.crumbs.hobwidget import HobViewTable, HobNotebook
from bb.ui.crumbs.hobwidget import HobViewTable, HobNotebook, HobAltButton
from bb.ui.crumbs.hoblistmodel import PackageListModel
from bb.ui.crumbs.hobpages import HobPage
@ -144,7 +144,7 @@ class PackageSelectionPage (HobPage):
self.build_image_button.connect("clicked", self.build_image_clicked_cb)
button_box.pack_end(self.build_image_button, expand=False, fill=False)
self.back_button = gtk.LinkButton("Go back to Image Configuration screen", "<< Back to image configuration")
self.back_button = HobAltButton("Back to image configuration")
self.back_button.connect("clicked", self.back_button_clicked_cb)
button_box.pack_start(self.back_button, expand=False, fill=False)

View File

@ -23,7 +23,7 @@
import gtk
import glib
from bb.ui.crumbs.hobcolor import HobColors
from bb.ui.crumbs.hobwidget import HobViewTable, HobNotebook
from bb.ui.crumbs.hobwidget import HobViewTable, HobNotebook, HobAltButton
from bb.ui.crumbs.hoblistmodel import RecipeListModel
from bb.ui.crumbs.hobpages import HobPage
@ -166,7 +166,7 @@ class RecipeSelectionPage (HobPage):
self.build_packages_button.connect("clicked", self.build_packages_clicked_cb)
button_box.pack_end(self.build_packages_button, expand=False, fill=False)
self.back_button = gtk.LinkButton("Go back to Image Configuration screen", "<< Back to image configuration")
self.back_button = HobAltButton("Back to image configuration")
self.back_button.connect("clicked", self.back_button_clicked_cb)
button_box.pack_start(self.back_button, expand=False, fill=False)