Patchwork [bitbake-devel,4/9] lib/bb/ui/crumbs/hig: tweak 'Add Layer' button per visual design

login
register
mail settings
Submitter Joshua Lock
Date March 22, 2012, 11:31 p.m.
Message ID <a80d48afd6a9c1de728cda1a4375323ebce4f3d2.1332458487.git.josh@linux.intel.com>
Download mbox | patch
Permalink /patch/24209/
State Accepted
Commit 535d23921dfb7310022099d39b1092edfee51c1a
Headers show

Comments

Joshua Lock - March 22, 2012, 11:31 p.m.
Use a separate, pre-lit, icon when the button has the cursor over it.

Signed-off-by: Joshua Lock <josh@linux.intel.com>
---
 lib/bb/ui/crumbs/hig.py |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

Patch

diff --git a/lib/bb/ui/crumbs/hig.py b/lib/bb/ui/crumbs/hig.py
index 652226c..1db93ea 100644
--- a/lib/bb/ui/crumbs/hig.py
+++ b/lib/bb/ui/crumbs/hig.py
@@ -28,7 +28,7 @@  import re
 import subprocess
 import shlex
 from bb.ui.crumbs.hobcolor import HobColors
-from bb.ui.crumbs.hobwidget import hcc, hic, HobViewTable, HobInfoButton, HobAltButton
+from bb.ui.crumbs.hobwidget import hcc, hic, HobViewTable, HobInfoButton
 from bb.ui.crumbs.progressbar import HobProgressBar
 
 """
@@ -815,23 +815,22 @@  class LayerSelectionDialog (CrumbsDialog):
         col1.pack_start(cell1, True)
         col1.set_cell_data_func(cell1, self.draw_delete_button_cb, layer_tv)
 
-        add_button = HobAltButton()
+        add_button = gtk.Button()
+        add_button.set_relief(gtk.RELIEF_NONE)
         box = gtk.HBox(False, 6)
         box.show()
         add_button.add(box)
-        im = gtk.Image()
-        im.set_from_file(hic.ICON_INDI_ADD)
-        im.show()
-        box.pack_start(im, expand=False, fill=False, padding=6)
+        add_button.connect("enter-notify-event", self.add_hover_cb)
+        add_button.connect("leave-notify-event", self.add_leave_cb)
+        self.im = gtk.Image()
+        self.im.set_from_file(hic.ICON_INDI_ADD_FILE)
+        self.im.show()
+        box.pack_start(self.im, expand=False, fill=False, padding=6)
         lbl = gtk.Label("Add layer")
         lbl.set_alignment(0.0, 0.5)
         lbl.show()
         box.pack_start(lbl, expand=True, fill=True, padding=6)
         add_button.connect("clicked", self.layer_widget_add_clicked_cb, layer_store, window)
-        add_button.set_can_default(True)
-        add_button.grab_default()
-        add_button.set_can_focus(True)
-        add_button.grab_focus()
         table_layer.attach(add_button, 0, 10, 1, 2, gtk.EXPAND | gtk.FILL, 0, 0, 6)
         layer_tv.set_model(layer_store)
 
@@ -839,6 +838,12 @@  class LayerSelectionDialog (CrumbsDialog):
 
         return hbox, layer_store
 
+    def add_hover_cb(self, button, event):
+        self.im.set_from_file(hic.ICON_INDI_ADD_HOVER_FILE)
+
+    def add_leave_cb(self, button, event):
+        self.im.set_from_file(hic.ICON_INDI_ADD_FILE)
+
     def __init__(self, title, layers, all_layers, parent, flags, buttons):
         super(LayerSelectionDialog, self).__init__(title, parent, flags, buttons)
 
@@ -849,7 +854,7 @@  class LayerSelectionDialog (CrumbsDialog):
 
         # icon for remove button in TreeView
         im = gtk.Image()
-        im.set_from_file(hic.ICON_INDI_REMOVE)
+        im.set_from_file(hic.ICON_INDI_REMOVE_FILE)
         self.rem_icon = im.get_pixbuf()
 
         # class members for internal use