ProjectController.py
changeset 2594 f1e182818434
parent 2521 48ebcbe7f19b
child 2596 779e8dbf1ee1
--- a/ProjectController.py	Thu Apr 11 13:45:27 2019 +0200
+++ b/ProjectController.py	Mon Apr 15 13:34:09 2019 +0200
@@ -1422,6 +1422,7 @@
         "_Stop": False,
         "_Transfer": False,
         "_Connect": True,
+        "_Repair": False,
         "_Disconnect": False
     }
 
@@ -1438,6 +1439,7 @@
                                  "_Connect": False,
                                  "_Disconnect": True},
         PlcStatus.Broken:       {"_Connect": False,
+                                 "_Repair": True,
                                  "_Disconnect": True},
         PlcStatus.Disconnected: {},
     }
@@ -1913,6 +1915,17 @@
 
         wx.CallAfter(self.UpdateMethodsFromPLCStatus)
 
+    def _Repair(self):
+        dialog = wx.MessageDialog(
+            self.AppFrame,
+            _('Delete target PLC application?'),
+            _('Repair'),
+            wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
+        answer = dialog.ShowModal()
+        dialog.Destroy()
+        if answer == wx.ID_YES:
+            self._connector.PurgePLC()
+
     StatusMethods = [
         {
             "bitmap":    "Build",
@@ -1955,6 +1968,13 @@
             "shown":      False,
         },
         {
+            "bitmap":    "Repair",
+            "name":    _("Repair"),
+            "tooltip": _("Repair broken PLC"),
+            "method":   "_Repair",
+            "shown":      False,
+        },
+        {
             "bitmap":    "Disconnect",
             "name":    _("Disconnect"),
             "tooltip": _("Disconnect from PLC"),