# HG changeset patch # User Laurent Bessard # Date 1380019236 -7200 # Node ID 884477877e530ecbe369e40cbc079e6902c3f5ad # Parent a2b1af39385c4ef3b61d2416c9821a859715cd03 Fixed bug in VariablePanel, function block variables in graphic viewers could be modified diff -r a2b1af39385c -r 884477877e53 PLCControler.py --- a/PLCControler.py Tue Sep 24 12:35:57 2013 +0200 +++ b/PLCControler.py Tue Sep 24 12:40:36 2013 +0200 @@ -115,7 +115,7 @@ elif el.tag == "Tree": return generate_var_tree(el) elif el.tag == "Edit": - return True + return el.text == "True" elif el.text is None: return '' return el.text @@ -157,6 +157,18 @@ self.apply_templates(context, datatype_infos, output_parent) return +class VarIsEdited(etree.XSLTExtension): + + def __init__(self, controller, debug): + etree.XSLTExtension.__init__(self) + self.Controller = controller + self.Debug = debug + + def execute(self, context, self_node, input_node, output_parent): + typename = input_node.get("name") + output_parent.text = str( + self.Controller.GetPou(typename, self.Debug) is None) + variables_infos_xslt = etree.parse( os.path.join(ScriptDirectory, "plcopen", "variables_infos.xslt")) @@ -1211,7 +1223,8 @@ variables_infos_xslt_tree = etree.XSLT( variables_infos_xslt, extensions = { ("var_infos_ns", "add_variable"): AddVariable(variables), - ("var_infos_ns", "var_tree"): VarTree(self, debug)}) + ("var_infos_ns", "var_tree"): VarTree(self, debug), + ("var_infos_ns", "is_edited"): VarIsEdited(self, debug)}) variables_infos_xslt_tree(object_with_vars) return variables diff -r a2b1af39385c -r 884477877e53 plcopen/variables_infos.xslt --- a/plcopen/variables_infos.xslt Tue Sep 24 12:35:57 2013 +0200 +++ b/plcopen/variables_infos.xslt Tue Sep 24 12:40:36 2013 +0200 @@ -69,7 +69,7 @@ - + @@ -104,7 +104,13 @@ - + + + + + True + +