tests/svghmi/py_ext_0@py_ext/pyfile.xml
author Edouard Tisserant <edouard.tisserant@gmail.com>
Fri, 17 Jul 2020 12:19:53 +0200
branchsvghmi
changeset 2995 7769e7c7f925
parent 2994 b6a9ef7f7e43
child 2996 14635b09d329
permissions -rw-r--r--
SVGHMI: Minimal support for HMI:List : clones pointing to elements of any HMI:List are never unlinked, widgets using HMI:List will rely on this.
<?xml version='1.0' encoding='utf-8'?>
<PyFile xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <variables>
    <variable name="SomePLCglobal" type="HMI_STRING" onchange="MyOnChangeFunc"/>
  </variables>
  <globals>
    <xhtml:p><![CDATA[
from twisted.web.resource import Resource

class AlarmJsonResource(Resource):
    def render_GET(self, request):
        return ''

    def render_POST(self, request):
        print(request.__dict__)
        newdata = request.content.getvalue()
        print newdata
        return ''


def MyOnChangeFunc(changed_var_name):
    print changed_var_name + ": " + getattr(PLCGlobals, changed_var_name)

]]></xhtml:p>
  </globals>
  <init>
    <xhtml:p><![CDATA[
]]></xhtml:p>
  </init>
  <cleanup>
    <xhtml:p><![CDATA[
]]></xhtml:p>
  </cleanup>
  <start>
    <xhtml:p><![CDATA[

svghmi_root.putChild("alarms", AlarmJsonResource())


]]></xhtml:p>
  </start>
  <stop>
    <xhtml:p><![CDATA[
]]></xhtml:p>
  </stop>
</PyFile>