# HG changeset patch # User Edouard Tisserant # Date 1711469426 -3600 # Node ID abaa68df90f49972656320a8c4bd7c9a88680f80 # Parent 77a1846390ef1aa1eae3adb0b65b577d376582f0 Examples: add svghmi_json_table diff -r 77a1846390ef -r abaa68df90f4 exemples/svghmi_json_table/beremiz.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_json_table/beremiz.xml Tue Mar 26 17:10:26 2024 +0100 @@ -0,0 +1,5 @@ + + + + + diff -r 77a1846390ef -r abaa68df90f4 exemples/svghmi_json_table/plc.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_json_table/plc.xml Tue Mar 26 17:10:26 2024 +0100 @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LocalVar0 + + + + + + + + + + + LocalVar1 + + + + + + + + + + + + + + + + + + diff -r 77a1846390ef -r abaa68df90f4 exemples/svghmi_json_table/py_ext_0@py_ext/baseconfnode.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_json_table/py_ext_0@py_ext/baseconfnode.xml Tue Mar 26 17:10:26 2024 +0100 @@ -0,0 +1,2 @@ + + diff -r 77a1846390ef -r abaa68df90f4 exemples/svghmi_json_table/py_ext_0@py_ext/pyfile.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_json_table/py_ext_0@py_ext/pyfile.xml Tue Mar 26 17:10:26 2024 +0100 @@ -0,0 +1,99 @@ + + + + + + + + + + 0 and extra[0] != "": + fAlarms = [alrm for alrm in Alarms if alrm[1].find(extra[0])!=-1] + else: + fAlarms = Alarms[:] + fAlarms.reverse() + 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 + + visible_alarms = [] + for ts, text, status, alarmid in fAlarms[new_position:new_position + new_visible]: + visible_alarms.append({ + "time": time.ctime(ts), + "text": text, # TODO translate text + "status": status, + "alarmid": alarmid + }) + + return new_range, new_position, visible_alarms + + +]]> + + + + + + + + + + + + + + diff -r 77a1846390ef -r abaa68df90f4 exemples/svghmi_json_table/svghmi_0@svghmi/baseconfnode.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_json_table/svghmi_0@svghmi/baseconfnode.xml Tue Mar 26 17:10:26 2024 +0100 @@ -0,0 +1,2 @@ + + diff -r 77a1846390ef -r abaa68df90f4 exemples/svghmi_json_table/svghmi_0@svghmi/confnode.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_json_table/svghmi_0@svghmi/confnode.xml Tue Mar 26 17:10:26 2024 +0100 @@ -0,0 +1,2 @@ + + diff -r 77a1846390ef -r abaa68df90f4 exemples/svghmi_json_table/svghmi_0@svghmi/svghmi.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_json_table/svghmi_0@svghmi/svghmi.svg Tue Mar 26 17:10:26 2024 +0100 @@ -0,0 +1,2316 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + number + + + + + + + + 7 + + + + 4 + + + + 1 + + + + 8 + + + + 5 + + + + 2 + + + + 9 + + + + 6 + + + + 3 + + + + 0 + + + + + Esc + + + + + + + + +/- + + information + + + . + + + + + + + + + Q + + + + W + + + + E + + + + R + + + + T + + + + Y + + + + U + + + + I + + + + O + + + + P + + + + A + + + + S + + + + D + + + + F + + + + G + + + + H + + + + J + + + + K + + + + L + + + + Z + + + + X + + + + C + + + + V + + + + B + + + + N + + + + M + + + + . + : + + + + ; + , + + + + 1 + + + + 2 + + + + 3 + + + + 4 + + + + 5 + + + + 6 + + + + 7 + + + + 8 + + + + 9 + - + + + + 0 + + + + + + + Esc + + + + + + + + + + + + + Caps + Lock + + + + Caps + Lock + + + + text + + + + Shift + + Shift + + + + Shift + + Shift + + + information + + + + + + + + + + + + + + + + + + + + + value + value + value + value + + Lists of items and stylesHMI:List and HMI:TextSyleList + + + + + + + + + + + + + + + + + + + + + + + + + + + + reset + + + + + 8888 + + + + + + 8888 + + + + + + 8888 + + + + + + + 8888 + + + + + + + + trigger + + + + + 8888 + + + ack + + + + disabled + + + + active + + + + alarm + + + + + blah + + + + + HMI:JsonTable + range + position + notify + Alarm Text + Status + filter + In this example, JsonTable widget is used as a list of alarms.JSON data is exchanged with python code in py_ext_0 using HTTP POST + + + + + + HMI:JsonTable + + + HMI:Input that increments /SENDALARM +In py_ext_0, SendAlarm variable has "OnChange" attribute set to callTriggerAlarm() + + +