Merge commit '80e123b34e488ffea851dc2168b366ba6124c09b' into python3
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Fri, 05 Apr 2024 14:59:00 +0200
changeset 3930 1cb8f90bf4fd
parent 3929 1a0bed0b4f1c (current diff)
parent 3928 5c662d2e3f72 (diff)
child 3931 1c0263e2b3b1
Merge commit '80e123b34e488ffea851dc2168b366ba6124c09b' into python3
--- a/svghmi/analyse_widget.xslt	Fri Apr 05 14:55:58 2024 +0200
+++ b/svghmi/analyse_widget.xslt	Fri Apr 05 14:59:00 2024 +0200
@@ -875,10 +875,6 @@
 </xsl:text>
       <xsl:text>
 </xsl:text>
-      <xsl:text>"active"+"inactive" labeled elements can be provided to show feedback when pressed
-</xsl:text>
-      <xsl:text>
-</xsl:text>
       <xsl:text>Exemples:
 </xsl:text>
       <xsl:text>
--- a/svghmi/gen_index_xhtml.xslt	Fri Apr 05 14:55:58 2024 +0200
+++ b/svghmi/gen_index_xhtml.xslt	Fri Apr 05 14:59:00 2024 +0200
@@ -2908,7 +2908,7 @@
           </xsl:if>
         </xsl:for-each>
       </xsl:variable>
-      <xsl:variable name="isVarName" select="regexp:test($value,'^[a-zA-Z_][a-zA-Z0-9_]+$')"/>
+      <xsl:variable name="isVarName" select="regexp:test($value,'^[a-zA-Z_][a-zA-Z0-9_]*$')"/>
       <xsl:choose>
         <xsl:when test="$isVarName">
           <xsl:text>        const </xsl:text>
@@ -3306,6 +3306,34 @@
     <xsl:text>,
 </xsl:text>
   </xsl:template>
+  <xsl:template match="widget[@type='FlatButton']" mode="widget_class">
+    <xsl:text>class </xsl:text>
+    <xsl:text>FlatButtonWidget</xsl:text>
+    <xsl:text> extends Widget{
+</xsl:text>
+    <xsl:text>    frequency = 5;
+</xsl:text>
+    <xsl:variable name="fsm" select="exsl:node-set($_button_fsm)"/>
+    <xsl:call-template name="generated_button_class">
+      <xsl:with-param name="fsm" select="$fsm"/>
+    </xsl:call-template>
+    <xsl:text>}
+</xsl:text>
+  </xsl:template>
+  <xsl:template match="widget[@type='FlatButton']" mode="widget_defs">
+    <xsl:param name="hmi_element"/>
+    <xsl:variable name="disability">
+      <xsl:call-template name="defs_by_labels">
+        <xsl:with-param name="hmi_element" select="$hmi_element"/>
+        <xsl:with-param name="labels">
+          <xsl:text>/disabled</xsl:text>
+        </xsl:with-param>
+        <xsl:with-param name="mandatory" select="'no'"/>
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:value-of select="$disability"/>
+    <xsl:variable name="has_disability" select="string-length($disability)&gt;0"/>
+  </xsl:template>
   <xsl:template match="widget[@type='PushButton']" mode="widget_class">
     <xsl:text>class </xsl:text>
     <xsl:text>PushButtonWidget</xsl:text>
@@ -7250,10 +7278,6 @@
 </xsl:text>
       <xsl:text>
 </xsl:text>
-      <xsl:text>"active"+"inactive" labeled elements can be provided to show feedback when pressed
-</xsl:text>
-      <xsl:text>
-</xsl:text>
       <xsl:text>Exemples:
 </xsl:text>
       <xsl:text>
--- a/svghmi/widget_assign.ysl2	Fri Apr 05 14:55:58 2024 +0200
+++ b/svghmi/widget_assign.ysl2	Fri Apr 05 14:59:00 2024 +0200
@@ -71,7 +71,7 @@
         const "name","substring-before(@value,'=')";
         const "value","substring-after(@value,'=')";
         const "index" foreach "$paths" if "@assign = $name" value "position()-1";
-        const "isVarName", "regexp:test($value,'^[a-zA-Z_][a-zA-Z0-9_]+$')";
+        const "isVarName", "regexp:test($value,'^[a-zA-Z_][a-zA-Z0-9_]*$')";
         choose {
             when "$isVarName"{
     |         const «$value» = this.assignments["«$value»"];
--- a/svghmi/widget_button.ysl2	Fri Apr 05 14:55:58 2024 +0200
+++ b/svghmi/widget_button.ysl2	Fri Apr 05 14:59:00 2024 +0200
@@ -199,6 +199,16 @@
     activable();
 }
 
+// FlatButton is same as Button, but it has no active/inactive elements
+// and doesn't reflect current state
+widget_class("FlatButton"){
+    |     frequency = 5;
+    const "fsm","exsl:node-set($_button_fsm)";
+    call "generated_button_class" with "fsm", "$fsm";
+}
+
+widget_defs("FlatButton");
+
 widget_class("PushButton"){
     |     frequency = 20;
     const "fsm","exsl:node-set($_push_button_fsm)";
--- a/svghmi/widget_page.ysl2	Fri Apr 05 14:55:58 2024 +0200
+++ b/svghmi/widget_page.ysl2	Fri Apr 05 14:59:00 2024 +0200
@@ -11,8 +11,6 @@
     - name=value: setting variable with literal value.
     - name=other_name: copy variable content into another
 
-    "active"+"inactive" labeled elements can be provided to show feedback when pressed
-
     Exemples:
 
     HMI:Page:notify=1@notify=/PLCVAR