summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/hobwidget.py
diff options
context:
space:
mode:
authorIoana Grigoropol <ioanax.grigoropol@intel.com>2012-09-03 12:51:06 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-07 12:10:42 +0100
commit40d55d37b6dadf05c116edcf0686e087a8ebe3b6 (patch)
treef10882eeb4bf3602dc08638b7a5889598c8163d8 /bitbake/lib/bb/ui/crumbs/hobwidget.py
parent7d8b49cfe478e82ca0a06095a5b3699c50b34080 (diff)
downloadpoky-40d55d37b6dadf05c116edcf0686e087a8ebe3b6.tar.gz
bitbake: hobwidget: Button theme is taken from host, fix
- All buttons in the interface inherit a BaseHobButton that use the gtk settings for buttons from the host; - Removed 'or' label between actions on image details page [Yocto #3011] (Bitbake rev: 1a8356b57f906cf575612eb52fc8d3a9824ff9a7) Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@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.py36
1 files changed, 19 insertions, 17 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 7c23440630..3ab30a6fce 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -214,7 +214,7 @@ def soften_color(widget, state=gtk.STATE_NORMAL):
214 color.blue = color.blue * blend + style.base[state].blue * (1.0 - blend) 214 color.blue = color.blue * blend + style.base[state].blue * (1.0 - blend)
215 return color.to_string() 215 return color.to_string()
216 216
217class HobButton(gtk.Button): 217class BaseHobButton(gtk.Button):
218 """ 218 """
219 A gtk.Button subclass which follows the visual design of Hob for primary 219 A gtk.Button subclass which follows the visual design of Hob for primary
220 action buttons 220 action buttons
@@ -228,24 +228,33 @@ class HobButton(gtk.Button):
228 @staticmethod 228 @staticmethod
229 def style_button(button): 229 def style_button(button):
230 style = button.get_style() 230 style = button.get_style()
231 button_color = gtk.gdk.Color(HobColors.ORANGE) 231 style = gtk.rc_get_style_by_paths(gtk.settings_get_default(), 'gtk-button', 'gtk-button', gobject.TYPE_NONE)
232 button.modify_bg(gtk.STATE_NORMAL, button_color)
233 button.modify_bg(gtk.STATE_PRELIGHT, button_color)
234 button.modify_bg(gtk.STATE_SELECTED, button_color)
235 232
236 button.set_flags(gtk.CAN_DEFAULT) 233 button.set_flags(gtk.CAN_DEFAULT)
237 button.grab_default() 234 button.grab_default()
238 235
239 label = "<span size='x-large'><b>%s</b></span>" % gobject.markup_escape_text(button.get_label()) 236# label = "<span size='x-large'><b>%s</b></span>" % gobject.markup_escape_text(button.get_label())
237 label = button.get_label()
240 button.set_label(label) 238 button.set_label(label)
241 button.child.set_use_markup(True) 239 button.child.set_use_markup(True)
242 240
243class HobAltButton(gtk.Button): 241class HobButton(BaseHobButton):
242 """
243 A gtk.Button subclass which follows the visual design of Hob for primary
244 action buttons
245
246 label: the text to display as the button's label
247 """
248 def __init__(self, label):
249 BaseHobButton.__init__(self, label)
250 HobButton.style_button(self)
251
252class HobAltButton(BaseHobButton):
244 """ 253 """
245 A gtk.Button subclass which has no relief, and so is more discrete 254 A gtk.Button subclass which has no relief, and so is more discrete
246 """ 255 """
247 def __init__(self, label): 256 def __init__(self, label):
248 gtk.Button.__init__(self, label) 257 BaseHobButton.__init__(self, label)
249 HobAltButton.style_button(self) 258 HobAltButton.style_button(self)
250 259
251 """ 260 """
@@ -271,14 +280,6 @@ class HobAltButton(gtk.Button):
271 button.set_label("<span size='large' color='%s'><b>%s</b></span>" % (colour, gobject.markup_escape_text(button.text))) 280 button.set_label("<span size='large' color='%s'><b>%s</b></span>" % (colour, gobject.markup_escape_text(button.text)))
272 button.child.set_use_markup(True) 281 button.child.set_use_markup(True)
273 282
274 @staticmethod
275 def style_button(button):
276 button.text = button.get_label()
277 button.connect("state-changed", HobAltButton.desensitise_on_state_change_cb)
278 HobAltButton.set_text(button)
279 button.child.set_use_markup(True)
280 button.set_relief(gtk.RELIEF_NONE)
281
282class HobImageButton(gtk.Button): 283class HobImageButton(gtk.Button):
283 """ 284 """
284 A gtk.Button with an icon and two rows of text, the second of which is 285 A gtk.Button with an icon and two rows of text, the second of which is
@@ -331,7 +332,8 @@ class HobInfoButton(gtk.EventBox):
331 def __init__(self, tip_markup, parent=None): 332 def __init__(self, tip_markup, parent=None):
332 gtk.EventBox.__init__(self) 333 gtk.EventBox.__init__(self)
333 self.image = gtk.Image() 334 self.image = gtk.Image()
334 self.image.set_from_file(hic.ICON_INFO_DISPLAY_FILE) 335 self.image.set_from_file(
336 hic.ICON_INFO_DISPLAY_FILE)
335 self.image.show() 337 self.image.show()
336 self.add(self.image) 338 self.add(self.image)
337 339