etherlab/EtherCATManagementEditor.py
changeset 2437 105c20fdeb19
parent 2423 2c7b7ae24d57
child 2643 b98d9e08231f
equal deleted inserted replaced
2436:82bfc75bcd9d 2437:105c20fdeb19
     6 # Copyright (C) 2013: Real-Time & Embedded Systems (RTES) Lab., University of Seoul
     6 # Copyright (C) 2013: Real-Time & Embedded Systems (RTES) Lab., University of Seoul
     7 #
     7 #
     8 # See COPYING file for copyrights details.
     8 # See COPYING file for copyrights details.
     9 
     9 
    10 from __future__ import absolute_import
    10 from __future__ import absolute_import
       
    11 from __future__ import division
    11 import os
    12 import os
    12 import string
    13 import string
    13 from xml.dom import minidom
    14 from xml.dom import minidom
    14 
    15 
    15 import wx
    16 import wx
   420                         self.Controler.CommonMethod.SaveSDOData[count].append(self.Data)
   421                         self.Controler.CommonMethod.SaveSDOData[count].append(self.Data)
   421                         break
   422                         break
   422 
   423 
   423                 self.Controler.CommonMethod.SaveSDOData[self.AllSDOData].append(self.Data)
   424                 self.Controler.CommonMethod.SaveSDOData[self.AllSDOData].append(self.Data)
   424 
   425 
   425             if count >= len(self.SDOs.splitlines()) / 2:
   426             if count >= len(self.SDOs.splitlines()) // 2:
   426                 (keep_going, _skip) = slaveSDO_progress.Update(count, "Please waiting a moment!!")
   427                 (keep_going, _skip) = slaveSDO_progress.Update(count, "Please waiting a moment!!")
   427             else:
   428             else:
   428                 (keep_going, _skip) = slaveSDO_progress.Update(count)
   429                 (keep_going, _skip) = slaveSDO_progress.Update(count)
   429 
   430 
   430             # If user click "Cancel" loop suspend immediately
   431             # If user click "Cancel" loop suspend immediately
  1032             'Category Data':                       ('42', 1),
  1033             'Category Data':                       ('42', 1),
  1033         }
  1034         }
  1034 
  1035 
  1035         # Config Data: EEPROM Size, PDI Type, Device Emulation
  1036         # Config Data: EEPROM Size, PDI Type, Device Emulation
  1036         # EEPROM's data in address '0x003f' is Size of EEPROM in KBit-1
  1037         # EEPROM's data in address '0x003f' is Size of EEPROM in KBit-1
  1037         eeprom_size = str((int(self.GetWordAddressData(sii_dict.get('Size'), 10))+1)/8*1024)
  1038         eeprom_size = str((int(self.GetWordAddressData(sii_dict.get('Size'), 10))+1)//8*1024)
  1038         # Find PDI Type in pdiType dictionary
  1039         # Find PDI Type in pdiType dictionary
  1039         cnt_pdi_type = int(self.GetWordAddressData(sii_dict.get('PDIControl'), 16).split('x')[1][2:4], 16)
  1040         cnt_pdi_type = int(self.GetWordAddressData(sii_dict.get('PDIControl'), 16).split('x')[1][2:4], 16)
  1040         for i in self.PDIType.keys():
  1041         for i in self.PDIType.keys():
  1041             if cnt_pdi_type == i:
  1042             if cnt_pdi_type == i:
  1042                 cnt_pdi_type = self.PDIType[i][0]
  1043                 cnt_pdi_type = self.PDIType[i][0]
  1361         # set label name and size
  1362         # set label name and size
  1362         self.SetRowLabelSize(100)
  1363         self.SetRowLabelSize(100)
  1363         for col in range(self.Col):
  1364         for col in range(self.Col):
  1364             if col == 16:
  1365             if col == 16:
  1365                 self.SetColLabelValue(16, "Text View")
  1366                 self.SetColLabelValue(16, "Text View")
  1366                 self.SetColSize(16, (self.GetSize().x-120)*4/20)
  1367                 self.SetColSize(16, (self.GetSize().x-120)*4//20)
  1367             else:
  1368             else:
  1368                 self.SetColLabelValue(col, '%s' % col)
  1369                 self.SetColLabelValue(col, '%s' % col)
  1369                 self.SetColSize(col, (self.GetSize().x-120)/20)
  1370                 self.SetColSize(col, (self.GetSize().x-120)//20)
  1370 
  1371 
  1371         # set data into table
  1372         # set data into table
  1372         row = col = 0
  1373         row = col = 0
  1373         for row_idx in value:
  1374         for row_idx in value:
  1374             col = 0
  1375             col = 0