# HG changeset patch # User Andrey Skvortsov # Date 1538222597 -10800 # Node ID b35bce45bc5a31de40b584db9082aee2edf1b110 # Parent 015b724c30a5ef6ca70d980e7107acdffe96e4ba clean etherlab: pep8, E127 continuation line over-indented for visual indent diff -r 015b724c30a5 -r b35bce45bc5a etherlab/EtherCATManagementEditor.py --- a/etherlab/EtherCATManagementEditor.py Sat Sep 29 14:57:15 2018 +0300 +++ b/etherlab/EtherCATManagementEditor.py Sat Sep 29 15:03:17 2018 +0300 @@ -170,7 +170,7 @@ self.StaticTextDic[statictext_name] = wx.StaticText(self, label=_(statictext_label)) self.TextCtrlDic[textctrl_name] = wx.TextCtrl(self, size=wx.DefaultSize, style=wx.TE_READONLY) self.SizerDic["SlaveState_up_sizer"].AddMany([self.StaticTextDic[statictext_name], - self.TextCtrlDic[textctrl_name]]) + self.TextCtrlDic[textctrl_name]]) for button_name, button_label, button_tooltipstring, event_method in [ ("StartTimerButton", "Start State Monitoring", "Slave State Update Restart", self.StartTimer), @@ -552,7 +552,7 @@ self.CreateGrid(len(self.SDOs), 8) SDOCellSize = [(0, 65), (1, 65), (2, 50), (3, 55), - (4, 40), (5, 200), (6, 250), (7, 85)] + (4, 40), (5, 200), (6, 250), (7, 85)] for (index, size) in SDOCellSize: self.SetColSize(index, size) @@ -1193,11 +1193,11 @@ wx.Panel.__init__(self, parent, -1, size=(350, 500)) self.Tree = wx.gizmos.TreeListCtrl(self, -1, size=(350, 500), - style=wx.TR_DEFAULT_STYLE - | wx.TR_FULL_ROW_HIGHLIGHT - | wx.TR_HIDE_ROOT - | wx.TR_COLUMN_LINES - | wx.TR_ROW_LINES) + style=(wx.TR_DEFAULT_STYLE + | wx.TR_FULL_ROW_HIGHLIGHT + | wx.TR_HIDE_ROOT + | wx.TR_COLUMN_LINES + | wx.TR_ROW_LINES)) self.Tree.AddColumn("Description", width=200) self.Tree.AddColumn("Value", width=140) @@ -1672,7 +1672,8 @@ # add a description to register sub table description dictionary if reg_bit_range is not "" and reg_sub_description is not "": self.RegisterSubGridDict[reg_index].append([reg_bit_range, - reg_sub_description, reg_enum_dictionary]) + reg_sub_description, + reg_enum_dictionary]) def ParseData(self): """ @@ -1778,9 +1779,12 @@ # Update table for index in range(4): - self.RegisterNotebook.RegPage[index].UpdateMainTable(self.MainRow[index], self.MainCol, - self.PageRange[index][0], self.PageRange[index][1], - reg_compact_data) + self.RegisterNotebook.RegPage[index].UpdateMainTable( + self.MainRow[index], + self.MainCol, + self.PageRange[index][0], + self.PageRange[index][1], + reg_compact_data) # Compact View Checkbox is False else: @@ -1794,9 +1798,12 @@ # Update table for index in range(4): - self.RegisterNotebook.RegPage[index].UpdateMainTable(self.MainRow[index], self.MainCol, - self.PageRange[index][0], self.PageRange[index][1], - self.RegMonitorData) + self.RegisterNotebook.RegPage[index].UpdateMainTable( + self.MainRow[index], + self.MainCol, + self.PageRange[index][0], + self.PageRange[index][1], + self.RegMonitorData) # ------------------------------------------------------------------------------- @@ -2087,7 +2094,7 @@ """ # lset label name and size Register_SubTable_Label = [(0, "Bits"), (1, "Name"), - (2, "Value"), (3, "Enum")] + (2, "Value"), (3, "Enum")] for (index, label) in Register_SubTable_Label: self.SetColLabelValue(index, label) diff -r 015b724c30a5 -r b35bce45bc5a etherlab/EthercatCIA402Slave.py --- a/etherlab/EthercatCIA402Slave.py Sat Sep 29 14:57:15 2018 +0300 +++ b/etherlab/EthercatCIA402Slave.py Sat Sep 29 15:03:17 2018 +0300 @@ -149,18 +149,22 @@ def GetVariableLocationTree(self): axis_name = self.CTNName() current_location = self.GetCurrentLocation() - children = [{"name": name_frmt % (axis_name), - "type": LOCATION_VAR_INPUT, - "size": "W", - "IEC_type": iec_type, - "var_name": var_name_frmt % axis_name, - "location": location_frmt % ( - ".".join(map(str, current_location))), - "description": "", - "children": []} - for name_frmt, iec_type, var_name_frmt, location_frmt in - [("%s Network Position", "UINT", "%s_pos", "%%IW%s"), - ("%s Axis Ref", "AXIS_REF", "%s", "%%IW%s.402")]] + children = [ + { + "name": name_frmt % (axis_name), + "type": LOCATION_VAR_INPUT, + "size": "W", + "IEC_type": iec_type, + "var_name": var_name_frmt % axis_name, + "location": location_frmt % (".".join(map(str, current_location))), + "description": "", + "children": [] + } + for name_frmt, iec_type, var_name_frmt, location_frmt in [ + ("%s Network Position", "UINT", "%s_pos", "%%IW%s"), + ("%s Axis Ref", "AXIS_REF", "%s", "%%IW%s.402") + ] + ] children.extend(self.CTNParent.GetDeviceLocationTree( self.GetSlavePos(), current_location, axis_name)) return { diff -r 015b724c30a5 -r b35bce45bc5a etherlab/EthercatMaster.py --- a/etherlab/EthercatMaster.py Sat Sep 29 14:57:15 2018 +0300 +++ b/etherlab/EthercatMaster.py Sat Sep 29 15:03:17 2018 +0300 @@ -430,8 +430,8 @@ write_to = variable.getWriteTo() if write_to is not None: var["WriteTo"] = (write_to.getPosition(), - write_to.getIndex(), - write_to.getSubIndex()) + write_to.getIndex(), + write_to.getSubIndex()) else: var["WriteTo"] = "" variables.append(var) @@ -662,15 +662,17 @@ else: var_dir = "%Q" - vars.append({"name": "0x%4.4x-0x%2.2x: %s" % (index, subindex, entry["Name"]), - "type": var_class, - "size": var_size, - "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 + - (index, subindex)))), - "description": "", - "children": []}) + vars.append({ + "name": "0x%4.4x-0x%2.2x: %s" % (index, subindex, entry["Name"]), + "type": var_class, + "size": var_size, + "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 + + (index, subindex)))), + "description": "", + "children": [], + }) return vars