runtime/PLCObject.py
changeset 1144 21475ee0e688
parent 1132 28f96aa9c070
child 1145 203f4eff3313
equal deleted inserted replaced
1143:59818c488ead 1144:21475ee0e688
   262         self.python_runtime_vars["website"] = self.website
   262         self.python_runtime_vars["website"] = self.website
   263         for methodname in MethodNames :
   263         for methodname in MethodNames :
   264             self.python_runtime_vars["_runtime_%s"%methodname] = []
   264             self.python_runtime_vars["_runtime_%s"%methodname] = []
   265         self.python_runtime_vars["PLCObject"] = self
   265         self.python_runtime_vars["PLCObject"] = self
   266         self.python_runtime_vars["PLCBinary"] = self.PLClibraryHandle
   266         self.python_runtime_vars["PLCBinary"] = self.PLClibraryHandle
       
   267         class PLCSafeGlobals:
       
   268             def __getattr__(self, name):
       
   269                 r = globals()["_PySafeGetPLCGlob_"+name]()
       
   270                 return globals()["_"+name+"_unpack"](r)
       
   271             def __setattr__(self, name, value):
       
   272                 v = globals()["_"+name+"_pack"](c_type,value)
       
   273                 globals()["_PySafeSetPLCGlob_"+name](ctypes.byref(v))
       
   274         self.python_runtime_vars["PLCGlobals"] = PLCSafeGlobals()
   267         try:
   275         try:
   268             for filename in os.listdir(self.workingdir):
   276             for filename in os.listdir(self.workingdir):
   269                 name, ext = os.path.splitext(filename)
   277                 name, ext = os.path.splitext(filename)
   270                 if name.upper().startswith("RUNTIME") and ext.upper() == ".PY":
   278                 if name.upper().startswith("RUNTIME") and ext.upper() == ".PY":
   271                     execfile(os.path.join(self.workingdir, filename), self.python_runtime_vars)
   279                     execfile(os.path.join(self.workingdir, filename), self.python_runtime_vars)