--- a/svghmi/hmi_tree.ysl2 Tue Mar 17 10:34:26 2020 +0100
+++ b/svghmi/hmi_tree.ysl2 Tue Mar 17 11:24:07 2020 +0100
@@ -4,6 +4,12 @@
// HMI Tree computed from VARIABLES.CSV in svghmi.py
const "hmitree", "ns:GetHMITree()";
+const "_categories" {
+ noindex > HMI_ROOT
+ noindex > HMI_PLC_STATUS
+ noindex > HMI_CURRENT_PAGE
+}
+const "categories", "exsl:node-set($_categories)";
// HMI Tree Index
const "_indexed_hmitree" apply "$hmitree", mode="index";
@@ -46,6 +52,44 @@
}
}
+def "func:parselabel" {
+ param "label";
+ const "description", "substring-after($label,'HMI:')";
+
+ const "_args", "substring-before($description,'@')";
+ const "args" choose {
+ when "$_args" value "$_args";
+ otherwise value "$description";
+ }
+
+ const "_type", "substring-before($args,':')";
+ const "type" choose {
+ when "$_type" value "$_type";
+ otherwise value "$args";
+ }
+
+ const "ast" if "$type" widget {
+ attrib "type" > «$type»
+ foreach "str:split(substring-after($args, ':'), ':')" {
+ arg {
+ attrib "value" > «.»
+ }
+ }
+ const "paths", "substring-after($description,'@')";
+ foreach "str:split($paths, '@')" {
+ if "string-length(.) > 0" path {
+ attrib "value" > «.»
+ const "path", ".";
+ const "item", "$indexed_hmitree/*[@hmipath = $path]";
+ if "count($item) = 1"
+ attrib "index" > «$item/@index»
+ }
+ }
+ }
+
+ result "exsl:node-set($ast)";
+}
+
// Debug data
template "*", mode="testtree"{
param "indent", "''";