runtime/PLCObject.py
changeset 2698 e50d32c747b3
parent 2697 93333d206198
child 2702 f0a70f0246da
equal deleted inserted replaced
2697:93333d206198 2698:e50d32c747b3
   360                 v = parent.python_runtime_vars["_"+name+"_pack"](t, value)
   360                 v = parent.python_runtime_vars["_"+name+"_pack"](t, value)
   361                 parent.python_runtime_vars["_PySafeSetPLCGlob_"+name](ctypes.byref(v))
   361                 parent.python_runtime_vars["_PySafeSetPLCGlob_"+name](ctypes.byref(v))
   362 
   362 
   363         class OnChangeStateClass(object):
   363         class OnChangeStateClass(object):
   364             def __getattr__(self, name):
   364             def __getattr__(self, name):
   365                 res = object()
       
   366                 u = parent.python_runtime_vars["_"+name+"_unpack"]
   365                 u = parent.python_runtime_vars["_"+name+"_unpack"]
   367                 res.count = parent.python_runtime_vars["_PyOnChangeCount_"+name].value
   366                 return type("changedesc",(),dict(
   368                 res.first = u(parent.python_runtime_vars["_PyOnChangeFirst_"+name])
   367                     count = parent.python_runtime_vars["_PyOnChangeCount_"+name].value,
   369                 res.last = u(parent.python_runtime_vars["_PyOnChangeLast_"+name])
   368                     first = u(parent.python_runtime_vars["_PyOnChangeFirst_"+name]),
   370                 return res
   369                     last = u(parent.python_runtime_vars["_PyOnChangeLast_"+name])))
   371 
   370 
   372 
   371 
   373         self.python_runtime_vars.update({
   372         self.python_runtime_vars.update({
   374             "PLCGlobals":     PLCSafeGlobals(),
   373             "PLCGlobals":     PLCSafeGlobals(),
   375             "OnChange":       OnChangeStateClass(),
   374             "OnChange":       OnChangeStateClass(),