changeset 2363 | 9c7da6ff6a34 |
parent 2361 | 5d6ce74f7835 |
child 2364 | 4ea781f30555 |
2362:6d31ef14f396 | 2363:9c7da6ff6a34 |
---|---|
143 self.SizerDic["SlaveInfosDetailsInnerSizer"].AddMany([self.StaticTextDic[statictext_name], |
143 self.SizerDic["SlaveInfosDetailsInnerSizer"].AddMany([self.StaticTextDic[statictext_name], |
144 self.TextCtrlDic[textctrl_name]]) |
144 self.TextCtrlDic[textctrl_name]]) |
145 |
145 |
146 self.SizerDic["SlaveInfosDetailsBox"].AddSizer(self.SizerDic["SlaveInfosDetailsInnerSizer"]) |
146 self.SizerDic["SlaveInfosDetailsBox"].AddSizer(self.SizerDic["SlaveInfosDetailsInnerSizer"]) |
147 |
147 |
148 self.SyncManagersGrid = CustomGrid(self, size=wx.Size(605,155), style=wx.VSCROLL) |
148 self.SyncManagersGrid = CustomGrid(self, size=wx.Size(605, 155), style=wx.VSCROLL) |
149 |
149 |
150 self.SizerDic["SyncManagerInnerSizer"].Add(self.SyncManagersGrid) |
150 self.SizerDic["SyncManagerInnerSizer"].Add(self.SyncManagersGrid) |
151 self.SizerDic["SyncManagerBox"].Add(self.SizerDic["SyncManagerInnerSizer"]) |
151 self.SizerDic["SyncManagerBox"].Add(self.SizerDic["SyncManagerInnerSizer"]) |
152 |
152 |
153 for button_name, button_id, button_label, button_tooltipstring, event_method, sub_item in [ |
153 for button_name, button_id, button_label, button_tooltipstring, event_method, sub_item in [ |
155 ("PreOPButton", 1, "PREOP", "State Transition to \"PreOP\" State", self.OnButtonClick, [ |
155 ("PreOPButton", 1, "PREOP", "State Transition to \"PreOP\" State", self.OnButtonClick, [ |
156 ("TargetStateLabel", "Target State:" , "TargetState")]), |
156 ("TargetStateLabel", "Target State:" , "TargetState")]), |
157 ("SafeOPButton", 2, "SAFEOP", "State Transition to \"SafeOP\" State", self.OnButtonClick, []), |
157 ("SafeOPButton", 2, "SAFEOP", "State Transition to \"SafeOP\" State", self.OnButtonClick, []), |
158 ("OPButton", 3, "OP", "State Transition to \"OP\" State", self.OnButtonClick, [ |
158 ("OPButton", 3, "OP", "State Transition to \"OP\" State", self.OnButtonClick, [ |
159 ("CurrentStateLabel", "Current State:", "CurrentState")])]: |
159 ("CurrentStateLabel", "Current State:", "CurrentState")])]: |
160 self.ButtonDic[button_name] = wx.Button(self, id=button_id ,label=_(button_label)) |
160 self.ButtonDic[button_name] = wx.Button(self, id=button_id, label=_(button_label)) |
161 self.ButtonDic[button_name].Bind(wx.EVT_BUTTON, event_method) |
161 self.ButtonDic[button_name].Bind(wx.EVT_BUTTON, event_method) |
162 self.ButtonDic[button_name].SetToolTipString(button_tooltipstring) |
162 self.ButtonDic[button_name].SetToolTipString(button_tooltipstring) |
163 self.SizerDic["SlaveState_up_sizer"].Add(self.ButtonDic[button_name]) |
163 self.SizerDic["SlaveState_up_sizer"].Add(self.ButtonDic[button_name]) |
164 for statictext_name, statictext_label, textctrl_name in sub_item : |
164 for statictext_name, statictext_label, textctrl_name in sub_item : |
165 self.StaticTextDic[statictext_name] = wx.StaticText(self, label=_(statictext_label)) |
165 self.StaticTextDic[statictext_name] = wx.StaticText(self, label=_(statictext_label)) |
417 |
417 |
418 if type == "octet_string": |
418 if type == "octet_string": |
419 hex_val = ' ---- ' |
419 hex_val = ' ---- ' |
420 |
420 |
421 # SResult of SlaveSDO data parsing. (data type : dictionary) |
421 # SResult of SlaveSDO data parsing. (data type : dictionary) |
422 self.Data = {'idx':idx.strip(), 'subIdx':sub_idx.strip(), 'access':access.strip(), |
422 self.Data = {'idx': idx.strip(), 'subIdx': sub_idx.strip(), 'access': access.strip(), |
423 'type':type.strip(), 'size':size.strip(), 'name':name_after_check.strip("\""), |
423 'type': type.strip(), 'size': size.strip(), 'name': name_after_check.strip("\""), |
424 'value':hex_val.strip(), "category":title_name.strip("\"")} |
424 'value': hex_val.strip(), "category": title_name.strip("\"")} |
425 |
425 |
426 category_divide_value = [0x1000, 0x2000, 0x6000, 0xa000, 0xffff] |
426 category_divide_value = [0x1000, 0x2000, 0x6000, 0xa000, 0xffff] |
427 |
427 |
428 for count in range(len(category_divide_value)) : |
428 for count in range(len(category_divide_value)) : |
429 if int(idx, 0) < category_divide_value[count]: |
429 if int(idx, 0) < category_divide_value[count]: |
471 """ |
471 """ |
472 Constructor |
472 Constructor |
473 @param parent: Reference to the parent SDOPanelClass class |
473 @param parent: Reference to the parent SDOPanelClass class |
474 @param controler: _EthercatSlaveCTN class in EthercatSlave.py |
474 @param controler: _EthercatSlaveCTN class in EthercatSlave.py |
475 """ |
475 """ |
476 wx.Notebook.__init__(self, parent, id = -1, size=(850,500)) |
476 wx.Notebook.__init__(self, parent, id = -1, size=(850, 500)) |
477 self.Controler = controler |
477 self.Controler = controler |
478 self.parent = parent |
478 self.parent = parent |
479 |
479 |
480 self.CreateNoteBook() |
480 self.CreateNoteBook() |
481 |
481 |
532 """ |
532 """ |
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 |
566 |
566 |
567 # for SDO download |
567 # for SDO download |
568 self.Bind(gridlib.EVT_GRID_CELL_LEFT_DCLICK, self.SDOModifyDialog) |
568 self.Bind(gridlib.EVT_GRID_CELL_LEFT_DCLICK, self.SDOModifyDialog) |
569 |
569 |
570 for i in range(7): |
570 for i in range(7): |
571 self.SetColAttr(i,attr) |
571 self.SetColAttr(i, attr) |
572 |
572 |
573 self.SetColLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER) |
573 self.SetColLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER) |
574 |
574 |
575 self.SetTableValue() |
575 self.SetTableValue() |
576 |
576 |
806 @param parent: Reference to the parent PDONoteBook class |
806 @param parent: Reference to the parent PDONoteBook class |
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 |
878 Constructor |
878 Constructor |
879 @param parent: Reference to the parent EtherCATManagementTreebook class |
879 @param parent: Reference to the parent EtherCATManagementTreebook class |
880 @param controler: _EthercatSlaveCTN class in EthercatSlave.py |
880 @param controler: _EthercatSlaveCTN class in EthercatSlave.py |
881 """ |
881 """ |
882 wx.Panel.__init__(self, parent, -1) |
882 wx.Panel.__init__(self, parent, -1) |
883 sizer = wx.FlexGridSizer(cols=1, hgap=20,rows=3, vgap=20) |
883 sizer = wx.FlexGridSizer(cols=1, hgap=20, rows=3, vgap=20) |
884 |
884 |
885 line = wx.StaticText(self, -1, "\n EEPROM Access is composed to SmartView and HexView. \ |
885 line = wx.StaticText(self, -1, "\n EEPROM Access is composed to SmartView and HexView. \ |
886 \n\n - SmartView shows Config Data, Device Identity, Mailbox settings, etc. \ |
886 \n\n - SmartView shows Config Data, Device Identity, Mailbox settings, etc. \ |
887 \n\n - HexView shows EEPROM's contents.") |
887 \n\n - HexView shows EEPROM's contents.") |
888 |
888 |
903 """ |
903 """ |
904 wx.Panel.__init__(self, parent, -1) |
904 wx.Panel.__init__(self, parent, -1) |
905 self.parent = parent |
905 self.parent = parent |
906 self.Controler = controler |
906 self.Controler = controler |
907 |
907 |
908 self.PDIType = {0 :['none', '00000000'], |
908 self.PDIType = { |
909 4 :['Digital I/O', '00000100'], |
909 0 : ['none', '00000000'], |
910 5 :['SPI Slave', '00000101'], |
910 4 : ['Digital I/O', '00000100'], |
911 7 :['EtherCAT Bridge (port3)', '00000111'], |
911 5 : ['SPI Slave', '00000101'], |
912 8 :['uC async. 16bit', '00001000'], |
912 7 : ['EtherCAT Bridge (port3)', '00000111'], |
913 9 :['uC async. 8bit', '00001001'], |
913 8 : ['uC async. 16bit', '00001000'], |
914 10 :['uC sync. 16bit', '00001010'], |
914 9 : ['uC async. 8bit', '00001001'], |
915 11 :['uC sync. 8bit', '00001011'], |
915 10 : ['uC sync. 16bit', '00001010'], |
916 16 :['32 Digtal Input and 0 Digital Output', '00010000'], |
916 11 : ['uC sync. 8bit', '00001011'], |
917 17 :['24 Digtal Input and 8 Digital Output', '00010001'], |
917 16 : ['32 Digtal Input and 0 Digital Output', '00010000'], |
918 18 :['16 Digtal Input and 16 Digital Output','00010010'], |
918 17 : ['24 Digtal Input and 8 Digital Output', '00010001'], |
919 19 :['8 Digtal Input and 24 Digital Output', '00010011'], |
919 18 : ['16 Digtal Input and 16 Digital Output', '00010010'], |
920 20 :['0 Digtal Input and 32 Digital Output', '00010100'], |
920 19 : ['8 Digtal Input and 24 Digital Output', '00010011'], |
921 128:['On-chip bus', '11111111'] |
921 20 : ['0 Digtal Input and 32 Digital Output', '00010100'], |
922 } |
922 128: ['On-chip bus', '11111111'] |
923 } |
|
923 |
924 |
924 sizer = wx.FlexGridSizer(cols=1, hgap=5, rows=2, vgap=5) |
925 sizer = wx.FlexGridSizer(cols=1, hgap=5, rows=2, vgap=5) |
925 button_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=1, vgap=5) |
926 button_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=1, vgap=5) |
926 |
927 |
927 for button, mapping_method in [("Write EEPROM", self.WriteToEEPROM), |
928 for button, mapping_method in [("Write EEPROM", self.WriteToEEPROM), |
958 dialog = wx.FileDialog(self, _("Choose a binary file"), os.getcwd(), "", _("bin files (*.bin)|*.bin"), wx.OPEN) |
959 dialog = wx.FileDialog(self, _("Choose a binary file"), os.getcwd(), "", _("bin files (*.bin)|*.bin"), wx.OPEN) |
959 |
960 |
960 if dialog.ShowModal() == wx.ID_OK: |
961 if dialog.ShowModal() == wx.ID_OK: |
961 filepath = dialog.GetPath() |
962 filepath = dialog.GetPath() |
962 try: |
963 try: |
963 binfile = open(filepath,"rb") |
964 binfile = open(filepath, "rb") |
964 self.SiiBinary = binfile.read() |
965 self.SiiBinary = binfile.read() |
965 dialog.Destroy() |
966 dialog.Destroy() |
966 |
967 |
967 self.Controler.CommonMethod.SiiWrite(self.SiiBinary) |
968 self.Controler.CommonMethod.SiiWrite(self.SiiBinary) |
968 # refresh data structure kept by master |
969 # refresh data structure kept by master |
989 "slave0.bin", _("bin files (*.bin)|*.bin|All files|*.*"), |
990 "slave0.bin", _("bin files (*.bin)|*.bin|All files|*.*"), |
990 wx.SAVE|wx.OVERWRITE_PROMPT) |
991 wx.SAVE|wx.OVERWRITE_PROMPT) |
991 |
992 |
992 if dialog.ShowModal() == wx.ID_OK: |
993 if dialog.ShowModal() == wx.ID_OK: |
993 filepath = dialog.GetPath() |
994 filepath = dialog.GetPath() |
994 binfile = open(filepath,"wb") |
995 binfile = open(filepath, "wb") |
995 binfile.write(self.SiiBinary) |
996 binfile.write(self.SiiBinary) |
996 binfile.close() |
997 binfile.close() |
997 |
998 |
998 dialog.Destroy() |
999 dialog.Destroy() |
999 |
1000 |
1078 'Category Data' : ('42', 1), |
1079 'Category Data' : ('42', 1), |
1079 } |
1080 } |
1080 |
1081 |
1081 # Config Data: EEPROM Size, PDI Type, Device Emulation |
1082 # Config Data: EEPROM Size, PDI Type, Device Emulation |
1082 # EEPROM's data in address '0x003f' is Size of EEPROM in KBit-1 |
1083 # EEPROM's data in address '0x003f' is Size of EEPROM in KBit-1 |
1083 eeprom_size = str((int(self.GetWordAddressData( sii_dict.get('Size'),10 ))+1)/8*1024) |
1084 eeprom_size = str((int(self.GetWordAddressData( sii_dict.get('Size'), 10 ))+1)/8*1024) |
1084 # Find PDI Type in pdiType dictionary |
1085 # Find PDI Type in pdiType dictionary |
1085 cnt_pdi_type = int(self.GetWordAddressData( sii_dict.get('PDIControl'),16 ).split('x')[1][2:4], 16) |
1086 cnt_pdi_type = int(self.GetWordAddressData( sii_dict.get('PDIControl'), 16 ).split('x')[1][2:4], 16) |
1086 for i in self.PDIType.keys(): |
1087 for i in self.PDIType.keys(): |
1087 if cnt_pdi_type == i: |
1088 if cnt_pdi_type == i: |
1088 cnt_pdi_type = self.PDIType[i][0] |
1089 cnt_pdi_type = self.PDIType[i][0] |
1089 break |
1090 break |
1090 # Get Device Emulation |
1091 # Get Device Emulation |
1091 device_emulation = str(bool(int("{:0>16b}".format(int(self.GetWordAddressData( sii_dict.get('PDIControl'),16 ), 16))[7]))) |
1092 device_emulation = str(bool(int("{:0>16b}".format(int(self.GetWordAddressData( sii_dict.get('PDIControl'), 16 ), 16))[7]))) |
1092 # Set Config Data |
1093 # Set Config Data |
1093 for treelist, data in [("EEPROM Size (Bytes)", eeprom_size), |
1094 for treelist, data in [("EEPROM Size (Bytes)", eeprom_size), |
1094 ("PDI Type", cnt_pdi_type), |
1095 ("PDI Type", cnt_pdi_type), |
1095 ("Device Emulation", device_emulation)]: |
1096 ("Device Emulation", device_emulation)]: |
1096 self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.ConfigData[treelist], data, 1) |
1097 self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.ConfigData[treelist], data, 1) |
1097 |
1098 |
1098 # Device Identity: Vendor ID, Product Code, Revision No., Serial No. |
1099 # Device Identity: Vendor ID, Product Code, Revision No., Serial No. |
1099 # Set Device Identity |
1100 # Set Device Identity |
1100 for treelist, data in [("Vendor ID", self.GetWordAddressData( sii_dict.get('VendorID'),16 )), |
1101 for treelist, data in [ |
1101 ("Product Code", self.GetWordAddressData( sii_dict.get('ProductCode'),16 )), |
1102 ("Vendor ID", self.GetWordAddressData( sii_dict.get('VendorID'), 16 )), |
1102 ("Revision No.", self.GetWordAddressData( sii_dict.get('RevisionNumber'),16 )), |
1103 ("Product Code", self.GetWordAddressData( sii_dict.get('ProductCode'), 16 )), |
1103 ("Serial No.", self.GetWordAddressData( sii_dict.get('SerialNumber'),16 ))]: |
1104 ("Revision No.", self.GetWordAddressData( sii_dict.get('RevisionNumber'), 16 )), |
1105 ("Serial No.", self.GetWordAddressData( sii_dict.get('SerialNumber'), 16 ))]: |
|
1104 self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.DeviceIdentity[treelist], data, 1) |
1106 self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.DeviceIdentity[treelist], data, 1) |
1105 |
1107 |
1106 # Mailbox |
1108 # Mailbox |
1107 # EEORPOM's word address '1c' indicates supported mailbox protocol. |
1109 # EEORPOM's word address '1c' indicates supported mailbox protocol. |
1108 # each value of mailbox protocol : |
1110 # each value of mailbox protocol : |
1109 # VoE(0x0020), SoE(0x0010), FoE(0x0008), CoE(0x0004), EoE(0x0002), AoE(0x0001) |
1111 # VoE(0x0020), SoE(0x0010), FoE(0x0008), CoE(0x0004), EoE(0x0002), AoE(0x0001) |
1110 supported_mailbox = "" |
1112 supported_mailbox = "" |
1111 mailbox_protocol=["VoE, ", "SoE, ", "FoE, ", "CoE, ", "EoE, ", "AoE, "] |
1113 mailbox_protocol=["VoE, ", "SoE, ", "FoE, ", "CoE, ", "EoE, ", "AoE, "] |
1112 mailbox_data = "{:0>8b}".format(int(self.GetWordAddressData( sii_dict.get('MailboxProtocol'),16 ), 16)) |
1114 mailbox_data = "{:0>8b}".format(int(self.GetWordAddressData( sii_dict.get('MailboxProtocol'), 16 ), 16)) |
1113 for protocol in range(6): |
1115 for protocol in range(6): |
1114 if mailbox_data[protocol+2] == '1': |
1116 if mailbox_data[protocol+2] == '1': |
1115 supported_mailbox += mailbox_protocol[protocol] |
1117 supported_mailbox += mailbox_protocol[protocol] |
1116 supported_mailbox = supported_mailbox.strip(", ") |
1118 supported_mailbox = supported_mailbox.strip(", ") |
1117 # Set Mailbox |
1119 # Set Mailbox |
1118 for treelist, data in [("Supported Mailbox", supported_mailbox), |
1120 for treelist, data in [("Supported Mailbox", supported_mailbox), |
1119 ("Bootstrap Configuration", ""), |
1121 ("Bootstrap Configuration", ""), |
1120 ("Standard Configuration", "")]: |
1122 ("Standard Configuration", "")]: |
1121 self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.Mailbox[treelist], data, 1) |
1123 self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.Mailbox[treelist], data, 1) |
1122 # Set Bootstrap Configuration: Receive Offset, Receive Size, Send Offset, Send Size |
1124 # Set Bootstrap Configuration: Receive Offset, Receive Size, Send Offset, Send Size |
1123 for treelist, data in [("Receive Offset", self.GetWordAddressData( sii_dict.get('BootstrapReceiveMailboxOffset'),10 )), |
1125 for treelist, data in [ |
1124 ("Receive Size", self.GetWordAddressData( sii_dict.get('BootstrapReceiveMailboxSize'),10 )), |
1126 ("Receive Offset", self.GetWordAddressData( sii_dict.get('BootstrapReceiveMailboxOffset'), 10 )), |
1125 ("Send Offset", self.GetWordAddressData( sii_dict.get('BootstrapSendMailboxOffset'),10 )), |
1127 ("Receive Size", self.GetWordAddressData( sii_dict.get('BootstrapReceiveMailboxSize'), 10 )), |
1126 ("Send Size", self.GetWordAddressData( sii_dict.get('BootstrapSendMailboxSize'),10 ))]: |
1128 ("Send Offset", self.GetWordAddressData( sii_dict.get('BootstrapSendMailboxOffset'), 10 )), |
1129 ("Send Size", self.GetWordAddressData( sii_dict.get('BootstrapSendMailboxSize'), 10 ))]: |
|
1127 self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.BootstrapConfig[treelist], data, 1) |
1130 self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.BootstrapConfig[treelist], data, 1) |
1128 # Set Standard Configuration: Receive Offset, Receive Size, Send Offset, Send Size |
1131 # Set Standard Configuration: Receive Offset, Receive Size, Send Offset, Send Size |
1129 for treelist, data in [("Receive Offset", self.GetWordAddressData( sii_dict.get('StandardReceiveMailboxOffset'),10 )), |
1132 for treelist, data in [ |
1130 ("Receive Size", self.GetWordAddressData( sii_dict.get('StandardReceiveMailboxSize'),10 )), |
1133 ("Receive Offset", self.GetWordAddressData( sii_dict.get('StandardReceiveMailboxOffset'), 10 )), |
1131 ("Send Offset", self.GetWordAddressData( sii_dict.get('StandardSendMailboxOffset'),10 )), |
1134 ("Receive Size", self.GetWordAddressData( sii_dict.get('StandardReceiveMailboxSize'), 10 )), |
1132 ("Send Size", self.GetWordAddressData( sii_dict.get('StandardSendMailboxSize'),10 ))]: |
1135 ("Send Offset", self.GetWordAddressData( sii_dict.get('StandardSendMailboxOffset'), 10 )), |
1136 ("Send Size", self.GetWordAddressData( sii_dict.get('StandardSendMailboxSize'), 10 ))]: |
|
1133 self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.StandardConfig[treelist], data, 1) |
1137 self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.StandardConfig[treelist], data, 1) |
1134 |
1138 |
1135 def MakeStaticBoxSizer(self, boxlabel): |
1139 def MakeStaticBoxSizer(self, boxlabel): |
1136 """ |
1140 """ |
1137 Make StaticBoxSizer |
1141 Make StaticBoxSizer |
1331 dialog = wx.FileDialog(self, _("Save as..."), os.getcwd(), "slave0.bin", |
1335 dialog = wx.FileDialog(self, _("Save as..."), os.getcwd(), "slave0.bin", |
1332 _("bin files (*.bin)|*.bin|All files|*.*"), wx.SAVE|wx.OVERWRITE_PROMPT) |
1336 _("bin files (*.bin)|*.bin|All files|*.*"), wx.SAVE|wx.OVERWRITE_PROMPT) |
1333 |
1337 |
1334 if dialog.ShowModal() == wx.ID_OK: |
1338 if dialog.ShowModal() == wx.ID_OK: |
1335 filepath = dialog.GetPath() |
1339 filepath = dialog.GetPath() |
1336 binfile = open(filepath,"wb") |
1340 binfile = open(filepath, "wb") |
1337 binfile.write(self.SiiBinary) |
1341 binfile.write(self.SiiBinary) |
1338 binfile.close() |
1342 binfile.close() |
1339 |
1343 |
1340 dialog.Destroy() |
1344 dialog.Destroy() |
1341 |
1345 |
1390 self.parent = parent |
1394 self.parent = parent |
1391 self.Controler = controler |
1395 self.Controler = controler |
1392 self.Row = row |
1396 self.Row = row |
1393 self.Col = col |
1397 self.Col = col |
1394 |
1398 |
1395 wx.grid.Grid.__init__(self, parent, -1, size=(830,450), |
1399 wx.grid.Grid.__init__(self, parent, -1, size=(830, 450), |
1396 style=wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL) |
1400 style=wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL) |
1397 |
1401 |
1398 def SetValue(self, value): |
1402 def SetValue(self, value): |
1399 """ |
1403 """ |
1400 Set data in the table |
1404 Set data in the table |
1506 for index in range(4): |
1510 for index in range(4): |
1507 self.Controler.CommonMethod.RegData = self.Controler.CommonMethod.RegData + " " + self.Controler.CommonMethod.RegRead("0x"+"{:0>4x}".format(index*1024), "0x0400") |
1511 self.Controler.CommonMethod.RegData = self.Controler.CommonMethod.RegData + " " + self.Controler.CommonMethod.RegRead("0x"+"{:0>4x}".format(index*1024), "0x0400") |
1508 |
1512 |
1509 # store previous value |
1513 # store previous value |
1510 # (ESC type, port number of FMMU, port number of SM, and PDI type)) |
1514 # (ESC type, port number of FMMU, port number of SM, and PDI type)) |
1511 for reg_spec in ["ESCType","FMMUNumber","SMNumber", "PDIType"]: |
1515 for reg_spec in ["ESCType", "FMMUNumber", "SMNumber", "PDIType"]: |
1512 self.PreRegSpec[reg_spec] = self.Controler.CommonMethod.CrtRegSpec[reg_spec] |
1516 self.PreRegSpec[reg_spec] = self.Controler.CommonMethod.CrtRegSpec[reg_spec] |
1513 |
1517 |
1514 # update registers' description |
1518 # update registers' description |
1515 # (ESC type, port number of FMMU, port number of SM, and PDI type) |
1519 # (ESC type, port number of FMMU, port number of SM, and PDI type) |
1516 for reg_spec, address in [("ESCType", "0x0000"), |
1520 for reg_spec, address in [("ESCType", "0x0000"), |
1916 self.Row = row |
1920 self.Row = row |
1917 self.Col = col |
1921 self.Col = col |
1918 self.Controler = controler |
1922 self.Controler = controler |
1919 self.RegisterAccessPanel = self.parent.parent.parent |
1923 self.RegisterAccessPanel = self.parent.parent.parent |
1920 |
1924 |
1921 wx.grid.Grid.__init__(self, parent, -1, size=(820,300), |
1925 wx.grid.Grid.__init__(self, parent, -1, size=(820, 300), |
1922 style=wx.EXPAND|wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL) |
1926 style=wx.EXPAND|wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL) |
1923 |
1927 |
1924 for evt, mapping_method in [(gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell), |
1928 for evt, mapping_method in [(gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell), |
1925 (gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell), |
1929 (gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell), |
1926 (gridlib.EVT_GRID_CELL_LEFT_DCLICK, self.OnRegModifyDialog)]: |
1930 (gridlib.EVT_GRID_CELL_LEFT_DCLICK, self.OnRegModifyDialog)]: |
2064 self.parent = parent |
2068 self.parent = parent |
2065 self.Data = {} |
2069 self.Data = {} |
2066 self.Row = row |
2070 self.Row = row |
2067 self.Col = col |
2071 self.Col = col |
2068 |
2072 |
2069 wx.grid.Grid.__init__(self, parent, -1, size=(820,150), |
2073 wx.grid.Grid.__init__(self, parent, -1, size=(820, 150), |
2070 style=wx.EXPAND|wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL) |
2074 style=wx.EXPAND|wx.ALIGN_CENTRE_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL) |
2071 |
2075 |
2072 def SetValue(self, parent, data): |
2076 def SetValue(self, parent, data): |
2073 """ |
2077 """ |
2074 Set the data into the subtable. |
2078 Set the data into the subtable. |