SVGHMI: code cleanup
authorEdouard Tisserant <edouard@beremiz.fr>
Fri, 11 Oct 2024 09:31:34 +0200
changeset 4024 f9c6bbf66eea
parent 4023 b344393859df
child 4025 92b3701fceed
SVGHMI: code cleanup
svghmi/hmi_tree.ysl2
svghmi/parse_labels.ysl2
svghmi/widgets_common.ysl2
--- a/svghmi/hmi_tree.ysl2	Mon Sep 30 16:21:11 2024 +0200
+++ b/svghmi/hmi_tree.ysl2	Fri Oct 11 09:31:34 2024 +0200
@@ -6,12 +6,6 @@
 // HMI Tree computed from VARIABLES.CSV in svghmi.py
 const "hmitree", "ns:GetHMITree()";
 
-const "_categories" {
-    noindex > HMI_PLC_STATUS
-    noindex > HMI_CURRENT_PAGE
-}
-const "categories", "exsl:node-set($_categories)";
-
 // HMI Tree Index
 const "_indexed_hmitree" apply "$hmitree", mode="index";
 const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)";
@@ -49,30 +43,19 @@
     param "index", "0";
     param "parentpath", "''";
     const "content" {
-        const "path"
-            choose {
-                when "count(ancestor::*)=0" > /
-                when "count(ancestor::*)=1" > /«@name»
-                otherwise > «$parentpath»/«@name»
-            }
-        choose {
-            when "not(local-name() = $categories/noindex)" {
-                xsl:copy {
-                    attrib "index" > «$index»
-                    attrib "hmipath" > «$path»
-                    foreach "@*" xsl:copy;
-                }
-                apply "*[1]", mode="index"{
-                     with "index", "$index + 1";
-                     with "parentpath" > «$path»
-                }
-            }
-            otherwise {
-                apply "*[1]", mode="index"{
-                    with "index", "$index";
-                    with "parentpath" > «$path»
-                }
-            }
+        const "path" choose {
+            when "count(ancestor::*)=0" > /
+            when "count(ancestor::*)=1" > /«@name»
+            otherwise > «$parentpath»/«@name»
+        }
+        xsl:copy {
+            attrib "index" > «$index»
+            attrib "hmipath" > «$path»
+            foreach "@*" xsl:copy;
+        }
+        apply "*[1]", mode="index"{
+             with "index", "$index + 1";
+             with "parentpath" > «$path»
         }
     }
 
--- a/svghmi/parse_labels.ysl2	Mon Sep 30 16:21:11 2024 +0200
+++ b/svghmi/parse_labels.ysl2	Fri Oct 11 09:31:34 2024 +0200
@@ -99,8 +99,8 @@
             if "string-length(.) > 0" path {
                 // 1 : global match
                 // 2 : assign=
-                // 2 : /path
-                // 3 : min,max
+                // 3 : /path
+                // 4 : min,max
                 const "path_match", "regexp:match(.,$pathregex)";
                 const "pathassign", "substring-before($path_match[2],'=')";
                 const "pathminmax", "str:split($path_match[4],',')";
--- a/svghmi/widgets_common.ysl2	Mon Sep 30 16:21:11 2024 +0200
+++ b/svghmi/widgets_common.ysl2	Fri Oct 11 09:31:34 2024 +0200
@@ -348,7 +348,7 @@
             this.relativeness = undefined;
         }
 
-        sub(new_offset=0, relativeness, container_id){
+        sub(new_offset, relativeness, container_id){
             this.offset = new_offset;
             this.relativeness = relativeness;
             this.container_id = container_id ;