runtime/PLCObject.py
changeset 1027 4e44c2c3e081
parent 1014 e2f7d6c95db0
child 1035 0f905e027d18
equal deleted inserted replaced
1026:96a2dc05651a 1027:4e44c2c3e081
   120 
   120 
   121     def _GetLibFileName(self):
   121     def _GetLibFileName(self):
   122         return os.path.join(self.workingdir,self.CurrentPLCFilename)
   122         return os.path.join(self.workingdir,self.CurrentPLCFilename)
   123 
   123 
   124 
   124 
   125     def _LoadNewPLC(self):
   125     def LoadPLC(self):
   126         """
   126         """
   127         Load PLC library
   127         Load PLC library
   128         Declare all functions, arguments and return values
   128         Declare all functions, arguments and return values
   129         """
   129         """
   130         try:
   130         try:
   207         Unload PLC library.
   207         Unload PLC library.
   208         This is also called by __init__ to create dummy C func proxies
   208         This is also called by __init__ to create dummy C func proxies
   209         """
   209         """
   210         self.PLClibraryLock.acquire()
   210         self.PLClibraryLock.acquire()
   211         # Forget all refs to library
   211         # Forget all refs to library
   212         self._startPLC = lambda:None
   212         self._startPLC = lambda x,y:None
   213         self._stopPLC = lambda:None
   213         self._stopPLC = lambda:None
   214         self._ResetDebugVariables = lambda:None
   214         self._ResetDebugVariables = lambda:None
   215         self._RegisterDebugVariable = lambda x, y:None
   215         self._RegisterDebugVariable = lambda x, y:None
   216         self._IterDebugData = lambda x,y:None
   216         self._IterDebugData = lambda x,y:None
   217         self._FreeDebugData = lambda:None
   217         self._FreeDebugData = lambda:None
   398                 self.PLCStatus = "Broken"
   398                 self.PLCStatus = "Broken"
   399                 self.StatusChange()
   399                 self.StatusChange()
   400                 PLCprint(traceback.format_exc())
   400                 PLCprint(traceback.format_exc())
   401                 return False
   401                 return False
   402 
   402 
   403             if self._LoadNewPLC():
   403             if self.LoadPLC():
   404                 self.PLCStatus = "Stopped"
   404                 self.PLCStatus = "Stopped"
   405                 try:
   405                 try:
   406                     self.PythonRuntimeInit()
   406                     self.PythonRuntimeInit()
   407                 except:
   407                 except:
   408                     self.PLCStatus = "Broken"
   408                     self.PLCStatus = "Broken"