SVGHMI: remove "value" element in meter and circularbar widget. Adding support for printf like formating make widget label too heavy. It is better to use Display widget instead.
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Mon, 04 Oct 2021 07:41:18 +0200
changeset 3361 d955f2a3fabf
parent 3360 746e3e3f6537
child 3362 abcdbef160e9
SVGHMI: remove "value" element in meter and circularbar widget. Adding support for printf like formating make widget label too heavy. It is better to use Display widget instead.
svghmi/widget_circularbar.ysl2
svghmi/widget_meter.ysl2
--- a/svghmi/widget_circularbar.ysl2	Mon Oct 04 07:38:46 2021 +0200
+++ b/svghmi/widget_circularbar.ysl2	Mon Oct 04 07:41:18 2021 +0200
@@ -9,14 +9,12 @@
     If "min" a "max" labeled texts are provided, then they are used as
     respective minimum and maximum value. Otherwise, value is expected to be
     in between 0 and 100.
-
-    If "value" labeled text is found, then its content is replaced by value.
     ||
 
     shortdesc > Change end angle of Inkscape's arc
 
-    // TODO: add min/max arguments
-    // TODO: add printf-like format
+    arg name="min" count="optional" accepts="int,real" > minimum value
+    arg name="max" count="optional" accepts="int,real" > maximum value
 
     path name="value" accepts="HMI_INT,HMI_REAL" > Value to display
     
@@ -52,6 +50,9 @@
         }
 
         init() {
+            if(this.args.length >= 2)
+                [this.min, this.max]=this.args;
+
             let [start, end, cx, cy, rx, ry] = ["start", "end", "cx", "cy", "rx", "ry"].
                 map(tag=>Number(this.path_elt.getAttribute('sodipodi:'+tag)))
 
@@ -74,5 +75,5 @@
 
 widget_defs("CircularBar") {
     labels("path");
-    optional_labels("value min max");
+    optional_labels("min max");
 }
--- a/svghmi/widget_meter.ysl2	Mon Oct 04 07:38:46 2021 +0200
+++ b/svghmi/widget_meter.ysl2	Mon Oct 04 07:41:18 2021 +0200
@@ -10,8 +10,6 @@
     are provided, or if first and second argument are given, then they are used
     as respective minimum and maximum value. Otherwise, value is expected to be
     in between 0 and 100.
-
-    If "value" labeled text is found, then its content is replaced by value.
     ||
 
     shortdesc > Moves "needle" along "range"
@@ -20,8 +18,6 @@
 
     arg name="max" count="optional" accepts="int,real" > maximum value
 
-    // TODO: add printf-like format
-
     path name="value" accepts="HMI_INT,HMI_REAL" > Value to display
     
 }
@@ -59,7 +55,7 @@
 
 widget_defs("Meter") {
     labels("needle range");
-    optional_labels("value min max");
+    optional_labels("min max");
 }