# HG changeset patch # User Edouard Tisserant # Date 1553258719 -3600 # Node ID 245644bfcd245d26dafe1c99a2065f22914c8f2d # Parent f2af2a655868c23ccea079f64afe15a75c37d832 Make spaghetti-code-quality great again. diff -r f2af2a655868 -r 245644bfcd24 BeremizIDE.py --- a/BeremizIDE.py Fri Mar 22 13:26:31 2019 +0100 +++ b/BeremizIDE.py Fri Mar 22 13:45:19 2019 +0100 @@ -1034,11 +1034,11 @@ IDEFrame.ProjectTreeItemSelect(self, select_item) def GetProjectElementWindow(self, element, tagname): - is_a_CTN_tagname = len(tagname.split("::"))==1 + is_a_CTN_tagname = len(tagname.split("::")) == 1 if is_a_CTN_tagname: confnode = self.CTR.GetChildByName(tagname) - return confnode.GetView() - else : + return confnode.GetView() + else: return IDEFrame.GetProjectElementWindow(self, element, tagname) def SelectProjectTreeItem(self, tagname): diff -r f2af2a655868 -r 245644bfcd24 ConfigTreeNode.py --- a/ConfigTreeNode.py Fri Mar 22 13:26:31 2019 +0100 +++ b/ConfigTreeNode.py Fri Mar 22 13:45:19 2019 +0100 @@ -37,6 +37,7 @@ import types import shutil from operator import add +from functools import reduce from builtins import str as text from past.builtins import execfile diff -r f2af2a655868 -r 245644bfcd24 PLCControler.py --- a/PLCControler.py Fri Mar 22 13:26:31 2019 +0100 +++ b/PLCControler.py Fri Mar 22 13:45:19 2019 +0100 @@ -2749,8 +2749,8 @@ # ------------------------------------------------------------------------------- def SearchInProject(self, criteria): - project_matches = self.Project.Search(criteria) - ctn_matches = self.CTNSearch(criteria) + project_matches = self.Project.Search(criteria) + ctn_matches = self.CTNSearch(criteria) return project_matches + ctn_matches def SearchInPou(self, tagname, criteria, debug=False): diff -r f2af2a655868 -r 245644bfcd24 controls/SearchResultPanel.py --- a/controls/SearchResultPanel.py Fri Mar 22 13:26:31 2019 +0100 +++ b/controls/SearchResultPanel.py Fri Mar 22 13:45:19 2019 +0100 @@ -131,8 +131,7 @@ ("ACTION", "action_block"), ("IL", "IL"), ("ST", "ST"), - ("FILE", ITEM_CONFNODE), - ]: + ("FILE", ITEM_CONFNODE)]: self.TreeImageDict[itemtype] = self.TreeImageList.Add(GetBitmap(imgname)) for itemtype in ["function", "functionBlock", "program", @@ -205,10 +204,10 @@ children = element_infos.setdefault("children", []) for infos, start, end, text in results: if len(words) == 1: # CTN match - child_name = {"body":str(start[0])+":", - "var_inout":_("Variable:")}[infos[1]] - child_type = {"body":ITEM_CONFNODE, - "var_inout":"var_inout"}[infos[1]] + child_name = {"body": str(start[0])+":", + "var_inout": _("Variable:")}[infos[1]] + child_type = {"body": ITEM_CONFNODE, + "var_inout": "var_inout"}[infos[1]] elif infos[1] == "name" or element_type == ITEM_DATATYPE: child_name = GenerateName(infos[1:]) child_type = element_type diff -r f2af2a655868 -r 245644bfcd24 editors/CodeFileEditor.py --- a/editors/CodeFileEditor.py Fri Mar 22 13:26:31 2019 +0100 +++ b/editors/CodeFileEditor.py Fri Mar 22 13:45:19 2019 +0100 @@ -71,6 +71,7 @@ text += "\n" return text + class CodeEditor(CustomStyledTextCtrl): KEYWORDS = [] @@ -255,8 +256,8 @@ def GetCodeText(self): return GetSectionsText( - self.Controler, - lambda section : self.SectionsComments[section]["comment"]) + self.Controler, + lambda section: self.SectionsComments[section]["comment"]) def RefreshView(self, scroll_to_highlight=False): self.ResetBuffer() @@ -885,6 +886,7 @@ # CodeFileEditor Main Frame Class # ------------------------------------------------------------------------------- + class CodeFileEditor(ConfTreeNodeEditor): CONFNODEEDITOR_TABS = [] diff -r f2af2a655868 -r 245644bfcd24 xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Fri Mar 22 13:26:31 2019 +0100 +++ b/xmlclass/xmlclass.py Fri Mar 22 13:45:19 2019 +0100 @@ -28,11 +28,11 @@ import os import re import datetime +from functools import reduce from xml.dom import minidom from xml.sax.saxutils import unescape from collections import OrderedDict from builtins import str as text -from functools import reduce from six import string_types from six.moves import xrange