--- a/svghmi/gen_index_xhtml.xslt Thu Oct 22 22:44:29 2020 +0200
+++ b/svghmi/gen_index_xhtml.xslt Wed Oct 28 18:21:12 2020 +0200
@@ -3826,7 +3826,9 @@
<xsl:template mode="widget_class" match="widget[@type='JsonTable']">
<xsl:text>class JsonTableWidget extends Widget{
- <xsl:text> cache = [100,50];
+ <xsl:text> // arbitrary defaults to avoid missing entries in query + <xsl:text> cache = [0,100,50]; <xsl:text> do_http_request(...opt) {
@@ -3840,6 +3842,8 @@
<xsl:text> visible: this.visible,
+ <xsl:text> extra: this.cache.slice(4), @@ -4177,8 +4181,6 @@
<xsl:text> this.apply_hmi_value(3, this.visible);
- <xsl:text> console.log(range,position,jdata);
<xsl:apply-templates mode="json_table_render_except_comments" select="$data_elt">
<xsl:with-param name="expressions" select="$initexpr_ns"/>
<xsl:with-param name="widget_elts" select="$hmi_element/*[@inkscape:label = 'data']/descendant::svg:*"/>
--- a/svghmi/widget_jsontable.ysl2 Thu Oct 22 22:44:29 2020 +0200
+++ b/svghmi/widget_jsontable.ysl2 Wed Oct 28 18:21:12 2020 +0200
@@ -3,13 +3,15 @@
template "widget[@type='JsonTable']", mode="widget_class"
class JsonTableWidget extends Widget{
+ // arbitrary defaults to avoid missing entries in query do_http_request(...opt) {
+ extra: this.cache.slice(4), @@ -220,7 +222,6 @@
| this.apply_hmi_value(1, range);
| this.apply_hmi_value(2, position);
| this.apply_hmi_value(3, this.visible);
- | console.log(range,position,jdata);
apply "$data_elt", mode="json_table_render_except_comments" {
with "expressions","$initexpr_ns";
with "widget_elts","$hmi_element/*[@inkscape:label = 'data']/descendant::svg:*";
--- a/tests/svghmi/plc.xml Thu Oct 22 22:44:29 2020 +0200
+++ b/tests/svghmi/plc.xml Wed Oct 28 18:21:12 2020 +0200
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2019-08-06T14:23:42"/>
- <contentHeader name="Unnamed" modificationDateTime="2020-10-22T08:43:10">
+ <contentHeader name="Unnamed" modificationDateTime="2020-10-30T20:07:00"> --- a/tests/svghmi/py_ext_0@py_ext/pyfile.xml Thu Oct 22 22:44:29 2020 +0200
+++ b/tests/svghmi/py_ext_0@py_ext/pyfile.xml Wed Oct 28 18:21:12 2020 +0200
@@ -34,6 +34,7 @@
range_feedback = newdata[u'range']
slider_position = newdata[u'position']
visible = newdata[u'visible']
+ extra = newdata[u'extra'] options = newdata[u'options']
@@ -41,18 +42,22 @@
if action == "onClick[acknowledge]":
AlarmIndex[int(alarmid)][2] = "ack"
- answer = self.renderTable(range_feedback, slider_position, visible)
+ answer = self.renderTable(range_feedback, slider_position, visible, extra) janswer = json.dumps(answer)
- def renderTable(self, old_range, old_position, visible):
- new_range = len(Alarms)
+ def renderTable(self, old_range, old_position, visible, extra): + if len(extra) > 0 and extra[0] != "": + fAlarms = [alrm for alrm in Alarms if alrm[1].find(extra[0])!=-1] + new_range = len(fAlarms) delta = new_range - visible
new_position = 0 if delta <= 0 else delta if old_position > delta else old_position
new_visible = new_range if delta <= 0 else visible
- for ts, text, status, alarmid in Alarms[new_position:new_position + new_visible]:
+ for ts, text, status, alarmid in fAlarms[new_position:new_position + new_visible]: "text": text, # TODO translate text
--- a/tests/svghmi/svghmi_0@svghmi/svghmi.svg Thu Oct 22 22:44:29 2020 +0200
+++ b/tests/svghmi/svghmi_0@svghmi/svghmi.svg Wed Oct 28 18:21:12 2020 +0200
@@ -200,12 +200,12 @@
inkscape:current-layer="hmi0"
- inkscape:zoom="0.38583842"
- inkscape:cx="-56.535477"
- inkscape:cy="77.476632"
- inkscape:window-width="1920"
- inkscape:window-height="1043"
+ inkscape:zoom="1.5433537" + inkscape:cx="-705.74041" + inkscape:cy="175.04058" + inkscape:window-width="3840" + inkscape:window-height="2123" + inkscape:window-x="1600" inkscape:window-maximized="1"
@@ -5248,7 +5248,7 @@
style="fill:#ffffff;stroke-width:1px">Alarm Page</tspan></text>
- inkscape:label="HMI:JsonTable:/alarms@/ALARMNOTIFY@.range@.position"
+ inkscape:label="HMI:JsonTable:/alarms@/ALARMNOTIFY@.range@.position@.visibleAlarms@.filter" transform="matrix(0.5,0,0,0.5,-1757.3465,454.4367)">
@@ -5490,7 +5490,7 @@
inkscape:label="disabled" />
- transform="matrix(0.33436432,0,0,0.33436432,-664.21063,278.8185)"
+ transform="matrix(0.33436432,0,0,0.33436432,-584.21063,278.8185)" inkscape:label="HMI:Input@/ALARMNOTIFY"
style="stroke-width:0.75594342">
@@ -5695,7 +5695,7 @@
inkscape:label="disabled" />
- transform="matrix(0.33436432,0,0,0.33436432,-1128.7703,278.8185)"
+ transform="matrix(0.33436432,0,0,0.33436432,-1048.7703,278.8185)" inkscape:label="HMI:Input@.range"
style="stroke-width:0.75594342">
@@ -5757,7 +5757,7 @@
- transform="matrix(0.33436432,0,0,0.33436432,-896.49047,278.8185)"
+ transform="matrix(0.33436432,0,0,0.33436432,-816.49047,278.8185)" inkscape:label="HMI:Input@.position"
style="stroke-width:0.75594342">
@@ -5821,34 +5821,34 @@
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.45700645px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
style="fill:#ffffff;stroke-width:1px">range</tspan></text>
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.45700645px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="fill:#ffffff;stroke-width:1px"
sodipodi:role="line">position</tspan></text>
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.45700645px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
style="fill:#ffffff;stroke-width:1px">notify</tspan></text>
@@ -6100,4 +6100,45 @@
style="fill:#ffffff;fill-opacity:1;stroke-width:0.28590268px">8888</tspan></text>
+ style="stroke-width:0.75594342" + inkscape:label="HMI:Input@.filter" + transform="matrix(0.33436432,0,0,0.33436432,-1288.7703,278.8185)"> + style="font-style:normal;font-weight:normal;font-size:160px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.75594342px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + style="stroke-width:0.75594342px" + sodipodi:role="line">8888</tspan></text> + style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ff00ff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.77971721;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + inkscape:label="edit" /> + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:26.45700645px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + style="fill:#ffffff;stroke-width:1px" + sodipodi:role="line">filter</tspan></text> + inkscape:label="HMI:VarInit:""@.filter" />