equal
deleted
inserted
replaced
17 import wx.gizmos |
17 import wx.gizmos |
18 import wx.lib.buttons |
18 import wx.lib.buttons |
19 |
19 |
20 # -------------------------------------------------------------------- |
20 # -------------------------------------------------------------------- |
21 from controls import CustomGrid, CustomTable |
21 from controls import CustomGrid, CustomTable |
|
22 from runtime import PlcStatus |
22 # -------------------------------------------------------------------- |
23 # -------------------------------------------------------------------- |
23 |
24 |
24 # ------------ for register management --------------- |
25 # ------------ for register management --------------- |
25 |
26 |
26 from util.TranslationCatalogs import NoTranslate |
27 from util.TranslationCatalogs import NoTranslate |
240 # If target state is OP, first check "PLC status". |
241 # If target state is OP, first check "PLC status". |
241 # (1) If current PLC status is "Started", then request slave state transition |
242 # (1) If current PLC status is "Started", then request slave state transition |
242 # (2) Otherwise, show error message and return |
243 # (2) Otherwise, show error message and return |
243 else: |
244 else: |
244 status, _log_count = self.Controler.GetCTRoot()._connector.GetPLCstatus() |
245 status, _log_count = self.Controler.GetCTRoot()._connector.GetPLCstatus() |
245 if status == "Started": |
246 if status == PlcStatus.Started: |
246 self.Controler.CommonMethod.RequestSlaveState("OP") |
247 self.Controler.CommonMethod.RequestSlaveState("OP") |
247 self.TextCtrlDic["TargetState"].SetValue("OP") |
248 self.TextCtrlDic["TargetState"].SetValue("OP") |
248 else: |
249 else: |
249 self.Controler.CommonMethod.CreateErrorDialog("PLC is Not Started") |
250 self.Controler.CommonMethod.CreateErrorDialog("PLC is Not Started") |
250 |
251 |
904 """ |
905 """ |
905 # Check whether beremiz connected or not, and whether status is "Started" or not. |
906 # Check whether beremiz connected or not, and whether status is "Started" or not. |
906 check_connect_flag = self.Controler.CommonMethod.CheckConnect(False) |
907 check_connect_flag = self.Controler.CommonMethod.CheckConnect(False) |
907 if check_connect_flag: |
908 if check_connect_flag: |
908 status, _log_count = self.Controler.GetCTRoot()._connector.GetPLCstatus() |
909 status, _log_count = self.Controler.GetCTRoot()._connector.GetPLCstatus() |
909 if status is not "Started": |
910 if status is not PlcStatus.Started: |
910 dialog = wx.FileDialog(self, _("Choose a binary file"), os.getcwd(), "", _("bin files (*.bin)|*.bin"), wx.OPEN) |
911 dialog = wx.FileDialog(self, _("Choose a binary file"), os.getcwd(), "", _("bin files (*.bin)|*.bin"), wx.OPEN) |
911 |
912 |
912 if dialog.ShowModal() == wx.ID_OK: |
913 if dialog.ShowModal() == wx.ID_OK: |
913 filepath = dialog.GetPath() |
914 filepath = dialog.GetPath() |
914 try: |
915 try: |
1273 # Check whether beremiz connected or not, |
1274 # Check whether beremiz connected or not, |
1274 # and whether status is "Started" or not. |
1275 # and whether status is "Started" or not. |
1275 check_connect_flag = self.Controler.CommonMethod.CheckConnect(False) |
1276 check_connect_flag = self.Controler.CommonMethod.CheckConnect(False) |
1276 if check_connect_flag: |
1277 if check_connect_flag: |
1277 status, _log_count = self.Controler.GetCTRoot()._connector.GetPLCstatus() |
1278 status, _log_count = self.Controler.GetCTRoot()._connector.GetPLCstatus() |
1278 if status is not "Started": |
1279 if status is not PlcStatus.Started: |
1279 self.Controler.CommonMethod.SiiWrite(self.SiiBinary) |
1280 self.Controler.CommonMethod.SiiWrite(self.SiiBinary) |
1280 self.Controler.CommonMethod.Rescan() |
1281 self.Controler.CommonMethod.Rescan() |
1281 |
1282 |
1282 def OnButtonWriteToBinFile(self, event): |
1283 def OnButtonWriteToBinFile(self, event): |
1283 """ |
1284 """ |