# HG changeset patch # User Edouard Tisserant # Date 1728635655 -7200 # Node ID a3cf9f635952bdc3010f734ac79cfa432c62fff3 # Parent 92b3701fceed50fbffba2b408bed917cdf7fc512 SVGHMI: add ForEach widget example diff -r 92b3701fceed -r a3cf9f635952 exemples/svghmi_foreach/beremiz.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_foreach/beremiz.xml Fri Oct 11 10:34:15 2024 +0200 @@ -0,0 +1,5 @@ + + + + + diff -r 92b3701fceed -r a3cf9f635952 exemples/svghmi_foreach/plc.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_foreach/plc.xml Fri Oct 11 10:34:15 2024 +0200 @@ -0,0 +1,430 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + 0 + + + + + + + '1' + + + + + + + 'B' + + + + + + + 'red' + + + + + + + 'three' + + + + + + + '4' + + + + + + + '5' + + + + + + + '6' + + + + + + + 'last' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + strout + + + + + + + strin + + + + + + + 'Pump ' + + + + + + + + + + + + + + + + + + diff -r 92b3701fceed -r a3cf9f635952 exemples/svghmi_foreach/py_ext_0@py_ext/baseconfnode.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_foreach/py_ext_0@py_ext/baseconfnode.xml Fri Oct 11 10:34:15 2024 +0200 @@ -0,0 +1,2 @@ + + diff -r 92b3701fceed -r a3cf9f635952 exemples/svghmi_foreach/py_ext_0@py_ext/pyfile.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_foreach/py_ext_0@py_ext/pyfile.xml Fri Oct 11 10:34:15 2024 +0200 @@ -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 92b3701fceed -r a3cf9f635952 exemples/svghmi_foreach/svghmi_0@svghmi/baseconfnode.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_foreach/svghmi_0@svghmi/baseconfnode.xml Fri Oct 11 10:34:15 2024 +0200 @@ -0,0 +1,2 @@ + + diff -r 92b3701fceed -r a3cf9f635952 exemples/svghmi_foreach/svghmi_0@svghmi/confnode.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_foreach/svghmi_0@svghmi/confnode.xml Fri Oct 11 10:34:15 2024 +0200 @@ -0,0 +1,2 @@ + + diff -r 92b3701fceed -r a3cf9f635952 exemples/svghmi_foreach/svghmi_0@svghmi/svghmi.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exemples/svghmi_foreach/svghmi_0@svghmi/svghmi.svg Fri Oct 11 10:34:15 2024 +0200 @@ -0,0 +1,1241 @@ + + + + + + + + image/svg+xml + + + + + + + + + + 8888 + + + + dhu + + + + plop + + + + mhoo + + + + yodl + + + + mhe + + + 8888 + + + + 8888 + + + + + 8888 + + + + 8888 + + + + 8888 + + + + + +1 + + + + -1 + + + + + + + + + Disabled + + + + Active + + + + Inactive + + + + + + + + + + + + + Home + + + + + ForEach 1 + + + + + ForEach 2 + + + + + position: %d + + + size: %d + + + range: %d + + + page_node: %s + + + + + + + + + String IN + String OUT + + ForEach widget example + TODO: Readme + + + 8888 + + + + dhu + + + + plop + + + + mhoo + + + + yodl + + + + mhe + + + 8888 + + + 8888 + + + + 8888 + + + + 8888 + + + + 8888 + + + + + +1 + + + + -1 + + + + + position: %d + + + size: %d + + + range: %d + + + page_node: %s + + + + + + + + + String IN + String OUT + ForEach2 + ForEach1 +