# HG changeset patch # User Edouard Tisserant # Date 1613725457 -3600 # Node ID 6712834045548dc762b92ca67107f5d2db6cd16c # Parent c80a5a7198ea17eb5c4f2260c49a66133122ebbb Allow printf-like formating in HMI:Input, usefull for example when dealing with floating point numbers. diff -r c80a5a7198ea -r 671283404554 svghmi/widget_input.ysl2 --- a/svghmi/widget_input.ysl2 Fri Feb 19 10:03:00 2021 +0100 +++ b/svghmi/widget_input.ysl2 Fri Feb 19 10:04:17 2021 +0100 @@ -45,7 +45,14 @@ | this.last_val = value; if "$have_value" { + choose{ + when "count(arg) = 1" { + | this.last_display = vsprintf("«arg[1]/@value»", value); + } + otherwise { | this.last_display = value; + } + } | this.request_animate(); } | }, @@ -60,6 +67,9 @@ if "$have_edit" { | this.edit_elt.onclick = () => edit_value("«path/@value»", "«path/@type»", this, this.last_val); + if "$have_value" { + | this.value_elt.style.pointerEvents = "none"; + } } foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-].+')]" { diff -r c80a5a7198ea -r 671283404554 tests/svghmi_real/svghmi_0@svghmi/svghmi.svg --- a/tests/svghmi_real/svghmi_0@svghmi/svghmi.svg Fri Feb 19 10:03:00 2021 +0100 +++ b/tests/svghmi_real/svghmi_0@svghmi/svghmi.svg Fri Feb 19 10:04:17 2021 +0100 @@ -60,11 +60,11 @@ showgrid="false" units="px" inkscape:zoom="0.64" - inkscape:cx="544.00649" - inkscape:cy="385.16049" + inkscape:cx="106.50649" + inkscape:cy="372.66049" inkscape:window-width="1600" inkscape:window-height="836" - inkscape:window-x="0" + inkscape:window-x="1600" inkscape:window-y="27" inkscape:window-maximized="0" showguides="true" @@ -380,7 +380,7 @@ sodipodi:insensitive="true" />