diff options
author | Joshua Lock <josh@linux.intel.com> | 2012-03-22 16:05:42 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-23 16:10:24 +0000 |
commit | 78fb40958a1b4ea88756f6d966c0ddfd3a543e6e (patch) | |
tree | c7167e94e96e48331657924d57560654f38e833c /bitbake/lib/bb/ui/crumbs/hobwidget.py | |
parent | 9dd7461eca85fbd4521a035c9c2ba6d982bdb089 (diff) | |
download | poky-78fb40958a1b4ea88756f6d966c0ddfd3a543e6e.tar.gz |
lib/bb/ui/crumbs/hobwidget: add HobButton widget for the primary action
The design uses a big, bold labelled, orange button for the primary action
on each dialogue. The HobButton implements this design as a reusable widget.
HobButton makes use of Pango Markup to use a relative size, x-large, for
the button text to ensure it's relative to the system configured font
sizes.
(Bitbake rev: 9aa477f7bd16d3e360bf9b51c1f9d5032a6c5288)
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hobwidget.py')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobwidget.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py index b93e9d4bc1..9d144c906b 100644 --- a/bitbake/lib/bb/ui/crumbs/hobwidget.py +++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py | |||
@@ -196,6 +196,26 @@ def soften_color(widget, state=gtk.STATE_NORMAL): | |||
196 | color.blue = color.blue * blend + style.base[state].blue * (1.0 - blend) | 196 | color.blue = color.blue * blend + style.base[state].blue * (1.0 - blend) |
197 | return color.to_string() | 197 | return color.to_string() |
198 | 198 | ||
199 | class HobButton(gtk.Button): | ||
200 | """ | ||
201 | A gtk.Button subclass which follows the visual design of Hob for primary | ||
202 | action buttons | ||
203 | |||
204 | label: the text to display as the button's label | ||
205 | """ | ||
206 | def __init__(self, label): | ||
207 | gtk.Button.__init__(self, "<span size='x-large'><b>%s</b></span>" % gobject.markup_escape_text(label)) | ||
208 | self.child.set_use_markup(True) | ||
209 | |||
210 | style = self.get_style() | ||
211 | button_color = gtk.gdk.Color(HobColors.ORANGE) | ||
212 | self.modify_bg(gtk.STATE_NORMAL, button_color) | ||
213 | self.modify_bg(gtk.STATE_PRELIGHT, button_color) | ||
214 | self.modify_bg(gtk.STATE_SELECTED, button_color) | ||
215 | |||
216 | self.set_flags(gtk.CAN_DEFAULT) | ||
217 | self.grab_default() | ||
218 | |||
199 | class HobAltButton(gtk.Button): | 219 | class HobAltButton(gtk.Button): |
200 | """ | 220 | """ |
201 | A gtk.Button subclass which has no relief, and so is more discrete | 221 | A gtk.Button subclass which has no relief, and so is more discrete |