diff options
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobwidget.py | 27 |
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 | ||
229 | class HobImageButton(gtk.Button): | 252 | class HobImageButton(gtk.Button): |
230 | """ | 253 | """ |