# HG changeset patch # User laurent # Date 1309785884 -7200 # Node ID b0d6819119c354865638404c59fdeae9549667f4 # Parent 0b6ab74f4b897bbfbf7217a6ef0065ab9fb957fb Adding support for syntax highlighting for EN and ENO parameters in formal function and function blocs in textual editor diff -r 0b6ab74f4b89 -r b0d6819119c3 PLCControler.py --- a/PLCControler.py Wed Jun 29 12:29:14 2011 +0200 +++ b/PLCControler.py Mon Jul 04 15:24:44 2011 +0200 @@ -1073,8 +1073,16 @@ blocktype = self.GetBlockType(typename, debug = debug) if blocktype is not None: tree = [] + en = False + eno = False for var_name, var_type, var_modifier in blocktype["inputs"] + blocktype["outputs"]: + en |= var_name.upper() == "EN" + eno |= var_name.upper() == "ENO" tree.append((var_name, var_type, self.GenerateVarTree(var_type, debug))) + if not eno: + tree.insert(0, ("ENO", "BOOL", ([], []))) + if not en: + tree.insert(0, ("EN", "BOOL", ([], []))) return tree, [] datatype = project.getdataType(typename) if datatype is not None: diff -r 0b6ab74f4b89 -r b0d6819119c3 TextViewer.py --- a/TextViewer.py Wed Jun 29 12:29:14 2011 +0200 +++ b/TextViewer.py Mon Jul 04 15:24:44 2011 +0200 @@ -344,6 +344,9 @@ blockname = blocktype["name"].upper() if blocktype["type"] == "function" and blockname not in self.Keywords and blockname not in self.Variables.keys(): interface = dict([(name, {}) for name, type, modifier in blocktype["inputs"] + blocktype["outputs"] if name != '']) + for param in ["EN", "ENO"]: + if not interface.has_key(param): + interface[param] = {} if self.Functions.has_key(blockname): self.Functions[blockname]["interface"].update(interface) self.Functions[blockname]["extensible"] |= blocktype["extensible"]