# HG changeset patch # User Andrey Skvortsov # Date 1502877472 -10800 # Node ID c28db6f7616be1dfd99853e663cd439852547228 # Parent acf02488f37f4727386dfc32032e97294d0ec4db clean-up: fix PEP8 E301 expected 1 blank line, found 0 diff -r acf02488f37f -r c28db6f7616b BeremizIDE.py --- a/BeremizIDE.py Wed Aug 16 12:53:23 2017 +0300 +++ b/BeremizIDE.py Wed Aug 16 12:57:52 2017 +0300 @@ -597,6 +597,7 @@ # Twisted reactor needs to be stopped only before quit, # since it cannot be restarted ToDoBeforeQuit = [] + def AddToDoBeforeQuit(self, Thing): self.ToDoBeforeQuit.append(Thing) diff -r acf02488f37f -r c28db6f7616b PLCControler.py --- a/PLCControler.py Wed Aug 16 12:53:23 2017 +0300 +++ b/PLCControler.py Wed Aug 16 12:57:52 2017 +0300 @@ -155,9 +155,11 @@ class _VariableInfos(object): __slots__ = ["Name", "Class", "Option", "Location", "InitialValue", "Edit", "Documentation", "Type", "Tree", "Number"] + def __init__(self, *args): for attr, value in zip(self.__slots__, args): setattr(self, attr, value if value is not None else "") + def copy(self): return _VariableInfos(*[getattr(self, attr) for attr in self.__slots__]) @@ -226,9 +228,11 @@ class _VariablesTreeItemInfos(object): __slots__ = ["name", "var_class", "type", "edit", "debug", "variables"] + def __init__(self, *args): for attr, value in zip(self.__slots__, args): setattr(self, attr, value if value is not None else "") + def copy(self): return _VariableTreeItem(*[getattr(self, attr) for attr in self.__slots__]) @@ -372,9 +376,11 @@ class _ActionInfos(object): __slots__ = ["qualifier", "type", "value", "duration", "indicator"] + def __init__(self, *args): for attr, value in zip(self.__slots__, args): setattr(self, attr, value if value is not None else "") + def copy(self): return _ActionInfos(*[getattr(self, attr) for attr in self.__slots__]) diff -r acf02488f37f -r c28db6f7616b PLCGenerator.py --- a/PLCGenerator.py Wed Aug 16 12:53:23 2017 +0300 +++ b/PLCGenerator.py Wed Aug 16 12:57:52 2017 +0300 @@ -695,14 +695,15 @@ self.Interface.append((varTypeNames[varlist_type], option, True, located)) LITERAL_TYPES = { - "T": "TIME", - "D": "DATE", + "T": "TIME", + "D": "DATE", "TOD": "TIME_OF_DAY", - "DT": "DATE_AND_TIME", - "2": None, - "8": None, - "16": None, + "DT": "DATE_AND_TIME", + "2": None, + "8": None, + "16": None, } + def ComputeConnectionTypes(self, pou): body = pou.getbody() if isinstance(body, ListType): diff -r acf02488f37f -r c28db6f7616b ProjectController.py --- a/ProjectController.py Wed Aug 16 12:53:23 2017 +0300 +++ b/ProjectController.py Wed Aug 16 12:57:52 2017 +0300 @@ -1180,18 +1180,22 @@ self.AppFrame.ShowError(infos, start, end) _IECCodeView = None + def _showIECcode(self): self._OpenView("IEC code") _IECRawCodeView = None + def _editIECrawcode(self): self._OpenView("IEC raw code") _ProjectFilesView = None + def _OpenProjectFiles(self): self._OpenView("Project Files") _FileEditors = {} + def _OpenFileEditor(self, filepath): self._OpenView(filepath) diff -r acf02488f37f -r c28db6f7616b canfestival/canfestival.py --- a/canfestival/canfestival.py Wed Aug 16 12:53:23 2017 +0300 +++ b/canfestival/canfestival.py Wed Aug 16 12:57:52 2017 +0300 @@ -365,6 +365,7 @@ } _GeneratedMasterView = None + def _ShowGeneratedMaster(self): self._OpenView("Generated master") @@ -482,6 +483,7 @@ CTNChildrenTypes = [("CanOpenNode", _NodeListCTN, "CanOpen Master"), ("CanOpenSlave", _SlaveCTN, "CanOpen Slave")] + def GetParamsAttributes(self, path=None): infos = ConfigTreeNode.GetParamsAttributes(self, path=path) for element in infos: diff -r acf02488f37f -r c28db6f7616b plcopen/plcopen.py --- a/plcopen/plcopen.py Wed Aug 16 12:53:23 2017 +0300 +++ b/plcopen/plcopen.py Wed Aug 16 12:57:52 2017 +0300 @@ -435,6 +435,7 @@ datatypes_xpath = PLCOpen_XPath("ppx:types/ppx:dataTypes/ppx:dataType") filtered_datatypes_xpath = PLCOpen_XPath( "ppx:types/ppx:dataTypes/ppx:dataType[@name!=$exclude]") + def getdataTypes(self, exclude=None): if exclude is not None: return filtered_datatypes_xpath(self, exclude=exclude) @@ -483,12 +484,14 @@ configurations_xpath = PLCOpen_XPath( "ppx:instances/ppx:configurations/ppx:configuration") + def getconfigurations(self): return configurations_xpath(self) setattr(cls, "getconfigurations", getconfigurations) configuration_xpath = PLCOpen_XPath( "ppx:instances/ppx:configurations/ppx:configuration[@name=$name]") + def getconfiguration(self, name): configurations = configuration_xpath(self, name=name) if len(configurations) == 1: @@ -513,6 +516,7 @@ resources_xpath = PLCOpen_XPath( "ppx:instances/ppx:configurations/ppx:configuration[@name=$configname]/ppx:resource[@name=$name]") + def getconfigurationResource(self, config_name, name): resources = resources_xpath(self, configname=config_name, name=name) if len(resources) == 1: @@ -578,6 +582,7 @@ enumerated_values_xpath = PLCOpen_XPath( "ppx:types/ppx:dataTypes/ppx:dataType/ppx:baseType/ppx:enum/ppx:values/ppx:value") + def GetEnumeratedDataTypeValues(self): return [value.getname() for value in enumerated_values_xpath(self)] setattr(cls, "GetEnumeratedDataTypeValues", GetEnumeratedDataTypeValues) @@ -1070,6 +1075,7 @@ setattr(cls, "updateElementName", updateElementName) enumerated_datatype_values_xpath = PLCOpen_XPath("ppx:values/ppx:value") + def Search(self, criteria, parent_infos=[]): search_result = [] for i, value in enumerate(enumerated_datatype_values_xpath(self)): @@ -1094,6 +1100,7 @@ "ppx:interface/*[self::ppx:inputVars or self::ppx:inOutVars]/ppx:variable") block_outputs_xpath = PLCOpen_XPath( "ppx:interface/*[self::ppx:outputVars or self::ppx:inOutVars]/ppx:variable") + def getblockInfos(self): block_infos = { "name": self.getname(), @@ -1626,6 +1633,7 @@ if cls: cls.currentExecutionOrderId = 0 cls.checkedBlocksDict = {} + def resetcurrentExecutionOrderId(self): object.__setattr__(self, "currentExecutionOrderId", 0) setattr(cls, "resetcurrentExecutionOrderId", resetcurrentExecutionOrderId) @@ -1717,6 +1725,7 @@ instance_by_id_xpath = PLCOpen_XPath("*[@localId=$localId]") instance_by_name_xpath = PLCOpen_XPath("ppx:block[@instanceName=$name]") + def getcontentInstance(self, local_id): if self.content.getLocalTag() in ["LD", "FBD", "SFC"]: instance = instance_by_id_xpath(self.content, localId=local_id) @@ -2413,6 +2422,7 @@ connection_xpath = PLCOpen_XPath("ppx:connection") connection_by_position_xpath = PLCOpen_XPath("ppx:connection[position()=$pos]") + def getconnections(self): return connection_xpath(self) setattr(cls, "getconnections", getconnections) diff -r acf02488f37f -r c28db6f7616b py_ext/PythonFileCTNMixin.py --- a/py_ext/PythonFileCTNMixin.py Wed Aug 16 12:53:23 2017 +0300 +++ b/py_ext/PythonFileCTNMixin.py Wed Aug 16 12:57:52 2017 +0300 @@ -87,6 +87,7 @@ PreSectionsTexts = {} PostSectionsTexts = {} + def GetSection(self, section): return self.PreSectionsTexts.get(section, "") + "\n" + \ getattr(self.CodeFile, section).getanyText() + "\n" + \ diff -r acf02488f37f -r c28db6f7616b runtime/WampClient.py --- a/runtime/WampClient.py Wed Aug 16 12:53:23 2017 +0300 +++ b/runtime/WampClient.py Wed Aug 16 12:57:52 2017 +0300 @@ -88,6 +88,7 @@ def clientConnectionFailed(self, connector, reason): print("WAMP Client connection failed .. retrying ..") self.retry(connector) + def clientConnectionLost(self, connector, reason): print("WAMP Client connection lost .. retrying ..") self.retry(connector) diff -r acf02488f37f -r c28db6f7616b svgui/pyjs/jsonrpc/jsonrpc.py --- a/svgui/pyjs/jsonrpc/jsonrpc.py Wed Aug 16 12:53:23 2017 +0300 +++ b/svgui/pyjs/jsonrpc/jsonrpc.py Wed Aug 16 12:57:52 2017 +0300 @@ -11,6 +11,7 @@ def response(self, id, result): return simplejson.dumps({'version': '1.1', 'id': id, 'result': result, 'error': None}) + def error(self, id, code, message): return simplejson.dumps({'id': id, 'version': '1.1', diff -r acf02488f37f -r c28db6f7616b targets/Linux/__init__.py --- a/targets/Linux/__init__.py Wed Aug 16 12:53:23 2017 +0300 +++ b/targets/Linux/__init__.py Wed Aug 16 12:57:52 2017 +0300 @@ -28,7 +28,9 @@ class Linux_target(toolchain_gcc): dlopen_prefix = "./" extension = ".so" + def getBuilderCFLAGS(self): return toolchain_gcc.getBuilderCFLAGS(self) + ["-fPIC"] + def getBuilderLDFLAGS(self): return toolchain_gcc.getBuilderLDFLAGS(self) + ["-shared", "-lrt"] diff -r acf02488f37f -r c28db6f7616b targets/Win32/__init__.py --- a/targets/Win32/__init__.py Wed Aug 16 12:53:23 2017 +0300 +++ b/targets/Win32/__init__.py Wed Aug 16 12:57:52 2017 +0300 @@ -28,5 +28,6 @@ class Win32_target(toolchain_gcc): dlopen_prefix = "" extension = ".dll" + def getBuilderLDFLAGS(self): return toolchain_gcc.getBuilderLDFLAGS(self) + ["-shared", "-lwinmm"] diff -r acf02488f37f -r c28db6f7616b targets/Xenomai/__init__.py --- a/targets/Xenomai/__init__.py Wed Aug 16 12:53:23 2017 +0300 +++ b/targets/Xenomai/__init__.py Wed Aug 16 12:57:52 2017 +0300 @@ -28,6 +28,7 @@ class Xenomai_target(toolchain_gcc): dlopen_prefix = "./" extension = ".so" + def getXenoConfig(self, flagsname): """ Get xeno-config from target parameters """ xeno_config = self.CTRInstance.GetTarget().getcontent().getXenoConfig()