summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Niklaus <marex@opencompositing.org>2007-06-03 17:39:22 +0200
committerPatrick Niklaus <marex@opencompositing.org>2007-06-03 17:39:22 +0200
commit454d5e86bd4319aff70d44cb979712bfc9be17a6 (patch)
treeddeff13e9ab60b2943072f9555c32a12050f6ce9
parent0b4a7cf79a3a5b3e2cfecc8bf9255af62f2c1843 (diff)
downloadccsm-454d5e86bd4319aff70d44cb979712bfc9be17a6.tar.gz
ccsm-454d5e86bd4319aff70d44cb979712bfc9be17a6.tar.bz2
Added support for int lists with description
-rwxr-xr-xccsm.in68
1 files changed, 67 insertions, 1 deletions
diff --git a/ccsm.in b/ccsm.in
index b09f471..257e013 100755
--- a/ccsm.in
+++ b/ccsm.in
@@ -467,6 +467,50 @@ class StringMatchListSetting(ListSetting):
return entry.get_text()
return None
+class IntDescListSetting(SettingItem):
+ def _Init(self):
+ self.Widget = gtk.Frame(self.Setting.ShortDesc)
+ self.Table = gtk.Table()
+ self.Custom = True
+
+ row = 0
+ col = 0
+ self.Checks = []
+ for key in self.Setting.Info[1][2].keys():
+ box = gtk.CheckButton(key)
+ self.Checks.append((key, box))
+ self.Table.attach(box, col, col+1, row, row+1, TDef, TDef, TXp, TYp)
+ box.connect('toggled', self.Changed)
+ col = col+1
+ if (col >= 3):
+ col = 0
+ row = row+1
+
+ self.HBox = gtk.HBox()
+ self.VBox = gtk.VBox()
+ self.HBox.pack_start(self.VBox, False, False)
+ self.HBox.pack_start(self.Table, True, True)
+ self.VBox.pack_start(self.Reset, False, False)
+ self.Widget.add(self.HBox)
+
+ def _Read(self):
+ for value, box in self.Checks:
+ box.set_active(False)
+ for setVal in self.Setting.Value:
+ for value, box in self.Checks:
+ if setVal == value:
+ box.set_active(True)
+
+ def _Changed(self):
+ values = []
+ for key, box in self.Checks:
+ if box.get_active():
+ values.append(self.Setting.Info[1][2][key])
+ self.Setting.Value = values
+
+ def Attach(self, table, row):
+ table.attach(self.Widget, 0, 100, row, row+1, xpadding = 5)
+
class IntFloatListSetting(ListSetting):
def _ListInfo(self):
return (gobject.TYPE_STRING, ), [(gtk.CellRendererText(),
@@ -534,7 +578,12 @@ def MakeSetting(setting):
return ListChoiceSetting(setting)
elif setting.Info[0] == 'String' or setting.Info[0] == 'Match':
return StringMatchListSetting(setting)
- elif setting.Info[0] == 'Int' or setting.Info[0] == 'Float':
+ elif setting.Info[0] == 'Int':
+ if len(setting.Info[1]) > 2:
+ return IntDescListSetting(setting)
+ else:
+ return IntFloatListSetting(setting)
+ elif setting.Info[0] == 'Float':
return IntFloatListSetting(setting)
else:
raise TypeError, "Unhandled list type %s for %s"%(setting.Info[0], setting.Name)
@@ -546,6 +595,15 @@ def SettingSortCompare(v1, v2):
else:
return cmp(v1.ShortDesc, v2.ShortDesc)
+def HasOnlyType(subGroup, type):
+ empty = True
+ for setting in sum((v.values() for v in [subGroup.Display]+[subGroup.Screens[CurrentScreenNum]]), []):
+ if not setting.Name == '____plugin_enabled':
+ empty = False
+ if setting.Type != type:
+ return False
+ return not empty
+
class SubGroupArea:
def __init__(self, name, subGroup):
if name == '':
@@ -558,6 +616,14 @@ class SubGroupArea:
self.Expander.set_expanded(False)
self.Child = gtk.Table()
self.Expander.add(self.Child)
+
+ # create a special widget for list subGroups
+ #if HasOnlyType(subGroup, 'List'):
+ # multiList = MultiListSetting(subGroup)
+ # multiList.attach(self.Child)
+ # self.Empty = False
+
+ # return # exit earlier to avoid unneeded logic's
self.Empty = True
row = 0