summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/hobwidget.py
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2012-03-23 17:23:00 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-25 12:23:33 +0100
commit61006cf51f879e736829691e88c0b6eec36ff47f (patch)
tree7df9bfdb0aa28db943fb10860c22724046e3a02a /bitbake/lib/bb/ui/crumbs/hobwidget.py
parent63defc9bf684ff9d83a23aaeb2596f3b43910e0b (diff)
downloadpoky-61006cf51f879e736829691e88c0b6eec36ff47f.tar.gz
lib/bb/ui/crumbs/hobwidget: HobAltButton different visual when insensitive
Use an alternative, grey, colour when the button is insensitive so that the insensitivity is easily noticed. (Bitbake rev: 53af6a962aa2f6b4d68d59792be9c7f33cf887b4) 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.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 1213b11805..7988975621 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -222,9 +222,32 @@ class HobAltButton(gtk.Button):
222 A gtk.Button subclass which has no relief, and so is more discrete 222 A gtk.Button subclass which has no relief, and so is more discrete
223 """ 223 """
224 def __init__(self, label): 224 def __init__(self, label):
225 gtk.Button.__init__(self, "<span color='%s'><b>%s</b></span>" % (HobColors.PALE_BLUE, gobject.markup_escape_text(label))) 225 gtk.Button.__init__(self)
226 self.child.set_use_markup(True) 226 self.text = label
227 self.set_text()
227 self.set_relief(gtk.RELIEF_NONE) 228 self.set_relief(gtk.RELIEF_NONE)
229 self.connect("state-changed", self.desensitise_on_state_change_cb)
230
231 """
232 A callback for the state-changed event to ensure the text is displayed
233 differently when the widget is not sensitive
234 """
235 def desensitise_on_state_change_cb(self, widget, state):
236 if widget.get_state() == gtk.STATE_INSENSITIVE:
237 self.set_text(False)
238 else:
239 self.set_text(True)
240
241 """
242 Set the button label with an appropriate colour for the current widget state
243 """
244 def set_text(self, sensitive=True):
245 if sensitive:
246 colour = HobColors.PALE_BLUE
247 else:
248 colour = HobColors.LIGHT_GRAY
249 self.set_label("<span color='%s'><b>%s</b></span>" % (colour, gobject.markup_escape_text(self.text)))
250 self.child.set_use_markup(True)
228 251
229class HobImageButton(gtk.Button): 252class HobImageButton(gtk.Button):
230 """ 253 """