runtime/PLCObject.py
changeset 1035 0f905e027d18
parent 1027 4e44c2c3e081
child 1045 a220a27defe5
equal deleted inserted replaced
1034:078bf153fb8c 1035:0f905e027d18
   194             self._GetLogMessage = self.PLClibraryHandle.GetLogMessage
   194             self._GetLogMessage = self.PLClibraryHandle.GetLogMessage
   195             self._GetLogMessage.restype = ctypes.c_uint32
   195             self._GetLogMessage.restype = ctypes.c_uint32
   196             self._GetLogMessage.argtypes = [ctypes.c_uint8, ctypes.c_uint32, ctypes.c_char_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)]
   196             self._GetLogMessage.argtypes = [ctypes.c_uint8, ctypes.c_uint32, ctypes.c_char_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)]
   197 
   197 
   198             self._loading_error = None
   198             self._loading_error = None
       
   199 
       
   200             self.PythonRuntimeInit()
       
   201 
   199             return True
   202             return True
   200         except:
   203         except:
   201             self._loading_error = traceback.format_exc()
   204             self._loading_error = traceback.format_exc()
   202             PLCprint(self._loading_error)
   205             PLCprint(self._loading_error)
   203             return False
   206             return False
   400                 PLCprint(traceback.format_exc())
   403                 PLCprint(traceback.format_exc())
   401                 return False
   404                 return False
   402 
   405 
   403             if self.LoadPLC():
   406             if self.LoadPLC():
   404                 self.PLCStatus = "Stopped"
   407                 self.PLCStatus = "Stopped"
   405                 try:
       
   406                     self.PythonRuntimeInit()
       
   407                 except:
       
   408                     self.PLCStatus = "Broken"
       
   409             else:
   408             else:
       
   409                 self.PLCStatus = "Broken"
   410                 self._FreePLC()
   410                 self._FreePLC()
   411             self.StatusChange()
   411             self.StatusChange()
   412 
   412 
   413             return self.PLCStatus == "Stopped"
   413             return self.PLCStatus == "Stopped"
   414         return False
   414         return False