etherlab/EtherCATManagementEditor.py
changeset 2367 0fb54172a18b
parent 2366 d635680e4c2c
child 2368 642ae95218b6
equal deleted inserted replaced
2366:d635680e4c2c 2367:0fb54172a18b
   533         Constructor
   533         Constructor
   534         @param parent: Reference to the parent SDOPanelClass class
   534         @param parent: Reference to the parent SDOPanelClass class
   535         @param data: SDO data after parsing "SDOParser" method
   535         @param data: SDO data after parsing "SDOParser" method
   536         """
   536         """
   537         wx.grid.Grid.__init__(self, parent, -1, size=(830, 490),
   537         wx.grid.Grid.__init__(self, parent, -1, size=(830, 490),
   538                               style=wx.EXPAND|wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
   538                               style=wx.EXPAND | wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
   539 
   539 
   540         self.Controler = parent.Controler
   540         self.Controler = parent.Controler
   541         self.parent = parent
   541         self.parent = parent
   542         self.SDOFlag = True
   542         self.SDOFlag = True
   543         if data is None :
   543         if data is None :
   807         @param info : data structure including entry index, sub index, name, length, type
   807         @param info : data structure including entry index, sub index, name, length, type
   808         @param entry : data structure including index, name, entry number
   808         @param entry : data structure including index, name, entry number
   809         @param count : page number
   809         @param count : page number
   810         """
   810         """
   811         wx.grid.Grid.__init__(self, parent, -1, size=(500, 400), pos=wx.Point(0, 0),
   811         wx.grid.Grid.__init__(self, parent, -1, size=(500, 400), pos=wx.Point(0, 0),
   812                               style=wx.EXPAND|wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
   812                               style=wx.EXPAND | wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
   813 
   813 
   814         self.Controler = parent.Controler
   814         self.Controler = parent.Controler
   815 
   815 
   816         self.PDOInfo = info
   816         self.PDOInfo = info
   817         self.PDOEntry = entry
   817         self.PDOEntry = entry
   986         if check_connect_flag:
   986         if check_connect_flag:
   987             self.SiiBinary = self.Controler.CommonMethod.LoadData()
   987             self.SiiBinary = self.Controler.CommonMethod.LoadData()
   988             self.SetEEPROMData()
   988             self.SetEEPROMData()
   989             dialog = wx.FileDialog(self, _("Save as..."), os.getcwd(),
   989             dialog = wx.FileDialog(self, _("Save as..."), os.getcwd(),
   990                                    "slave0.bin",  _("bin files (*.bin)|*.bin|All files|*.*"),
   990                                    "slave0.bin",  _("bin files (*.bin)|*.bin|All files|*.*"),
   991                                    wx.SAVE|wx.OVERWRITE_PROMPT)
   991                                    wx.SAVE | wx.OVERWRITE_PROMPT)
   992 
   992 
   993             if dialog.ShowModal() == wx.ID_OK:
   993             if dialog.ShowModal() == wx.ID_OK:
   994                 filepath = dialog.GetPath()
   994                 filepath = dialog.GetPath()
   995                 binfile = open(filepath, "wb")
   995                 binfile = open(filepath, "wb")
   996                 binfile.write(self.SiiBinary)
   996                 binfile.write(self.SiiBinary)
  1332         Save current EEPROM data to binary file through FileDialog
  1332         Save current EEPROM data to binary file through FileDialog
  1333         Binded to 'Write to File' button.
  1333         Binded to 'Write to File' button.
  1334         @param event : wx.EVT_BUTTON object
  1334         @param event : wx.EVT_BUTTON object
  1335         """
  1335         """
  1336         dialog = wx.FileDialog(self, _("Save as..."), os.getcwd(), "slave0.bin",
  1336         dialog = wx.FileDialog(self, _("Save as..."), os.getcwd(), "slave0.bin",
  1337                                _("bin files (*.bin)|*.bin|All files|*.*"), wx.SAVE|wx.OVERWRITE_PROMPT)
  1337                                _("bin files (*.bin)|*.bin|All files|*.*"), wx.SAVE | wx.OVERWRITE_PROMPT)
  1338 
  1338 
  1339         if dialog.ShowModal() == wx.ID_OK:
  1339         if dialog.ShowModal() == wx.ID_OK:
  1340             filepath = dialog.GetPath()
  1340             filepath = dialog.GetPath()
  1341             binfile = open(filepath, "wb")
  1341             binfile = open(filepath, "wb")
  1342             binfile.write(self.SiiBinary)
  1342             binfile.write(self.SiiBinary)
  1396         self.Controler = controler
  1396         self.Controler = controler
  1397         self.Row = row
  1397         self.Row = row
  1398         self.Col = col
  1398         self.Col = col
  1399 
  1399 
  1400         wx.grid.Grid.__init__(self, parent, -1, size=(830, 450),
  1400         wx.grid.Grid.__init__(self, parent, -1, size=(830, 450),
  1401                               style=wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
  1401                               style=wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
  1402 
  1402 
  1403     def SetValue(self, value):
  1403     def SetValue(self, value):
  1404         """
  1404         """
  1405         Set data in the table
  1405         Set data in the table
  1406         @param value: EEPROM data list of which element is 1 Byte hex data
  1406         @param value: EEPROM data list of which element is 1 Byte hex data
  1922         self.Col = col
  1922         self.Col = col
  1923         self.Controler = controler
  1923         self.Controler = controler
  1924         self.RegisterAccessPanel = self.parent.parent.parent
  1924         self.RegisterAccessPanel = self.parent.parent.parent
  1925 
  1925 
  1926         wx.grid.Grid.__init__(self, parent, -1, size=(820, 300),
  1926         wx.grid.Grid.__init__(self, parent, -1, size=(820, 300),
  1927                               style=wx.EXPAND|wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
  1927                               style=wx.EXPAND | wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
  1928 
  1928 
  1929         for evt, mapping_method in [(gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell),
  1929         for evt, mapping_method in [(gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell),
  1930                                     (gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell),
  1930                                     (gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell),
  1931                                     (gridlib.EVT_GRID_CELL_LEFT_DCLICK, self.OnRegModifyDialog)]:
  1931                                     (gridlib.EVT_GRID_CELL_LEFT_DCLICK, self.OnRegModifyDialog)]:
  1932             self.Bind(evt, mapping_method)
  1932             self.Bind(evt, mapping_method)
  2014         @param event: gridlib object (double click)
  2014         @param event: gridlib object (double click)
  2015 	    """
  2015 	    """
  2016         # user can enter a value in case that user double-clicked 'Dec' or 'Hex' value.
  2016         # user can enter a value in case that user double-clicked 'Dec' or 'Hex' value.
  2017         if event.GetCol() == 1 or event.GetCol() == 2:
  2017         if event.GetCol() == 1 or event.GetCol() == 2:
  2018             dlg = wx.TextEntryDialog(self, "Enter hex(0xnnnn) or dec(n) value",
  2018             dlg = wx.TextEntryDialog(self, "Enter hex(0xnnnn) or dec(n) value",
  2019                                      "Register Modify Dialog", style=wx.OK|wx.CANCEL)
  2019                                      "Register Modify Dialog", style=wx.OK | wx.CANCEL)
  2020 
  2020 
  2021             # Setting value in initial dialog value
  2021             # Setting value in initial dialog value
  2022             start_value = self.GetCellValue(event.GetRow(), event.GetCol())
  2022             start_value = self.GetCellValue(event.GetRow(), event.GetCol())
  2023             dlg.SetValue(start_value)
  2023             dlg.SetValue(start_value)
  2024 
  2024 
  2070         self.Data = {}
  2070         self.Data = {}
  2071         self.Row = row
  2071         self.Row = row
  2072         self.Col = col
  2072         self.Col = col
  2073 
  2073 
  2074         wx.grid.Grid.__init__(self, parent, -1, size=(820, 150),
  2074         wx.grid.Grid.__init__(self, parent, -1, size=(820, 150),
  2075                               style=wx.EXPAND|wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL)
  2075                               style=wx.EXPAND | wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
  2076 
  2076 
  2077     def SetValue(self, parent, data):
  2077     def SetValue(self, parent, data):
  2078         """
  2078         """
  2079 	    Set the data into the subtable.
  2079 	    Set the data into the subtable.
  2080 	    @param parent: RegisterNotebook object
  2080 	    @param parent: RegisterNotebook object