equal
deleted
inserted
replaced
1420 DefaultMethods = { |
1420 DefaultMethods = { |
1421 "_Run": False, |
1421 "_Run": False, |
1422 "_Stop": False, |
1422 "_Stop": False, |
1423 "_Transfer": False, |
1423 "_Transfer": False, |
1424 "_Connect": True, |
1424 "_Connect": True, |
|
1425 "_Repair": False, |
1425 "_Disconnect": False |
1426 "_Disconnect": False |
1426 } |
1427 } |
1427 |
1428 |
1428 MethodsFromStatus = { |
1429 MethodsFromStatus = { |
1429 PlcStatus.Started: {"_Stop": True, |
1430 PlcStatus.Started: {"_Stop": True, |
1436 "_Disconnect": True}, |
1437 "_Disconnect": True}, |
1437 PlcStatus.Empty: {"_Transfer": True, |
1438 PlcStatus.Empty: {"_Transfer": True, |
1438 "_Connect": False, |
1439 "_Connect": False, |
1439 "_Disconnect": True}, |
1440 "_Disconnect": True}, |
1440 PlcStatus.Broken: {"_Connect": False, |
1441 PlcStatus.Broken: {"_Connect": False, |
|
1442 "_Repair": True, |
1441 "_Disconnect": True}, |
1443 "_Disconnect": True}, |
1442 PlcStatus.Disconnected: {}, |
1444 PlcStatus.Disconnected: {}, |
1443 } |
1445 } |
1444 |
1446 |
1445 def UpdateMethodsFromPLCStatus(self): |
1447 def UpdateMethodsFromPLCStatus(self): |
1910 self.logger.write_error(_("Missing debug data\n")) |
1912 self.logger.write_error(_("Missing debug data\n")) |
1911 else: |
1913 else: |
1912 self.logger.write_error(_("PLC couldn't be installed\n")) |
1914 self.logger.write_error(_("PLC couldn't be installed\n")) |
1913 |
1915 |
1914 wx.CallAfter(self.UpdateMethodsFromPLCStatus) |
1916 wx.CallAfter(self.UpdateMethodsFromPLCStatus) |
|
1917 |
|
1918 def _Repair(self): |
|
1919 dialog = wx.MessageDialog( |
|
1920 self.AppFrame, |
|
1921 _('Delete target PLC application?'), |
|
1922 _('Repair'), |
|
1923 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) |
|
1924 answer = dialog.ShowModal() |
|
1925 dialog.Destroy() |
|
1926 if answer == wx.ID_YES: |
|
1927 self._connector.PurgePLC() |
1915 |
1928 |
1916 StatusMethods = [ |
1929 StatusMethods = [ |
1917 { |
1930 { |
1918 "bitmap": "Build", |
1931 "bitmap": "Build", |
1919 "name": _("Build"), |
1932 "name": _("Build"), |
1953 "tooltip": _("Transfer PLC"), |
1966 "tooltip": _("Transfer PLC"), |
1954 "method": "_Transfer", |
1967 "method": "_Transfer", |
1955 "shown": False, |
1968 "shown": False, |
1956 }, |
1969 }, |
1957 { |
1970 { |
|
1971 "bitmap": "Repair", |
|
1972 "name": _("Repair"), |
|
1973 "tooltip": _("Repair broken PLC"), |
|
1974 "method": "_Repair", |
|
1975 "shown": False, |
|
1976 }, |
|
1977 { |
1958 "bitmap": "Disconnect", |
1978 "bitmap": "Disconnect", |
1959 "name": _("Disconnect"), |
1979 "name": _("Disconnect"), |
1960 "tooltip": _("Disconnect from PLC"), |
1980 "tooltip": _("Disconnect from PLC"), |
1961 "method": "_Disconnect", |
1981 "method": "_Disconnect", |
1962 "shown": False, |
1982 "shown": False, |