[fusion-commits] Compizconfig Settings Manager in Python: Changes to 'master' (6d468c5c31d8c2b7e8f289dc6818655eb58c8dbf)
marex at server.beryl-project.org
marex at server.beryl-project.org
Mon Aug 6 14:50:57 CEST 2007
New commits:
commit 6d468c5c31d8c2b7e8f289dc6818655eb58c8dbf
Author: Patrick Niklaus <marex at opencompositing.org>
Date: Mon Aug 6 14:50:15 2007 +0200
Added NotFoundBox for plugin settings
commit be66afe5531279bf3f02a6d0f1e52e84bb753a88
Author: Patrick Niklaus <marex at opencompositing.org>
Date: Sun Aug 5 23:37:10 2007 +0200
Added "Not found" message to plugin filter. Simialr to the one in
Gnome-Control-Center.
ccm/Constants.py.in | 1 +
ccm/Pages.py | 26 ++++++++++++++++--
ccm/Utils.py | 70 +++++++++++++++++++++++++++++++++++++--------------
ccm/Window.py | 29 +++++++++++++++++---
4 files changed, 99 insertions(+), 27 deletions(-)
Modified: fusion/compizconfig/ccsm/ccm/Constants.py.in
===================================================================
--- fusion/compizconfig/ccsm/ccm/Constants.py.in
+++ fusion/compizconfig/ccsm/ccm/Constants.py.in
@@ -46,6 +46,7 @@ TableY = 2
ImageNone = 0
ImagePlugin = 1
ImageCategory = 2
+ImageThemed = 3
# Paths
#
Modified: fusion/compizconfig/ccsm/ccm/Pages.py
===================================================================
--- fusion/compizconfig/ccsm/ccm/Pages.py
+++ fusion/compizconfig/ccsm/ccm/Pages.py
@@ -113,14 +113,13 @@ class ActionPage:
self.Scroll.add(self.TreeView)
self.Widget.pack_start(self.Scroll, True, True)
- self.Empty = True
self.TreeView.connect('row-activated', self.Activated)
self.UpdateTreeView()
-
def UpdateTreeView(self):
self.Store.clear()
+ self.Empty = True
self.Plugins = {}
if self.Plugin:
@@ -156,6 +155,7 @@ class ActionPage:
settings = sum((v.values() for v in [subGroup.Display]+[subGroup.Screens[CurrentScreenNum]]), [])
settings = sorted(FilterSettings(settings, self.Filter), SettingSortCompare)
+
for setting in settings:
if setting.Type == 'Action':
if subGroupName != '':
@@ -436,6 +436,8 @@ class PluginPage:
self.LeftWidget.pack_start(infoLabelCont, False, False)
infoLabel = Label(plugin.LongDesc, 180)
infoLabelCont.pack_start(infoLabel, True, True)
+
+ self.NotFoundBox = None
if plugin.Name != 'core':
Tooltips.set_tip(self.FilterEntry, _("Search %s Plugin Options") % plugin.ShortDesc)
@@ -498,7 +500,8 @@ class PluginPage:
groups.append((name, groupPage))
for page in self.RightWidget.get_children():
- if self.RightWidget.get_tab_label(page).get_label() != _("Actions"):
+ label = self.RightWidget.get_tab_label(page).get_label()
+ if label != _("Actions") and label != _("Error"):
self.RightWidget.remove_page(self.RightWidget.page_num(page))
page.destroy()
@@ -508,6 +511,23 @@ class PluginPage:
if self.ActionPage:
self.ActionPage.Filter = filter
self.ActionPage.UpdateTreeView()
+ if self.ActionPage.Empty and self.ActionPage.Widget.get_parent():
+ self.RightWidget.remove_page(self.RightWidget.page_num(self.ActionPage.Widget))
+ elif not self.ActionPage.Empty and not self.ActionPage.Widget.get_parent():
+ self.RightWidget.append_page(self.ActionPage.Widget, gtk.Label(_("Actions")))
+
+ # Add
+ if len(self.RightWidget.get_children()) == 0 and not self.NotFoundBox:
+ self.NotFoundBox = NotFoundBox(filter)
+ self.RightWidget.append_page(self.NotFoundBox, gtk.Label(_("Error")))
+ # Update
+ elif len(self.RightWidget.get_children()) == 1 and self.NotFoundBox:
+ self.NotFoundBox.update(filter)
+ # Cleanup
+ elif len(self.RightWidget.get_children()) > 1 and self.NotFoundBox:
+ self.RightWidget.remove_page(self.RightWidget.page_num(self.NotFoundBox))
+ self.NotFoundBox.destroy()
+ self.NotFoundBox = None
self.RightWidget.show_all()
Modified: fusion/compizconfig/ccsm/ccm/Utils.py
===================================================================
--- fusion/compizconfig/ccsm/ccm/Utils.py
+++ fusion/compizconfig/ccsm/ccm/Utils.py
@@ -28,6 +28,13 @@ import gobject
from ccm.Constants import *
+import locale
+import gettext
+locale.setlocale(locale.LC_ALL, "")
+gettext.bindtextdomain("ccsm", DataDir + "/locale")
+gettext.textdomain("ccsm")
+_ = gettext.gettext
+
def getScreens():
screens = []
display = gtk.gdk.display_get_default()
@@ -53,25 +60,33 @@ class Image(gtk.Image):
def __init__(self, name=None, type=ImageNone, size = 32):
gtk.Image.__init__(self)
- if type == ImagePlugin and name != None:
- iconpath = "%s/plugin-%s.svg" % (PixmapDir, name)
- if not os.path.exists(iconpath):
- iconpath = "%s/plugin-unknown.svg"%PixmapDir
- try:
- pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(iconpath, size, size)
- self.set_from_pixbuf(pixbuf)
- except:
- self.set_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_BUTTON)
-
- elif type == ImageCategory and name != None:
- iconpath = "%s/category-%s.svg" % (PixmapDir, name)
- if not os.path.exists(iconpath):
- iconpath = "%s/category-uncategorized.svg" % PixmapDir
- try:
- pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(iconpath, size, size)
- self.set_from_pixbuf(pixbuf)
- except:
- self.set_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_BUTTON)
+ if name != None:
+ if type == ImagePlugin:
+ iconpath = "%s/plugin-%s.svg" % (PixmapDir, name)
+ if not os.path.exists(iconpath):
+ iconpath = "%s/plugin-unknown.svg"%PixmapDir
+ try:
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(iconpath, size, size)
+ self.set_from_pixbuf(pixbuf)
+ except:
+ self.set_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_BUTTON)
+
+ elif type == ImageCategory:
+ iconpath = "%s/category-%s.svg" % (PixmapDir, name)
+ if not os.path.exists(iconpath):
+ iconpath = "%s/category-uncategorized.svg" % PixmapDir
+ try:
+ pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(iconpath, size, size)
+ self.set_from_pixbuf(pixbuf)
+ except:
+ self.set_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_BUTTON)
+ elif type == ImageThemed:
+ iconTheme = gtk.icon_theme_get_default()
+ try:
+ pixbuf = iconTheme.load_icon(name, size, 0)
+ self.set_from_pixbuf(pixbuf)
+ except:
+ self.set_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_BUTTON)
class Label(gtk.Label):
def __init__(self, value = "", wrap = 160):
@@ -81,6 +96,23 @@ class Label(gtk.Label):
self.set_line_wrap(True)
self.set_size_request(wrap, -1)
+class NotFoundBox(gtk.Alignment):
+ def __init__(self, value):
+ gtk.Alignment.__init__(self, 0.5, 0.5, 0.0, 0.0)
+
+ box = gtk.HBox()
+ self.Warning = gtk.Label()
+ self.Markup = _("<span size=\"large\"><b>No matches found.</b> </span><span>\n\n Your filter \"<b>%s</b>\" does not match any items.</span>")
+ self.Warning.set_markup(self.Markup % value)
+ image = Image("face-surprise", ImageThemed, 48)
+
+ box.pack_start(image, False, False, 0)
+ box.pack_start(self.Warning, True, True, 15)
+ self.add(box)
+
+ def update(self, value):
+ self.Warning.set_markup(self.Markup % value)
+
# Updates all registered setting when they where changed through CompizConfig
class Updater:
def __init__(self, context):
Modified: fusion/compizconfig/ccsm/ccm/Window.py
===================================================================
--- fusion/compizconfig/ccsm/ccm/Window.py
+++ fusion/compizconfig/ccsm/ccm/Window.py
@@ -323,14 +323,33 @@ class MainWin(gtk.Window):
# Search in long description
if not foundPlugin and target == 0:
self.FilterTable(widget, 1)
- return
# Search in category
elif not foundPlugin and target == 1:
self.FilterTable(widget, 2)
- return
-
- self.TableAttached = True
- self.show_all()
+ # Nothing found -- Ported from Gnome-Control-Center.
+ elif not foundPlugin and target == 2:
+
+ # Already created only update message
+ if not self.TableAttached:
+ notFound = self.RightPane.get_child().get_child().get_child().get_children()[-1]
+ notFound.update(text)
+ return
+
+ self.TableAttached = False
+
+ box = self.RightPane.get_child().get_child().get_child()
+ notFound = NotFoundBox(text)
+ box.pack_start(notFound, True, False)
+
+ self.show_all()
+ # Something found, display it
+ elif foundPlugin:
+ # Clean up not found Message
+ if not self.TableAttached:
+ self.RightPane.get_child().get_child().get_child().get_children()[-1].destroy()
+
+ self.TableAttached = True
+ self.show_all()
def RebuildTable(self, widget, request):
cols = (request.width - 60) / 220
More information about the commits
mailing list