summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Niklaus <marex@compiz-fusion.org>2011-02-12 19:24:14 +0100
committerPatrick Niklaus <marex@compiz-fusion.org>2011-02-12 19:24:14 +0100
commit632c982318d74f9db693ebdcc3154e83f41ce83c (patch)
treecff43ddc7016306094a70a959ecd8cfe40707a79
parent0e70c436d24442af37087a6e13496ab9dfdf4cb3 (diff)
downloadccsm-632c982318d74f9db693ebdcc3154e83f41ce83c.tar.gz
ccsm-632c982318d74f9db693ebdcc3154e83f41ce83c.tar.bz2
Replaced libsexy code with gtk entry
-rw-r--r--ccm/Pages.py24
-rw-r--r--ccm/Widgets.py11
2 files changed, 20 insertions, 15 deletions
diff --git a/ccm/Pages.py b/ccm/Pages.py
index ff7ef54..2349dfe 100644
--- a/ccm/Pages.py
+++ b/ccm/Pages.py
@@ -76,7 +76,7 @@ class PluginPage(GenericPage):
filterLabel = Label()
filterLabel.set_markup(HeaderMarkup % (_("Filter")))
filterLabel.connect("style-set", self.HeaderStyleSet)
- self.FilterEntry = gtk.Entry()
+ self.FilterEntry = ClearEntry()
self.FilterEntry.connect("changed", self.FilterChanged)
self.LeftWidget.pack_start(pluginImg, False, False)
@@ -256,15 +256,10 @@ class FilterPage(GenericPage):
self.LeftWidget.pack_start(filterLabel, False, False)
# Entry FIXME find a solution with std gtk
- """
- self.FilterEntry = sexy.IconEntry()
- self.FilterEntry.add_clear_button()
- keyboardImage = Image("input-keyboard", ImageThemed, 16)
- self.FilterEntry.set_icon(sexy.ICON_ENTRY_PRIMARY, keyboardImage)
- self.FilterEntry.set_icon_highlight(sexy.ICON_ENTRY_PRIMARY, True)
- self.FilterEntry.connect('icon-pressed', self.GrabKey)
- """
- self.FilterEntry = gtk.Entry()
+ self.FilterEntry = ClearEntry()
+ self.FilterEntry.set_icon_from_icon_name(gtk.ENTRY_ICON_PRIMARY, "input-keyboard")
+ self.FilterEntry.set_icon_tooltip_text(gtk.ENTRY_ICON_PRIMARY, _("Grab Keys"))
+ self.FilterEntry.connect('icon-press', self.GrabKey)
self.FilterEntry.set_tooltip_text(_("Enter a filter.\nClick the keyboard image to grab a key for which to search."))
self.FilterEntry.connect("changed", self.FilterChanged)
@@ -434,16 +429,15 @@ class FilterPage(GenericPage):
self.FilterValueCheck.set_active(True)
self.FilterEntry.set_text(new)
- # FIXME find a way to reuse this function
- """
- def GrabKey(self, widget, pos, button):
+ def GrabKey(self, widget, pos, event):
+ if pos != gtk.ENTRY_ICON_PRIMARY:
+ return
grabber = KeyGrabber(label = _("Grab key combination"))
self.LeftWidget.pack_start(grabber, False, False)
grabber.hide()
grabber.set_no_show_all(True)
grabber.connect('changed', self.GotKey)
grabber.begin_key_grab(None)
- """
def ShowFilterError(self, text):
@@ -1191,7 +1185,7 @@ class MainPage(object):
filterLabel.set_markup(HeaderMarkup % (_("Filter")))
filterLabel.connect("style-set", self.HeaderStyleSet)
filterLabel.props.xalign = 0.1
- filterEntry = gtk.Entry()
+ filterEntry = ClearEntry()
filterEntry.set_tooltip_text(_("Filter your Plugin list"))
filterEntry.connect("changed", self.FilterChanged)
self.filterEntry = filterEntry
diff --git a/ccm/Widgets.py b/ccm/Widgets.py
index 67eff6f..e5696ea 100644
--- a/ccm/Widgets.py
+++ b/ccm/Widgets.py
@@ -46,6 +46,17 @@ _ = gettext.gettext
# Try to use gtk like coding style for consistency
#
+class ClearEntry(gtk.Entry):
+ def __init__(self):
+ gtk.Entry.__init__(self)
+ self.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, gtk.STOCK_CLEAR)
+ self.set_icon_tooltip_text(gtk.ENTRY_ICON_SECONDARY, _("Clear"))
+ self.connect('icon-press', self._clear_pressed)
+
+ def _clear_pressed(self, widget, pos, event):
+ if pos == gtk.ENTRY_ICON_SECONDARY:
+ self.set_text("")
+
# Cell Renderer for MultiList
class CellRendererColor(gtk.GenericCellRenderer):