Patchwork [bitbake-devel,Yocto,#3011] - Button theme is taken from host

login
register
mail settings
Submitter Ioana Grigoropol
Date Sept. 3, 2012, 9:51 a.m.
Message ID <1346665866-12697-1-git-send-email-ioanax.grigoropol@intel.com>
Download mbox | patch
Permalink /patch/35653/
State New
Headers show

Comments

Ioana Grigoropol - Sept. 3, 2012, 9:51 a.m.
-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

Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@intel.com>
---
 bitbake/lib/bb/ui/crumbs/hobwidget.py        |   36 ++++++++++++++------------
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py |    8 +++---
 2 files changed, 23 insertions(+), 21 deletions(-)
Richard Purdie - Sept. 7, 2012, 11:03 a.m.
On Mon, 2012-09-03 at 12:51 +0300, Ioana Grigoropol wrote:
> -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
> 
> Signed-off-by: Ioana Grigoropol <ioanax.grigoropol@intel.com>
> ---
>  bitbake/lib/bb/ui/crumbs/hobwidget.py        |   36 ++++++++++++++------------
>  bitbake/lib/bb/ui/crumbs/imagedetailspage.py |    8 +++---
>  2 files changed, 23 insertions(+), 21 deletions(-)

I've merged this but in future please put a something indicating the
area the patch touches at the start of the commit summary (like
"hobwidget:" and put the bug number in the body of the commit message.
If you don't, when I apply it, git swallows the [] encased data, just
like [PATCH].

Cheers,

Richard

Patch

diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index d10c56b..3951dc1 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -243,7 +243,7 @@  def soften_color(widget, state=gtk.STATE_NORMAL):
     color.blue = color.blue * blend + style.base[state].blue * (1.0 - blend)
     return color.to_string()
 
-class HobButton(gtk.Button):
+class BaseHobButton(gtk.Button):
     """
     A gtk.Button subclass which follows the visual design of Hob for primary
     action buttons
@@ -257,24 +257,33 @@  class HobButton(gtk.Button):
     @staticmethod
     def style_button(button):
         style = button.get_style()
-        button_color = gtk.gdk.Color(HobColors.ORANGE)
-        button.modify_bg(gtk.STATE_NORMAL, button_color)
-        button.modify_bg(gtk.STATE_PRELIGHT, button_color)
-        button.modify_bg(gtk.STATE_SELECTED, button_color)
+        style = gtk.rc_get_style_by_paths(gtk.settings_get_default(), 'gtk-button', 'gtk-button', gobject.TYPE_NONE)
 
         button.set_flags(gtk.CAN_DEFAULT)
         button.grab_default()
 
-        label = "<span size='x-large'><b>%s</b></span>" % gobject.markup_escape_text(button.get_label())
+#        label = "<span size='x-large'><b>%s</b></span>" % gobject.markup_escape_text(button.get_label())
+        label = button.get_label()
         button.set_label(label)
         button.child.set_use_markup(True)
 
-class HobAltButton(gtk.Button):
+class HobButton(BaseHobButton):
+    """
+    A gtk.Button subclass which follows the visual design of Hob for primary
+    action buttons
+
+    label: the text to display as the button's label
+    """
+    def __init__(self, label):
+        BaseHobButton.__init__(self, label)
+        HobButton.style_button(self)
+
+class HobAltButton(BaseHobButton):
     """
     A gtk.Button subclass which has no relief, and so is more discrete
     """
     def __init__(self, label):
-        gtk.Button.__init__(self, label)
+        BaseHobButton.__init__(self, label)
         HobAltButton.style_button(self)
 
     """
@@ -300,14 +309,6 @@  class HobAltButton(gtk.Button):
         button.set_label("<span size='large' color='%s'><b>%s</b></span>" % (colour, gobject.markup_escape_text(button.text)))
         button.child.set_use_markup(True)
 
-    @staticmethod
-    def style_button(button):
-        button.text = button.get_label()
-        button.connect("state-changed", HobAltButton.desensitise_on_state_change_cb)
-        HobAltButton.set_text(button)
-        button.child.set_use_markup(True)
-        button.set_relief(gtk.RELIEF_NONE)
-
 class HobImageButton(gtk.Button):
     """
     A gtk.Button with an icon and two rows of text, the second of which is
@@ -360,7 +361,8 @@  class HobInfoButton(gtk.EventBox):
     def __init__(self, tip_markup, parent=None):
         gtk.EventBox.__init__(self)
         self.image = gtk.Image()
-        self.image.set_from_file(hic.ICON_INFO_DISPLAY_FILE)
+        self.image.set_from_file(
+        hic.ICON_INFO_DISPLAY_FILE)
         self.image.show()
         self.add(self.image)
 
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index 40eb7a4..c1a309d 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -485,8 +485,8 @@  class ImageDetailsPage (HobPage):
         if name in buttonlist and self.test_type_runnable(image_name) and self.test_mach_runnable(image_name):
             if created == True:
                 # separator
-                label = gtk.Label(" or ")
-                self.details_bottom_buttons.pack_end(label, expand=False, fill=False)
+                #label = gtk.Label(" or ")
+                #self.details_bottom_buttons.pack_end(label, expand=False, fill=False)
 
                 # create button "Run image"
                 run_button = HobAltButton("Run image")
@@ -507,8 +507,8 @@  class ImageDetailsPage (HobPage):
         if name in buttonlist:
             if created == True:
                 # separator
-                label = gtk.Label(" or ")
-                self.details_bottom_buttons.pack_end(label, expand=False, fill=False)
+                #label = gtk.Label(" or ")
+                #self.details_bottom_buttons.pack_end(label, expand=False, fill=False)
 
                 # create button "Save as template"
                 save_button = HobAltButton("Save as template")