Fixed "Onchange" object added in previous commit svghmi
authorEdouard Tisserant
Thu, 10 Dec 2020 14:54:42 +0100
branchsvghmi
changeset 3088 56453485c6ad
parent 3087 9b50ffe6264a
child 3089 10b2e620b57f
Fixed "Onchange" object added in previous commit
runtime/PLCObject.py
--- a/runtime/PLCObject.py	Thu Dec 10 11:37:27 2020 +0100
+++ b/runtime/PLCObject.py	Thu Dec 10 14:54:42 2020 +0100
@@ -362,12 +362,11 @@
 
         class OnChangeStateClass(object):
             def __getattr__(self, name):
-                res = object()
                 u = parent.python_runtime_vars["_"+name+"_unpack"]
-                res.count = parent.python_runtime_vars["_PyOnChangeCount_"+name].value
-                res.first = u(parent.python_runtime_vars["_PyOnChangeFirst_"+name])
-                res.last = u(parent.python_runtime_vars["_PyOnChangeLast_"+name])
-                return res
+                return type("changedesc",(),dict(
+                    count = parent.python_runtime_vars["_PyOnChangeCount_"+name].value,
+                    first = u(parent.python_runtime_vars["_PyOnChangeFirst_"+name]),
+                    last = u(parent.python_runtime_vars["_PyOnChangeLast_"+name])))
 
 
         self.python_runtime_vars.update({