# HG changeset patch # User Andrey Skvortsov # Date 1502952939 -10800 # Node ID 845ca626db09507b7e0c68b2668a06b0bac323db # Parent 0de89da92ee0d1ae526a1fcc6344d69713c3fc33 clean-up: fix PEP8 E222 multiple spaces after operator diff -r 0de89da92ee0 -r 845ca626db09 CodeFileTreeNode.py --- a/CodeFileTreeNode.py Wed Aug 16 17:27:58 2017 +0300 +++ b/CodeFileTreeNode.py Thu Aug 17 09:55:39 2017 +0300 @@ -197,9 +197,9 @@ def CTNGlobalInstances(self): variables = self.CodeFileVariables(self.CodeFile) - ret = [(variable.getname(), - variable.gettype(), - variable.getinitial()) + ret = [(variable.getname(), + variable.gettype(), + variable.getinitial()) for variable in variables] ret.extend([("On"+variable.getname()+"Change", "python_poll", "") for variable in variables diff -r 0de89da92ee0 -r 845ca626db09 ConfigTreeNode.py --- a/ConfigTreeNode.py Wed Aug 16 17:27:58 2017 +0300 +++ b/ConfigTreeNode.py Thu Aug 17 09:55:39 2017 +0300 @@ -452,12 +452,12 @@ res = DesiredChannel while res in AllChannels: # While channel not free if res < CurrentChannel: # Want to go down ? - res -= 1 # Test for n-1 + res -= 1 # Test for n-1 if res < 0: self.GetCTRoot().logger.write_warning(_("Cannot find lower free IEC channel than %d\n") % CurrentChannel) return CurrentChannel # Can't go bellow 0, do nothing else: # Want to go up ? - res += 1 # Test for n-1 + res += 1 # Test for n-1 # Finally set IEC Channel self.BaseParams.setIEC_Channel(res) return res diff -r 0de89da92ee0 -r 845ca626db09 ProjectController.py --- a/ProjectController.py Wed Aug 16 17:27:58 2017 +0300 +++ b/ProjectController.py Thu Aug 17 09:55:39 2017 +0300 @@ -1122,7 +1122,7 @@ self.ResetBuildMD5() return False - self.LocationCFilesAndCFLAGS = LibCFilesAndCFLAGS + CTNLocationCFilesAndCFLAGS + self.LocationCFilesAndCFLAGS = LibCFilesAndCFLAGS + CTNLocationCFilesAndCFLAGS self.LDFLAGS = CTNLDFLAGS + LibLDFLAGS ExtraFiles = CTNExtraFiles + LibExtraFiles diff -r 0de89da92ee0 -r 845ca626db09 controls/FolderTree.py --- a/controls/FolderTree.py Wed Aug 16 17:27:58 2017 +0300 +++ b/controls/FolderTree.py Thu Aug 17 09:55:39 2017 +0300 @@ -215,7 +215,7 @@ os.rename(old_filepath, new_filepath) event.Skip() else: - message = wx.MessageDialog(self, + message = wx.MessageDialog(self, _("File '%s' already exists!") % new_name, _("Error"), wx.OK | wx.ICON_ERROR) message.ShowModal() diff -r 0de89da92ee0 -r 845ca626db09 controls/VariablePanel.py --- a/controls/VariablePanel.py Wed Aug 16 17:27:58 2017 +0300 +++ b/controls/VariablePanel.py Thu Aug 17 09:55:39 2017 +0300 @@ -512,13 +512,15 @@ "Variables", " Local", " Temp"] #,"Access"] # these condense the ColAlignements list - left = wx.ALIGN_LEFT + left = wx.ALIGN_LEFT center = wx.ALIGN_CENTER # Num Name Class Type Loc Init Option Doc - self.ColSizes = [40, 80, 100, 80, 110, 120, 100, 160] - self.ColAlignements = [center, left, left, left, left, left, left, left] - self.ColFixedSizeFlag = [True, False, True, False, True, True, True, False] + self.ColSettings = { + "size": [40, 80, 100, 80, 110, 120, 100, 160], + "alignement": [center, left, left, left, left, left, left, left], + "fixed_size": [True, False, True, False, True, True, True, False], + } else: # this is an element that cannot have located variables @@ -533,16 +535,18 @@ "Interface", " Input", " Output", " InOut", " External", "Variables", " Local", " Temp"] - # these condense the ColAlignements list - left = wx.ALIGN_LEFT + # these condense the alignements list + left = wx.ALIGN_LEFT center = wx.ALIGN_CENTER # Num Name Class Type Init Option Doc - self.ColSizes = [40, 80, 100, 80, 120, 100, 160] - self.ColAlignements = [center, left, left, left, left, left, left] - self.ColFixedSizeFlag = [True, False, True, False, True, True, False] - - self.PanelWidthMin = sum(self.ColSizes) + self.ColSettings = { + "size": [40, 80, 100, 80, 120, 100, 160], + "alignement": [center, left, left, left, left, left, left], + "fixed_size": [True, False, True, False, True, True, False], + } + + self.PanelWidthMin = sum(self.ColSettings["size"]) self.ElementType = element_type self.BodyType = None @@ -654,22 +658,22 @@ if panel_width > self.PanelWidthMin: stretch_cols_width = panel_width stretch_cols_sum = 0 - for col in range(len(self.ColFixedSizeFlag)): - if self.ColFixedSizeFlag[col]: - stretch_cols_width -= self.ColSizes[col] + for col in range(len(self.ColSettings["fixed_size"])): + if self.ColSettings["fixed_size"][col]: + stretch_cols_width -= self.ColSettings["size"][col] else: - stretch_cols_sum += self.ColSizes[col] + stretch_cols_sum += self.ColSettings["size"][col] self.VariablesGrid.SetRowLabelSize(0) for col in range(self.Table.GetNumberCols()): attr = wx.grid.GridCellAttr() - attr.SetAlignment(self.ColAlignements[col], wx.ALIGN_CENTRE) + attr.SetAlignment(self.ColSettings["alignement"][col], wx.ALIGN_CENTRE) self.VariablesGrid.SetColAttr(col, attr) - self.VariablesGrid.SetColMinimalWidth(col, self.ColSizes[col]) - if (panel_width > self.PanelWidthMin) and not self.ColFixedSizeFlag[col]: - self.VariablesGrid.SetColSize(col, int((float(self.ColSizes[col])/stretch_cols_sum)*stretch_cols_width)) + self.VariablesGrid.SetColMinimalWidth(col, self.ColSettings["size"][col]) + if (panel_width > self.PanelWidthMin) and not self.ColSettings["fixed_size"][col]: + self.VariablesGrid.SetColSize(col, int((float(self.ColSettings["size"][col])/stretch_cols_sum)*stretch_cols_width)) else: - self.VariablesGrid.SetColSize(col, self.ColSizes[col]) + self.VariablesGrid.SetColSize(col, self.ColSettings["size"][col]) def __del__(self): self.RefreshHighlightsTimer.Stop() diff -r 0de89da92ee0 -r 845ca626db09 dialogs/DiscoveryDialog.py --- a/dialogs/DiscoveryDialog.py Wed Aug 16 17:27:58 2017 +0300 +++ b/dialogs/DiscoveryDialog.py Thu Aug 17 09:55:39 2017 +0300 @@ -227,10 +227,10 @@ ''' info = self.ZeroConfInstance.getServiceInfo(_type, name) - svcname = name.split(".")[0] + svcname = name.split(".")[0] typename = _type.split(".")[0][1:] - ip = str(socket.inet_ntoa(info.getAddress())) - port = info.getPort() + ip = str(socket.inet_ntoa(info.getAddress())) + port = info.getPort() num_items = self.ServicesList.GetItemCount() diff -r 0de89da92ee0 -r 845ca626db09 editors/ConfTreeNodeEditor.py --- a/editors/ConfTreeNodeEditor.py Wed Aug 16 17:27:58 2017 +0300 +++ b/editors/ConfTreeNodeEditor.py Thu Aug 17 09:55:39 2017 +0300 @@ -298,7 +298,7 @@ self.Thaw() def GenerateMethodButtonSizer(self): - normal_bt_font = wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"]) + normal_bt_font = wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"]) mouseover_bt_font = wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"], underline=True) msizer = wx.BoxSizer(wx.HORIZONTAL) diff -r 0de89da92ee0 -r 845ca626db09 editors/TextViewer.py --- a/editors/TextViewer.py Wed Aug 16 17:27:58 2017 +0300 +++ b/editors/TextViewer.py Thu Aug 17 09:55:39 2017 +0300 @@ -545,7 +545,7 @@ else: level = self.Editor.GetFoldLevel(line_number - 1) & wx.stc.STC_FOLDLEVELNUMBERMASK if level != wx.stc.STC_FOLDLEVELBASE: - level |= wx.stc.STC_FOLDLEVELWHITEFLAG + level |= wx.stc.STC_FOLDLEVELWHITEFLAG elif LineStartswith(line, self.BlockStartKeywords): level |= wx.stc.STC_FOLDLEVELHEADERFLAG elif LineStartswith(line, self.BlockEndKeywords): diff -r 0de89da92ee0 -r 845ca626db09 graphics/GraphicCommons.py --- a/graphics/GraphicCommons.py Wed Aug 16 17:27:58 2017 +0300 +++ b/graphics/GraphicCommons.py Thu Aug 17 09:55:39 2017 +0300 @@ -1083,7 +1083,7 @@ if self.Edge == "rising" and self.Direction[1] == 1: y -= 5 height += 5 - rect = wx.Rect(x - abs(movex), y - abs(movey), width + 2 * abs(movex), height + 2 * abs(movey)) + rect = wx.Rect(x - abs(movex), y - abs(movey), width + 2 * abs(movex), height + 2 * abs(movey)) if self.ValueSize is None and isinstance(self.ComputedValue, (StringType, UnicodeType)): self.ValueSize = self.ParentBlock.Parent.GetMiniTextExtent(self.ComputedValue) if self.ValueSize is not None: diff -r 0de89da92ee0 -r 845ca626db09 graphics/SFC_Objects.py --- a/graphics/SFC_Objects.py Wed Aug 16 17:27:58 2017 +0300 +++ b/graphics/SFC_Objects.py Thu Aug 17 09:55:39 2017 +0300 @@ -587,7 +587,7 @@ self.Priority = 0 self.Size = wx.Size(SFC_TRANSITION_SIZE[0], SFC_TRANSITION_SIZE[1]) # Create an input and output connector - self.Input = Connector(self, "", None, wx.Point(self.Size[0] / 2, 0), NORTH, onlyone=True) + self.Input = Connector(self, "", None, wx.Point(self.Size[0] / 2, 0), NORTH, onlyone=True) self.Output = Connector(self, "", None, wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH, onlyone=True) self.SetType(type, condition) self.SetPriority(priority) diff -r 0de89da92ee0 -r 845ca626db09 i18n/mki18n.py --- a/i18n/mki18n.py Wed Aug 16 17:27:58 2017 +0300 +++ b/i18n/mki18n.py Thu Aug 17 09:55:39 2017 +0300 @@ -88,7 +88,7 @@ # ---------------- # -__author__ = "Pierre Rouleau" +__author__ = "Pierre Rouleau" __version__ = "$Revision: 1.5 $" # ----------------------------------------------------------------------------- diff -r 0de89da92ee0 -r 845ca626db09 plcopen/structures.py --- a/plcopen/structures.py Wed Aug 16 17:27:58 2017 +0300 +++ b/plcopen/structures.py Thu Aug 17 09:55:39 2017 +0300 @@ -233,11 +233,11 @@ decl_tpl = Function_decl["outputs"][0] Function_decl["outputs"] = [(decl_tpl[0], outype, decl_tpl[2])] if funcdeclname_orig.endswith('*'): - funcdeclout = funcdeclin + '_' + outype + funcdeclout = funcdeclin + '_' + outype else: - funcdeclout = funcdeclin + funcdeclout = funcdeclin else: - funcdeclout = funcdeclin + funcdeclout = funcdeclin Function_decl["name"] = funcdeclout # apply filter given in "filter" column diff -r 0de89da92ee0 -r 845ca626db09 svgui/pyjs/build.py --- a/svgui/pyjs/build.py Wed Aug 16 17:27:58 2017 +0300 +++ b/svgui/pyjs/build.py Thu Aug 17 09:55:39 2017 +0300 @@ -138,9 +138,9 @@ """ - filename = os.path.split (source_file)[1] - mod_name = os.path.splitext(filename)[0] - file_name = os.path.join (dest_path, mod_name + '.html') + filename = os.path.split(source_file)[1] + mod_name = os.path.splitext(filename)[0] + file_name = os.path.join(dest_path, mod_name + '.html') # if html file in output directory exists, leave it alone. if os.path.exists (file_name): diff -r 0de89da92ee0 -r 845ca626db09 targets/__init__.py --- a/targets/__init__.py Wed Aug 16 17:27:58 2017 +0300 +++ b/targets/__init__.py Thu Aug 17 09:55:39 2017 +0300 @@ -74,7 +74,7 @@ # Get all xsd targets for targetname, nfo in targets.iteritems(): xsd_string = open(nfo["xsd"]).read() - targetchoices += xsd_string % DictXSD_toolchain + targetchoices += xsd_string % DictXSD_toolchain return targetchoices diff -r 0de89da92ee0 -r 845ca626db09 targets/toolchain_gcc.py --- a/targets/toolchain_gcc.py Wed Aug 16 17:27:58 2017 +0300 +++ b/targets/toolchain_gcc.py Thu Aug 17 09:55:39 2017 +0300 @@ -29,7 +29,7 @@ from util.ProcessLogger import ProcessLogger import hashlib -includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*') +includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*') class toolchain_gcc(): diff -r 0de89da92ee0 -r 845ca626db09 targets/toolchain_makefile.py --- a/targets/toolchain_makefile.py Wed Aug 16 17:27:58 2017 +0300 +++ b/targets/toolchain_makefile.py Thu Aug 17 09:55:39 2017 +0300 @@ -30,7 +30,7 @@ import time -includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*') +includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*') class toolchain_makefile(): diff -r 0de89da92ee0 -r 845ca626db09 targets/typemapping.py --- a/targets/typemapping.py Wed Aug 16 17:27:58 2017 +0300 +++ b/targets/typemapping.py Thu Aug 17 09:55:39 2017 +0300 @@ -90,11 +90,11 @@ TypeTranslator = SameEndianessTypeTranslator # Construct debugger natively supported types -DebugTypesSize = dict([(key, sizeof(t)) for key, (t, p, u) in SameEndianessTypeTranslator.iteritems() if t is not None]) +DebugTypesSize = dict([(key, sizeof(t)) for key, (t, p, u) in SameEndianessTypeTranslator.iteritems() if t is not None]) def UnpackDebugBuffer(buff, indexes): - res = [] + res = [] buffoffset = 0 buffsize = len(buff) buffptr = cast(ctypes.pythonapi.PyString_AsString(id(buff)), c_void_p).value diff -r 0de89da92ee0 -r 845ca626db09 util/Zeroconf.py --- a/util/Zeroconf.py Wed Aug 16 17:27:58 2017 +0300 +++ b/util/Zeroconf.py Thu Aug 17 09:55:39 2017 +0300 @@ -150,7 +150,7 @@ _TYPE_TXT = 16 _TYPE_AAAA = 28 _TYPE_SRV = 33 -_TYPE_ANY = 255 +_TYPE_ANY = 255 # Mapping constants to names @@ -530,7 +530,7 @@ def readString(self, len): """Reads a string of a given length from the packet""" format = '!' + str(len) + 's' - length = struct.calcsize(format) + length = struct.calcsize(format) info = struct.unpack(format, self.data[self.offset:self.offset+length]) self.offset += length return info[0] diff -r 0de89da92ee0 -r 845ca626db09 version.py --- a/version.py Wed Aug 16 17:27:58 2017 +0300 +++ b/version.py Thu Aug 17 09:55:39 2017 +0300 @@ -73,7 +73,8 @@ info.Name = "Beremiz" info.Version = app_version - info.Copyright = "(C) 2016 Andrey Skvortsov\n" + info.Copyright = "" + info.Copyright += "(C) 2016-2017 Andrey Skvortsov\n" info.Copyright += "(C) 2008-2015 Eduard Tisserant\n" info.Copyright += "(C) 2008-2015 Laurent Bessard" @@ -123,7 +124,7 @@ return info -app_version = "1.2" +app_version = "1.2" rev = GetAppRevision() if rev is not None: app_version = app_version + "-" + rev.rstrip() diff -r 0de89da92ee0 -r 845ca626db09 xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Wed Aug 16 17:27:58 2017 +0300 +++ b/xmlclass/xmlclass.py Thu Aug 17 09:55:39 2017 +0300 @@ -875,7 +875,7 @@ def ExtractNodeAttrs(self, element_name, node, valid_attrs): attrs = {} for qualified_name, attr in node._attrs.items(): - namespace, name = DecomposeQualifiedName(qualified_name) + namespace, name = DecomposeQualifiedName(qualified_name) if name in valid_attrs: infos = self.GetQualifiedNameInfos(name, namespace) if infos["type"] != SYNTAXATTRIBUTE: