from OptionsParsing import ParseOptions, GenOptions
def GetVarOnChangeContent(var):
Function to overide the way PythonFileCTNMixin access OnChange column when
opts = ParseOptions(var.getopts())
for onchangecall in var.getonchange().split(','):
onchangecall = onchangecall.strip()
new_onchange.append(onchangecall)
if opts.variable_type_selection == 1 : # "Static"
new_onchange += ["StoredValue"]
elif opts.variable_type_selection == 3 : # "Alarm"
new_onchange += ["Alarm"]
return ','.join(new_onchange)
Function to be called at the end of PythonFileCTNMixin.__init__()
for var in self.CodeFile.variables.variable:
onchange.strip() for onchange in var.getonchange().split(',')]
opts = ParseOptions(var.getopts())
for unwanted in ["Alarm", "StoredValue"]:
if unwanted in onchanges:
onchanges.remove(unwanted)
var.setonchange(','.join(onchanges))
var.setopts(GenOptions(opts))