make default mutable 'true' and data on branches

This commit is contained in:
Douglas Clowes
2014-08-05 16:04:55 +10:00
parent a761136b48
commit 5be03cc63b

View File

@ -583,7 +583,7 @@ def init_context():
ContextStack[ContextIndex]['driveable'] = None
ContextStack[ContextIndex]['control'] = 'true'
ContextStack[ContextIndex]['data'] = 'true'
ContextStack[ContextIndex]['mutable'] = 'false'
ContextStack[ContextIndex]['mutable'] = 'true'
ContextStack[ContextIndex]['nxsave'] = 'true'
ContextStack[ContextIndex]['read_function'] = 'rdValue'
ContextStack[ContextIndex]['write_function'] = 'setValue'
@ -730,8 +730,40 @@ def build_group(MyDriver, p):
if key in ContextStack[ContextIndex]:
ContextStack[ContextIndex][key] = item[key]
pop_context()
adjust_group(MyGroup)
return MyGroup
def adjust_group(MyGroup):
if Verbose:
print 'ante adjust_group', MyGroup
MyData = None
for var in MyGroup['Vars']:
if Verbose:
print "Var:", MyGroup['Vars'][var]
if 'data' in MyGroup['Vars'][var]:
if MyGroup['Vars'][var]['data'] == 'true':
MyData = 'true'
else:
MyData = 'false'
break
if MyData is None:
for grp in MyGroup['Groups']:
if Verbose:
print "Grp:", MyGroup['Groups'][grp]
adjust_group(MyGroup['Groups'][grp])
if 'data' in MyGroup['Groups'][grp]['GroupProperty']:
if MyGroup['Groups'][grp]['GroupProperty']['data'] == 'true':
MyData = 'true'
else:
MyData = 'false'
break
if MyData is not None:
if 'GroupProperty' not in MyGroup:
MyGroup['GroupProperty'] = {}
MyGroup['GroupProperty']['data'] = MyData
if Verbose:
print 'post adjust_group', MyGroup
def build_driver(MyDriver, TheTree):
if Verbose:
print "TheTree:", TheTree
@ -784,8 +816,11 @@ def dump_driver_groups(groups, indent):
print indent + 'GROUP ' + item + ' = {'
else:
print indent + 'GROUP = {'
for subitem in sorted([x for x in groups[item] if not x in ['Groups', 'Vars']]):
for subitem in sorted([x for x in groups[item] if not x in ['Groups', 'Vars', 'GroupProperty']]):
print indent + ' ', subitem, '=', groups[item][subitem]
if 'GroupProperty' in groups[item]:
for subitem in groups[item]['GroupProperty']:
print indent + ' GroupProperty', subitem, '=', groups[item]['GroupProperty'][subitem]
dump_driver_vars(groups[item]['Vars'], indent)
dump_driver_groups(groups[item]['Groups'], indent + ' ')
print indent + '}'