runtime/PLCObject.py
changeset 1045 a220a27defe5
parent 1035 0f905e027d18
child 1051 847d68c3e7ff
equal deleted inserted replaced
1044:41bd726aa23c 1045:a220a27defe5
   202             return True
   202             return True
   203         except:
   203         except:
   204             self._loading_error = traceback.format_exc()
   204             self._loading_error = traceback.format_exc()
   205             PLCprint(self._loading_error)
   205             PLCprint(self._loading_error)
   206             return False
   206             return False
       
   207 
       
   208     def UnLoadPLC(self):
       
   209         self.PythonRuntimeCleanup()
       
   210         self._FreePLC()
   207 
   211 
   208     def _FreePLC(self):
   212     def _FreePLC(self):
   209         """
   213         """
   210         Unload PLC library.
   214         Unload PLC library.
   211         This is also called by __init__ to create dummy C func proxies
   215         This is also called by __init__ to create dummy C func proxies
   361     def NewPLC(self, md5sum, data, extrafiles):
   365     def NewPLC(self, md5sum, data, extrafiles):
   362         if self.PLCStatus in ["Stopped", "Empty", "Broken"]:
   366         if self.PLCStatus in ["Stopped", "Empty", "Broken"]:
   363             NewFileName = md5sum + lib_ext
   367             NewFileName = md5sum + lib_ext
   364             extra_files_log = os.path.join(self.workingdir,"extra_files.txt")
   368             extra_files_log = os.path.join(self.workingdir,"extra_files.txt")
   365 
   369 
   366             self.PythonRuntimeCleanup()
   370             self.UnLoadPLC()
   367 
   371 
   368             self._FreePLC()
       
   369             self.LogMessage("NewPLC (%s)"%md5sum)
   372             self.LogMessage("NewPLC (%s)"%md5sum)
   370             self.PLCStatus = "Empty"
   373             self.PLCStatus = "Empty"
   371 
   374 
   372             try:
   375             try:
   373                 os.remove(os.path.join(self.workingdir,
   376                 os.remove(os.path.join(self.workingdir,