runtime/PLCObject.py
changeset 1750 acf02488f37f
parent 1749 d73b64672238
child 1760 ed2e2afb9573
equal deleted inserted replaced
1749:d73b64672238 1750:acf02488f37f
   169                 self._stopPLC = self._stopPLC_real
   169                 self._stopPLC = self._stopPLC_real
   170             else:
   170             else:
   171                 # If python confnode is not enabled, we reuse _PythonIterator
   171                 # If python confnode is not enabled, we reuse _PythonIterator
   172                 # as a call that block pythonthread until StopPLC
   172                 # as a call that block pythonthread until StopPLC
   173                 self.PlcStopping = Event()
   173                 self.PlcStopping = Event()
       
   174 
   174                 def PythonIterator(res, blkid):
   175                 def PythonIterator(res, blkid):
   175                     self.PlcStopping.clear()
   176                     self.PlcStopping.clear()
   176                     self.PlcStopping.wait()
   177                     self.PlcStopping.wait()
   177                     return None
   178                     return None
   178                 self._PythonIterator = PythonIterator
   179                 self._PythonIterator = PythonIterator
   284                 except KeyError:
   285                 except KeyError:
   285                     raise KeyError("Try to get unknown shared global variable : %s" % name)
   286                     raise KeyError("Try to get unknown shared global variable : %s" % name)
   286                 v = t()
   287                 v = t()
   287                 r = self.python_runtime_vars["_PySafeGetPLCGlob_"+name](ctypes.byref(v))
   288                 r = self.python_runtime_vars["_PySafeGetPLCGlob_"+name](ctypes.byref(v))
   288                 return self.python_runtime_vars["_"+name+"_unpack"](v)
   289                 return self.python_runtime_vars["_"+name+"_unpack"](v)
       
   290 
   289             def __setattr__(_self, name, value):
   291             def __setattr__(_self, name, value):
   290                 try:
   292                 try:
   291                     t = self.python_runtime_vars["_"+name+"_ctype"]
   293                     t = self.python_runtime_vars["_"+name+"_ctype"]
   292                 except KeyError:
   294                 except KeyError:
   293                     raise KeyError("Try to set unknown shared global variable : %s" % name)
   295                     raise KeyError("Try to set unknown shared global variable : %s" % name)