Added RepairPLC() to PLCObject. For now just calling PurgePLC and quit PLC runtime.
--- a/ProjectController.py Tue Apr 16 11:26:34 2019 +0200
+++ b/ProjectController.py Tue Apr 16 11:26:52 2019 +0200
@@ -1924,7 +1924,7 @@
answer = dialog.ShowModal()
dialog.Destroy()
if answer == wx.ID_YES:
- self._connector.PurgePLC()
+ self._connector.RepairPLC()
StatusMethods = [
{
--- a/runtime/PLCObject.py Tue Apr 16 11:26:34 2019 +0200
+++ b/runtime/PLCObject.py Tue Apr 16 11:26:52 2019 +0200
@@ -533,6 +533,10 @@
def _extra_files_log_path(self):
return os.path.join(self.workingdir, "extra_files.txt")
+ def RepairPLC(self):
+ self.PurgePLC()
+ MainWorker.quit()
+
@RunInMain
def PurgePLC(self):
@@ -542,16 +546,19 @@
if self.CurrentPLCFilename is not None \
else None
+ allfiles = [extra_files_log, old_PLC_filename, self._GetMD5FileName()]
+
try:
- os.remove(old_PLC_filename)
- for filename in open(extra_files_log, "rt").readlines() + [extra_files_log]:
- try:
- os.remove(os.path.join(self.workingdir, filename.strip()))
- except Exception:
- pass
+ allfiles.append(open(extra_files_log, "rt").readlines())
except Exception:
pass
+ for filename in allfiles:
+ try:
+ os.remove(os.path.join(self.workingdir, filename.strip()))
+ except Exception:
+ pass
+
self.PLCStatus = PlcStatus.Empty
# TODO: PLCObject restart