author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Fri, 17 Jul 2020 12:19:53 +0200 | |
branch | svghmi |
changeset 2995 | 7769e7c7f925 |
parent 2994 | b6a9ef7f7e43 |
child 2996 | 14635b09d329 |
permissions | -rw-r--r-- |
2983
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
1 |
<?xml version='1.0' encoding='utf-8'?> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
2 |
<PyFile xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
3 |
<variables> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
4 |
<variable name="SomePLCglobal" type="HMI_STRING" onchange="MyOnChangeFunc"/> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
5 |
</variables> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
6 |
<globals> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
7 |
<xhtml:p><![CDATA[ |
2994
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
8 |
from twisted.web.resource import Resource |
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
9 |
|
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
10 |
class AlarmJsonResource(Resource): |
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
11 |
def render_GET(self, request): |
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
12 |
return '' |
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
13 |
|
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
14 |
def render_POST(self, request): |
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
15 |
print(request.__dict__) |
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
16 |
newdata = request.content.getvalue() |
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
17 |
print newdata |
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
18 |
return '' |
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
19 |
|
2983
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
20 |
|
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
21 |
def MyOnChangeFunc(changed_var_name): |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
22 |
print changed_var_name + ": " + getattr(PLCGlobals, changed_var_name) |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
23 |
|
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
24 |
]]></xhtml:p> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
25 |
</globals> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
26 |
<init> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
27 |
<xhtml:p><![CDATA[ |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
28 |
]]></xhtml:p> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
29 |
</init> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
30 |
<cleanup> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
31 |
<xhtml:p><![CDATA[ |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
32 |
]]></xhtml:p> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
33 |
</cleanup> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
34 |
<start> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
35 |
<xhtml:p><![CDATA[ |
2994
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
36 |
|
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
37 |
svghmi_root.putChild("alarms", AlarmJsonResource()) |
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
38 |
|
b6a9ef7f7e43
SVGHMI: minimal JSON Table Widget communication infra + corresponding python code as py_ext code in svghmi test. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2983
diff
changeset
|
39 |
|
2983
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
40 |
]]></xhtml:p> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
41 |
</start> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
42 |
<stop> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
43 |
<xhtml:p><![CDATA[ |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
44 |
]]></xhtml:p> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
45 |
</stop> |
43198edb6ac0
SVGHMI: Add use of Python PLC Globals it test
Edouard Tisserant
parents:
diff
changeset
|
46 |
</PyFile> |