plugger.py
changeset 396 d1083f580ca1
parent 395 433fd448dd31
child 401 8106a853a7c7
equal deleted inserted replaced
395:433fd448dd31 396:d1083f580ca1
  1323         self.CompareLocalAndRemotePLC()
  1323         self.CompareLocalAndRemotePLC()
  1324         return True
  1324         return True
  1325     
  1325     
  1326     def ShowError(self, logger, from_location, to_location):
  1326     def ShowError(self, logger, from_location, to_location):
  1327         chunk_infos = self.GetChunkInfos(from_location, to_location)
  1327         chunk_infos = self.GetChunkInfos(from_location, to_location)
  1328         self._EditPLC()
       
  1329         for infos, (start_row, start_col) in chunk_infos:
  1328         for infos, (start_row, start_col) in chunk_infos:
  1330             start = (from_location[0] - start_row, from_location[1] - start_col)
  1329             start = (from_location[0] - start_row, from_location[1] - start_col)
  1331             end = (to_location[0] - start_row, to_location[1] - start_col)
  1330             end = (to_location[0] - start_row, to_location[1] - start_col)
  1332             self.AppFrame.ShowError(infos, start, end)
  1331             if self.AppFrame is not None:
       
  1332                 self.AppFrame.ShowError(infos, start, end)
  1333 
  1333 
  1334     def _showIECcode(self):
  1334     def _showIECcode(self):
  1335         plc_file = self._getIECcodepath()
  1335         plc_file = self._getIECcodepath()
  1336         new_dialog = wx.Frame(self.AppFrame)
  1336         new_dialog = wx.Frame(self.AppFrame)
  1337         ST_viewer = TextViewer(new_dialog, "", None, None)
  1337         ST_viewer = TextViewer(new_dialog, "", None, None)
  1353         #ST_viewer.Enable(False)
  1353         #ST_viewer.Enable(False)
  1354         ST_viewer.SetKeywords(IEC_KEYWORDS)
  1354         ST_viewer.SetKeywords(IEC_KEYWORDS)
  1355         ST_viewer.RefreshView()
  1355         ST_viewer.RefreshView()
  1356             
  1356             
  1357         new_dialog.Show()
  1357         new_dialog.Show()
  1358 
       
  1359     def _EditPLC(self):
       
  1360         if self.PLCEditor is None:
       
  1361             self.RefreshPluginsBlockLists()
       
  1362             def _onclose():
       
  1363                 self.PLCEditor = None
       
  1364             def _onsave():
       
  1365                 self.SaveProject()
       
  1366             self.PLCEditor = PLCOpenEditor(self.AppFrame, self)
       
  1367             self.PLCEditor._onclose = _onclose
       
  1368             self.PLCEditor._onsave = _onsave
       
  1369             self.PLCEditor.Show()
       
  1370 
  1358 
  1371     def _Clean(self):
  1359     def _Clean(self):
  1372         if os.path.isdir(os.path.join(self._getBuildPath())):
  1360         if os.path.isdir(os.path.join(self._getBuildPath())):
  1373             self.logger.write(_("Cleaning the build directory\n"))
  1361             self.logger.write(_("Cleaning the build directory\n"))
  1374             shutil.rmtree(os.path.join(self._getBuildPath()))
  1362             shutil.rmtree(os.path.join(self._getBuildPath()))
  1725             data = builder.GetBinaryCode()
  1713             data = builder.GetBinaryCode()
  1726             if data is not None :
  1714             if data is not None :
  1727                 if self._connector.NewPLC(MD5, data, extrafiles):
  1715                 if self._connector.NewPLC(MD5, data, extrafiles):
  1728                     if self.AppFrame is not None:
  1716                     if self.AppFrame is not None:
  1729                         self.AppFrame.CloseDebugTabs()
  1717                         self.AppFrame.CloseDebugTabs()
       
  1718                         self.AppFrame.RefreshInstanceTree()
  1730                     self.UnsubscribeAllDebugIECVariable()
  1719                     self.UnsubscribeAllDebugIECVariable()
  1731                     self.ProgramTransferred()
  1720                     self.ProgramTransferred()
  1732                     self.logger.write(_("Transfer completed successfully.\n"))
  1721                     self.logger.write(_("Transfer completed successfully.\n"))
  1733                 else:
  1722                 else:
  1734                     self.logger.write_error(_("Transfer failed\n"))
  1723                     self.logger.write_error(_("Transfer failed\n"))