summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Williams <crdlb@compiz-fusion.org>2008-09-10 02:23:48 -0400
committerChristopher Williams <crdlb@compiz-fusion.org>2008-09-10 02:23:48 -0400
commit1d9fdb8da84eedfc9f86d5ad8eaeaf7f20469a0e (patch)
treecb70810aff5cda6600ed06fce3b481abf7aed0a4
parenta48de2b1512eee306a9210ef8253dc2d7d02b39d (diff)
parent674e2c0b0abda8af57687417215cd1f8fb09fcd8 (diff)
downloadccsm-1d9fdb8da84eedfc9f86d5ad8eaeaf7f20469a0e.tar.gz
ccsm-1d9fdb8da84eedfc9f86d5ad8eaeaf7f20469a0e.tar.bz2
Merge branch 'master' of git+ssh://crdlb@git.compiz-fusion.org/git/fusion/compizconfig/ccsm
-rw-r--r--ccm/Pages.py25
-rw-r--r--ccm/Utils.py3
2 files changed, 17 insertions, 11 deletions
diff --git a/ccm/Pages.py b/ccm/Pages.py
index a600cff..191f2aa 100644
--- a/ccm/Pages.py
+++ b/ccm/Pages.py
@@ -123,7 +123,8 @@ class PluginPage(GenericPage):
self.RightWidget.set_scrollable(True)
self.Pages = []
- for name, group in sorted(plugin.Groups.items()):
+ sortedGroups = sorted(plugin.Groups.items(), key=GroupIndexKeyFunc)
+ for (name, (groupIndex, group)) in sortedGroups:
name = name or _("General")
groupPage = GroupPage(name, group)
groupPage.Wrap()
@@ -392,9 +393,10 @@ class FilterPage(GenericPage):
label.set_markup("<i>%s</i>" %protect_pango_markup(Plugin.ShortDesc))
gtk_process_events()
- groups = {}
- for name, group in Plugin.Groups.items():
- groups[name] = GroupPage(name or _('General'), group)
+ groups = []
+ sortedGroups = sorted(Plugin.Groups.items(), key=GroupIndexKeyFunc)
+ for (name, (groupIndex, group)) in sortedGroups:
+ groups.append((name, GroupPage(name or _('General'), group)))
self.GroupPages[plugin] = groups
self.Level = FilterName | FilterLongDesc
@@ -420,7 +422,7 @@ class FilterPage(GenericPage):
def Filter(self, text, level=FilterAll):
text = text.lower()
for plugin, groups in self.GroupPages.items():
- results = dict((n, sg) for (n, sg) in groups.items() if sg.Filter(text, level=level))
+ results = dict((n, sg) for (n, sg) in groups if sg.Filter(text, level=level))
if results:
yield plugin, results
@@ -601,7 +603,7 @@ class FilterPage(GenericPage):
self.PackedGroups = []
for plugin in plugins:
box = gtk.VBox()
- for page in self.GroupPages[plugin.Name].values():
+ for (pageName, page) in self.GroupPages[plugin.Name]:
box.pack_start(page.Label, False, False)
box.pack_start(page.Widget, False, False)
@@ -648,7 +650,7 @@ class FilterPage(GenericPage):
def GoBack(self, widget):
for groups in self.GroupPages.values():
- for page in groups.values():
+ for (pageName, page) in groups:
page.SetContainer.destroy()
self.GroupPages = None
@@ -1365,15 +1367,16 @@ class GroupPage(Page):
label.set_use_markup(True)
self.Label.add(label)
if '' in group:
- sga = SubGroupArea('', group[''])
+ sga = SubGroupArea('', group[''][1])
if not sga.Empty:
self.SetContainer.pack_start(sga.Widget, False, False)
self.Empty = False
self.subGroupAreas.append(sga)
- for subGroup in sorted(group):
- if not subGroup == '':
- sga = SubGroupArea(subGroup, group[subGroup])
+ sortedSubGroups = sorted(group.items(), key=GroupIndexKeyFunc)
+ for (subGroupName, (subGroupIndex, subGroup)) in sortedSubGroups:
+ if not subGroupName == '':
+ sga = SubGroupArea(subGroupName, subGroup)
if not sga.Empty:
self.SetContainer.pack_start(sga.Widget, False, False)
self.Empty = False
diff --git a/ccm/Utils.py b/ccm/Utils.py
index af71870..8f0231d 100644
--- a/ccm/Utils.py
+++ b/ccm/Utils.py
@@ -341,6 +341,9 @@ def CategoryKeyFunc(category):
else:
return category or 'zzzzzzzz'
+def GroupIndexKeyFunc(item):
+ return item[1][0]
+
FirstItemKeyFunc = operator.itemgetter(0)
EnumSettingKeyFunc = operator.itemgetter(1)