fileHandle.write(wstr)
- fileHandle.close()
+ fileHandle.close()
+
+def currentConfigSelectionElement(element):
+ return element.vals[element.value][0]
+
+def getConfigSelectionElement(element, value):
+ count = 0
+ for x in element.vals:
+ if x[0] == value:
+ return count
+ count += 1
+ return -1
class configSelection:
def __init__(self, parent):
returnValue = _(self.parent.vals[self.parent.value])
else:
returnValue = _(self.parent.vals[self.parent.value][1])
-
-
- print self.parent.vals[self.parent.value]
return ("text", returnValue)
# configsequencearg.get("FLOAT", [(min,max),(min1,max1)]) => x.y with min <= x <= max and min1 <= y <= max1
if (type == "FLOAT"):
return (("."), args, "")
+
+ def getFloat(self, element):
+ return float(("%d.%0" + str(len(str(element.vals[1][1][1]))) + "d") % (element.value[0], element.value[1]))
configsequencearg = configSequenceArg()
if control == ConfigSlider:
return str(data)
elif control == configSelection:
+ if len(self.vals) < data + 1:
+ return "0"
if isinstance(self.vals[data], str):
return str(data)
else:
return str(data.strip())
elif control == configSequence:
- print data
try:
value = ((len(data) * ("%d" + self.vals[0]))[0:-1]) % tuple(data)
except:
#is this right? activate settings after load/cancel and use default
self.change()
- def __init__(self, configPath, control, defaultValue, vals):
+ def __init__(self, configPath, control, defaultValue, vals, saveDefaults = True):
self.configPath = configPath
self.defaultValue = defaultValue
self.controlType = control
self.vals = vals
self.notifierList = [ ]
self.enabled = True
+ self.saveDefaults = saveDefaults
self.loadData()
def getConfigPath(self):
def reload(self):
self.loadData()
def save(self):
- configfile.setKey(self.configPath, self.datatoFile(self.controlType,self.value))
+ if self.defaultValue != self.value or self.saveDefaults == True:
+ configfile.setKey(self.configPath, self.datatoFile(self.controlType,self.value))
class configElement_nonSave(configElement):
def __init__(self, configPath, control, defaultValue, vals):