--- a/etherlab/CommonEtherCATFunction.py Fri Sep 28 17:52:30 2018 +0300
+++ b/etherlab/CommonEtherCATFunction.py Fri Sep 28 17:59:28 2018 +0300
@@ -216,7 +216,7 @@
Command example : "ethercat states -p 0 PREOP" (target slave position and target state are given.)
@param command : target slave state
- error, return_val = self.Controler.RemoteExec(SLAVE_STATE%(self.Controler.GetSlavePos(), command), return_val = None)
+ error, return_val = self.Controler.RemoteExec(SLAVE_STATE % (self.Controler.GetSlavePos(), command), return_val = None) def GetSlaveStateFromSlave(self):
@@ -237,7 +237,7 @@
Command example : "ethercat sdos -p 0"
@return return_val : execution results of "ethercat sdos" command (need to be parsed later)
- error, return_val = self.Controler.RemoteExec(SLAVE_SDO%(self.Controler.GetSlavePos()), return_val = None)
+ error, return_val = self.Controler.RemoteExec(SLAVE_SDO % (self.Controler.GetSlavePos()), return_val = None) def SDODownload(self, data_type, idx, sub_idx, value):
@@ -249,7 +249,7 @@
@param sub_idx : subindex of the SDO entry
@param value : value of SDO entry
- error, return_val = self.Controler.RemoteExec(SDO_DOWNLOAD%(data_type, self.Controler.GetSlavePos(), idx, sub_idx, value), return_val = None)
+ error, return_val = self.Controler.RemoteExec(SDO_DOWNLOAD % (data_type, self.Controler.GetSlavePos(), idx, sub_idx, value), return_val = None) def BackupSDODataSet(self):
@@ -488,8 +488,8 @@
for mailbox_protocol in mailbox_protocols:
- if getattr(mb,"get%s"%mailbox_protocol)() is not None:
- smartview_infos["supported_mailbox"] += "%s, "%mailbox_protocol
+ if getattr(mb,"get%s" % mailbox_protocol)() is not None: + smartview_infos["supported_mailbox"] += "%s, " % mailbox_protocol smartview_infos["supported_mailbox"] = smartview_infos["supported_mailbox"].strip(", ")
# get standard configuration of mailbox; <Device>-<Sm>
@@ -554,7 +554,7 @@
Command example : "ethercat sii_read -p 0"
@return return_val : result of "ethercat sii_read" (binary data)
- error, return_val = self.Controler.RemoteExec(SII_READ%(self.Controler.GetSlavePos()), return_val = None)
+ error, return_val = self.Controler.RemoteExec(SII_READ % (self.Controler.GetSlavePos()), return_val = None) self.SiiData = return_val
@@ -565,7 +565,7 @@
@param binary : EEPROM contents in binary data format
@return return_val : result of "ethercat sii_write" (If it succeeds, the return value is NULL.)
- error, return_val = self.Controler.RemoteExec(SII_WRITE%(self.Controler.GetSlavePos()), return_val = None, sii_data = binary)
+ error, return_val = self.Controler.RemoteExec(SII_WRITE % (self.Controler.GetSlavePos()), return_val = None, sii_data = binary) @@ -783,7 +783,7 @@
for bit,mbprot in enumerate(mailbox_protocols):
- if getattr(mb,"get%s"%mbprot)() is not None:
+ if getattr(mb,"get%s" % mbprot)() is not None: data = "{:0>4x}".format(data)
@@ -1119,10 +1119,10 @@
# category length (word); 1 word is 4 bytes. "+2" is the length of string's total number
length = len(vendor_specific_data + dc_related_elements + input_elements + output_elements) + 2
eeprom.append("{:0>4x}".format(length/4)[2:4])
eeprom.append("{:0>4x}".format(length/4)[0:2])
@@ -1180,7 +1180,7 @@
for bit,flag in enumerate(["SdoInfo", "PdoAssign", "PdoConfig",
"PdoUpload", "CompleteAccess"]):
- if getattr(coe,"get%s"%flag)() is not None:
+ if getattr(coe,"get%s" % flag)() is not None: eeprom.append("{:0>2x}".format(coe_details))
@@ -1276,7 +1276,7 @@
eeprom.append("{:0>4x}".format((count+1)/2)[2:4])
eeprom.append("{:0>4x}".format((count+1)/2)[0:2])
@@ -1350,7 +1350,7 @@
- for element in eval("device.get%s()"%pdotype):
+ for element in eval("device.get%s()" % pdotype): data += "{:0>4x}".format(ExtractHexDecValue(element.getIndex().getcontent()))[2:4]
data += "{:0>4x}".format(ExtractHexDecValue(element.getIndex().getcontent()))[0:2]
@@ -1530,7 +1530,7 @@
@param length : register length
@return return_val : register data
- error, return_val = self.Controler.RemoteExec(REG_READ%(self.Controler.GetSlavePos(), offset, length), return_val = None)
+ error, return_val = self.Controler.RemoteExec(REG_READ % (self.Controler.GetSlavePos(), offset, length), return_val = None) def RegWrite(self, address, data):
@@ -1541,7 +1541,7 @@
@param data : data to write
@return return_val : the execution result of "ethercat reg_write" (for error check)
- error, return_val = self.Controler.RemoteExec(REG_WRITE%(self.Controler.GetSlavePos(), address, data), return_val = None)
+ error, return_val = self.Controler.RemoteExec(REG_WRITE % (self.Controler.GetSlavePos(), address, data), return_val = None) @@ -1549,7 +1549,7 @@
Synchronize EEPROM data in master controller with the data in slave device after EEPROM write.
Command example : "ethercat rescan -p 0"
- error, return_val = self.Controler.RemoteExec(RESCAN%(self.Controler.GetSlavePos()), return_val = None)
+ error, return_val = self.Controler.RemoteExec(RESCAN % (self.Controler.GetSlavePos()), return_val = None) # -------------------------------------------------------------------------------
@@ -1563,7 +1563,7 @@
if self.Controler.GetCTRoot()._connector is not None:
# Check connection between the master and the slave.
# Command example : "ethercat xml -p 0"
- error, return_val = self.Controler.RemoteExec(SLAVE_XML%(self.Controler.GetSlavePos()), return_val = None)
+ error, return_val = self.Controler.RemoteExec(SLAVE_XML % (self.Controler.GetSlavePos()), return_val = None) number_of_lines = return_val.split("\n")
if len(number_of_lines) <= 2 : # No slave connected to the master controller
--- a/etherlab/ConfigEditor.py Fri Sep 28 17:52:30 2018 +0300
+++ b/etherlab/ConfigEditor.py Fri Sep 28 17:59:28 2018 +0300
@@ -401,10 +401,10 @@
- message = _("Invalid value \"%s\" for process variable")%data
+ message = _("Invalid value \"%s\" for process variable") % data if not isinstance(values, TupleType):
- message = _("Invalid value \"%s\" for process variable")%data
+ message = _("Invalid value \"%s\" for process variable") % data if values is not None and col != wx.NOT_FOUND and row != wx.NOT_FOUND and 2 <= col <= 3:
@@ -435,7 +435,7 @@
message = _("'Read from' and 'Write to' variables types are not compatible")
- message = _("Invalid value \"%s\" for process variable")%data
+ message = _("Invalid value \"%s\" for process variable") % data wx.CallAfter(self.ShowMessage, message)
@@ -461,10 +461,10 @@
- message = _("Invalid value \"%s\" for startup command")%data
+ message = _("Invalid value \"%s\" for startup command") % data if not isinstance(values, TupleType):
- message = _("Invalid value \"%s\" for startup command")%data
+ message = _("Invalid value \"%s\" for startup command") % data @@ -485,7 +485,7 @@
message = _("Entry can't be write through SDO")
- message = _("Invalid value \"%s\" for startup command")%data
+ message = _("Invalid value \"%s\" for startup command") % data wx.CallAfter(self.ShowMessage, message)
--- a/etherlab/EtherCATManagementEditor.py Fri Sep 28 17:52:30 2018 +0300
+++ b/etherlab/EtherCATManagementEditor.py Fri Sep 28 17:59:28 2018 +0300
@@ -1401,7 +1401,7 @@
self.SetColLabelValue(16, "Text View")
self.SetColSize(16, (self.GetSize().x-120)*4/20)
- self.SetColLabelValue(col, '%s'%col)
+ self.SetColLabelValue(col, '%s' % col) self.SetColSize(col, (self.GetSize().x-120)/20)
@@ -1672,7 +1672,7 @@
for address in range(0x1000):
# arrange 2 Bytes of register data
reg_word = reg_data[address].split('x')[1] + reg_word
hex_address = "{:0>4x}".format(address-1)
row_data.append(hex_address)
--- a/etherlab/EthercatCIA402Slave.py Fri Sep 28 17:52:30 2018 +0300
+++ b/etherlab/EthercatCIA402Slave.py Fri Sep 28 17:59:28 2018 +0300
@@ -324,9 +324,9 @@
# Write generated content to CIA402 node file
Gen_CIA402Nodefile_path = os.path.join(buildpath,
- "cia402node_%s.c"%location_str)
+ "cia402node_%s.c" % location_str) cia402nodefile = open(Gen_CIA402Nodefile_path, 'w')
cia402nodefile.write(plc_cia402node_code % locals())
- return [(Gen_CIA402Nodefile_path, '"-I%s"'%os.path.abspath(self.GetCTRoot().GetIECLibPath()))],"",True
+ return [(Gen_CIA402Nodefile_path, '"-I%s"' % os.path.abspath(self.GetCTRoot().GetIECLibPath()))],"",True --- a/etherlab/EthercatMaster.py Fri Sep 28 17:52:30 2018 +0300
+++ b/etherlab/EthercatMaster.py Fri Sep 28 17:59:28 2018 +0300
@@ -661,7 +661,7 @@
"IEC_type": entry["Type"],
"var_name": "%s_%4.4x_%2.2x" % ("_".join(device_name.split()), index, subindex),
- "location": "%s%s%s"%(var_dir, var_size, ".".join(map(str, current_location +
+ "location": "%s%s%s" % (var_dir, var_size, ".".join(map(str, current_location + @@ -703,7 +703,7 @@
# define a unique name for the generated C file
location_str = "_".join(map(lambda x:str(x), current_location))
- Gen_Ethercatfile_path = os.path.join(buildpath, "ethercat_%s.c"%location_str)
+ Gen_Ethercatfile_path = os.path.join(buildpath, "ethercat_%s.c" % location_str) self.FileGenerator = _EthercatCFileGenerator(self)
@@ -738,7 +738,7 @@
LocationCFilesAndCFLAGS.insert(0,
- [(Gen_Ethercatfile_path, '"-I%s"'%os.path.abspath(self.GetCTRoot().GetIECLibPath()))],
+ [(Gen_Ethercatfile_path, '"-I%s"' % os.path.abspath(self.GetCTRoot().GetIECLibPath()))], LDFLAGS.append("-lethercat_rtdm -lrtdm")
--- a/etherlab/runtime_etherlab.py Fri Sep 28 17:52:30 2018 +0300
+++ b/etherlab/runtime_etherlab.py Fri Sep 28 17:59:28 2018 +0300
@@ -46,7 +46,7 @@
LogLevelsDict["WARNING"],
- "%s : %s"%(command,output))
+ "%s : %s" % (command,output)) def EthercatSDOUpload(pos, index, subindex, var_type):