# HG changeset patch
# User Laurent Bessard
# Date 1381486240 -7200
# Node ID 7158aa05422637bb018c40ac82d6b2a02ffc0395
# Parent ebfe9c22af2acfbae7b59314a109b057975efec6
Fixed bugs when editing resource variables and tasks
diff -r ebfe9c22af2a -r 7158aa054226 PLCControler.py
--- a/PLCControler.py Fri Oct 11 10:07:56 2013 +0200
+++ b/PLCControler.py Fri Oct 11 12:10:40 2013 +0200
@@ -3050,11 +3050,11 @@
varlist = []
words = tagname.split("::")
for var in self.GetConfigurationGlobalVars(words[1], debug):
- if var["Type"] == "BOOL":
- varlist.append(var["Name"])
+ if var.Type == "BOOL":
+ varlist.append(var.Name)
for var in self.GetConfigurationResourceGlobalVars(words[1], words[2], debug):
- if var["Type"] == "BOOL":
- varlist.append(var["Name"])
+ if var.Type == "BOOL":
+ varlist.append(var.Name)
return varlist
def SetEditedResourceInfos(self, tagname, tasks, instances):
diff -r ebfe9c22af2a -r 7158aa054226 controls/VariablePanel.py
--- a/controls/VariablePanel.py Fri Oct 11 10:07:56 2013 +0200
+++ b/controls/VariablePanel.py Fri Oct 11 12:10:40 2013 +0200
@@ -573,6 +573,8 @@
if self.Table.GetValueByName(row, "Edit"):
self.Values.remove(self.Table.GetRow(row))
self.SaveValues()
+ if self.ElementType == "resource":
+ self.ParentWindow.RefreshView(variablepanel = False)
self.RefreshValues()
setattr(self.VariablesGrid, "_DeleteRow", _DeleteVariable)
diff -r ebfe9c22af2a -r 7158aa054226 plcopen/variables_infos.xslt
--- a/plcopen/variables_infos.xslt Fri Oct 11 10:07:56 2013 +0200
+++ b/plcopen/variables_infos.xslt Fri Oct 11 12:10:40 2013 +0200
@@ -28,10 +28,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -70,7 +88,7 @@
-
+
@@ -132,73 +150,73 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
+
STRING
-
+
WSTRING
-
+
diff -r ebfe9c22af2a -r 7158aa054226 plcopen/variables_infos.ysl2
--- a/plcopen/variables_infos.ysl2 Fri Oct 11 10:07:56 2013 +0200
+++ b/plcopen/variables_infos.ysl2 Fri Oct 11 12:10:40 2013 +0200
@@ -32,9 +32,21 @@
}
}
+ template "ppx:configuration" {
+ apply "ppx:globalVars";
+ }
+
+ template "ppx:resource" {
+ apply "ppx:globalVars";
+ }
+
+ template "ppx:pou" {
+ apply "ppx:interface/*";
+ }
+
template "ppx:returnType" {
value "ns:AddTree()";
- apply;
+ apply ".", mode="var_type";
}
function "variables_infos" {
@@ -59,7 +71,7 @@
}
}
value "ns:AddTree()";
- apply "ppx:type";
+ apply "ppx:type", mode="var_type";
value "ns:AddVariable(@name, $var_class, $var_option, @address, $initial_value, $edit, ppx:documentation/xhtml:p/text())";
}
}
@@ -106,26 +118,26 @@
}
}
- template "ppx:pou" {
- apply "ppx:interface/*[self::ppx:inputVars or self::ppx:inOutVars or self::ppx:outputVars]/ppx:variable";
- }
-
- template "ppx:variable" {
+ template "ppx:pou", mode="var_type" {
+ apply "ppx:interface/*[self::ppx:inputVars or self::ppx:inOutVars or self::ppx:outputVars]/ppx:variable", mode="var_type";
+ }
+
+ template "ppx:variable", mode="var_type" {
variable "name" > «@name»
value "ns:AddTree($name)";
- apply "ppx:type";
+ apply "ppx:type", mode="var_type";
value "ns:AddVarToTree($name)";
}
- template "ppx:dataType" {
- apply "ppx:baseType";
- }
-
- template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:struct" {
- apply "ppx:variable";
- }
-
- template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived" {
+ template "ppx:dataType", mode="var_type" {
+ apply "ppx:baseType", mode="var_type";
+ }
+
+ template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:struct", mode="var_type" {
+ apply "ppx:variable", mode="var_type";
+ }
+
+ template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived", mode="var_type" {
variable "type_name" > «@name»
choose {
when "$tree='True'" {
@@ -134,30 +146,30 @@
exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |
exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] |
exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |
- exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]""";
+ exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]""", mode="var_type";
}
}
value "ns:SetType($type_name)";
}
- template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:array" {
- apply "ppx:baseType";
+ template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:array", mode="var_type" {
+ apply "ppx:baseType", mode="var_type";
foreach "ppx:dimension" {
value "ns:AddDimension(@lower, @upper)";
}
}
- template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:string" {
+ template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:string", mode="var_type" {
variable "name" > STRING
value "ns:SetType($name)";
}
- template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:wstring" {
+ template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:wstring", mode="var_type" {
variable "name" > WSTRING
value "ns:SetType($name)";
}
- template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*" {
+ template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*", mode="var_type" {
variable "name" > «local-name()»
value "ns:SetType($name)";
}