# HG changeset patch # User Andrey Skvortsov # Date 1502876888 -10800 # Node ID d73b64672238e980a83c772286e3564a938f5c6f # Parent ba5f64fe0e00fd64dcd15f7cd1b5a92b541024c0 clean-up: fix PEP8 E305 expected 2 blank lines after class or function definition diff -r ba5f64fe0e00 -r d73b64672238 Beremiz.py --- a/Beremiz.py Wed Aug 16 12:30:31 2017 +0300 +++ b/Beremiz.py Wed Aug 16 12:48:08 2017 +0300 @@ -191,6 +191,7 @@ self.ProcessCommandLineArgs() self.CreateApplication() + if __name__ == '__main__': beremiz = BeremizIDELauncher() beremiz.Start() diff -r ba5f64fe0e00 -r d73b64672238 BeremizIDE.py --- a/BeremizIDE.py Wed Aug 16 12:30:31 2017 +0300 +++ b/BeremizIDE.py Wed Aug 16 12:48:08 2017 +0300 @@ -41,6 +41,7 @@ def Bpath(*args): return os.path.join(beremiz_dir, *args) + import wx.lib.buttons import wx.lib.statbmp import wx.stc @@ -198,6 +199,7 @@ def isatty(self): return False + ID_FILEMENURECENTPROJECTS = wx.NewId() from IDEFrame import TITLE,\ @@ -1079,6 +1081,7 @@ else: IDEFrame.ShowHighlight(self, infos, start, end, highlight_type) + #------------------------------------------------------------------------------- # Exception Handler #------------------------------------------------------------------------------- diff -r ba5f64fe0e00 -r d73b64672238 Beremiz_service.py --- a/Beremiz_service.py Wed Aug 16 12:30:31 2017 +0300 +++ b/Beremiz_service.py Wed Aug 16 12:48:08 2017 +0300 @@ -47,6 +47,7 @@ working_dir - directory where are stored PLC files """ % sys.argv[0] + try: opts, argv = getopt.getopt(sys.argv[1:], "i:p:n:x:t:a:w:c:e:h") except getopt.GetoptError, err: @@ -159,6 +160,7 @@ __builtin__.__dict__['_'] = unicode_translation # __builtin__.__dict__['_'] = wx.GetTranslation + if enablewx: try: import wxversion @@ -466,6 +468,7 @@ self.servicepublisher = None self.daemon.shutdown(True) + if enabletwisted: import warnings with warnings.catch_warnings(): @@ -538,6 +541,7 @@ else: traceback.print_exception(*exp) + sys.excepthook = LogException @@ -555,6 +559,8 @@ sys.excepthook(*sys.exc_info()) self.run = run_with_except_hook threading.Thread.__init__ = init + + installThreadExcepthook() if havetwisted: diff -r ba5f64fe0e00 -r d73b64672238 IDEFrame.py --- a/IDEFrame.py Wed Aug 16 12:30:31 2017 +0300 +++ b/IDEFrame.py Wed Aug 16 12:48:08 2017 +0300 @@ -215,6 +215,7 @@ else: parent.Append(helpString=help, id=id, kind=kind, item=text) + [TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE, SCALING, PAGETITLES ] = range(10) @@ -244,6 +245,7 @@ remove_function(self.Controler, name) return DeleteElementFunction + if wx.Platform == '__WXMSW__': TAB_BORDER = 6 NOTEBOOK_BORDER = 6 @@ -329,6 +331,7 @@ # IDEFrame Base Class #------------------------------------------------------------------------------- + UNEDITABLE_NAMES_DICT = dict([(_(name), name) for name in UNEDITABLE_NAMES]) @@ -2553,6 +2556,7 @@ # Viewer Printout #------------------------------------------------------------------------------- + UPPER_DIV = lambda x, y: (x / y) + {True: 0, False: 1}[(x % y) == 0] diff -r ba5f64fe0e00 -r d73b64672238 PLCControler.py --- a/PLCControler.py Wed Aug 16 12:30:31 2017 +0300 +++ b/PLCControler.py Wed Aug 16 12:48:08 2017 +0300 @@ -100,6 +100,8 @@ return [_("User-defined POUs"), _("Functions"), _("Function Blocks"), _("Programs"), _("Data Types"), _("Transitions"), _("Actions"), _("Configurations"), _("Resources"), _("Properties")] + + UNEDITABLE_NAMES = GetUneditableNames() [USER_DEFINED_POUS, FUNCTIONS, FUNCTION_BLOCKS, PROGRAMS, DATA_TYPES, TRANSITIONS, ACTIONS, CONFIGURATIONS, @@ -135,6 +137,7 @@ # from xslt to valid arguments #------------------------------------------------------------------------------- + _StringValue = lambda x: x _BoolValue = lambda x: x in ["true", "0"] @@ -297,6 +300,7 @@ # Helpers object for generating pou block instances list #------------------------------------------------------------------------------- + _Point = namedtuple("Point", ["x", "y"]) _BlockInstanceInfos = namedtuple("BlockInstanceInfos", @@ -440,6 +444,7 @@ translated_args = _translate_args([_StringValue] * 5, args) self.SpecificValues[0][0].append(_ActionInfos(*translated_args)) + pou_block_instances_xslt = etree.parse( os.path.join(ScriptDirectory, "plcopen", "pou_block_instances.xslt")) diff -r ba5f64fe0e00 -r d73b64672238 PLCOpenEditor.py --- a/PLCOpenEditor.py Wed Aug 16 12:30:31 2017 +0300 +++ b/PLCOpenEditor.py Wed Aug 16 12:48:08 2017 +0300 @@ -401,6 +401,7 @@ # Exception Handler #------------------------------------------------------------------------------- + Max_Traceback_List_Size = 20 @@ -503,6 +504,7 @@ #sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args) sys.excepthook = handle_exception + if __name__ == '__main__': if wx.VERSION < (3, 0, 0): wx.InitAllImageHandlers() diff -r ba5f64fe0e00 -r d73b64672238 ProjectController.py --- a/ProjectController.py Wed Aug 16 12:30:31 2017 +0300 +++ b/ProjectController.py Wed Aug 16 12:48:08 2017 +0300 @@ -172,6 +172,7 @@ self.ieclib_c_path = self.findLibCPath() return self.ieclib_c_path + iec2c_cfg = Iec2CSettings() diff -r ba5f64fe0e00 -r d73b64672238 canfestival/config_utils.py --- a/canfestival/config_utils.py Wed Aug 16 12:30:31 2017 +0300 +++ b/canfestival/config_utils.py Wed Aug 16 12:48:08 2017 +0300 @@ -673,6 +673,7 @@ pointers[(index, subindex)] = name return pointers + if __name__ == "__main__": import os import sys diff -r ba5f64fe0e00 -r d73b64672238 connectors/WAMP/__init__.py --- a/connectors/WAMP/__init__.py Wed Aug 16 12:30:31 2017 +0300 +++ b/connectors/WAMP/__init__.py Wed Aug 16 12:48:08 2017 +0300 @@ -52,6 +52,7 @@ _WampSession = None print 'WAMP session left' + PLCObjDefaults = { "StartPLC": False, "GetTraceVariables": ("Broken", None), diff -r ba5f64fe0e00 -r d73b64672238 connectors/__init__.py --- a/connectors/__init__.py Wed Aug 16 12:30:31 2017 +0300 +++ b/connectors/__init__.py Wed Aug 16 12:48:08 2017 +0300 @@ -34,6 +34,7 @@ def _GetLocalConnectorClassFactory(name): return lambda: getattr(__import__(name, globals(), locals()), name + "_connector_factory") + connectors = {name: _GetLocalConnectorClassFactory(name) for name in listdir(_base_path) if path.isdir(path.join(_base_path, name)) diff -r ba5f64fe0e00 -r d73b64672238 controls/CustomTree.py --- a/controls/CustomTree.py Wed Aug 16 12:30:31 2017 +0300 +++ b/controls/CustomTree.py Wed Aug 16 12:48:08 2017 +0300 @@ -35,6 +35,7 @@ self._type = (1 if image is not None else 0) self._ExtraImage = image + CT.GenericTreeItem.SetExtraImage = SetExtraImage _DefaultGetCurrentCheckedImage = CT.GenericTreeItem.GetCurrentCheckedImage @@ -44,6 +45,8 @@ if self._ExtraImage is not None: return self._ExtraImage return _DefaultGetCurrentCheckedImage(self) + + CT.GenericTreeItem.GetCurrentCheckedImage = GetCurrentCheckedImage diff -r ba5f64fe0e00 -r d73b64672238 controls/LogViewer.py --- a/controls/LogViewer.py Wed Aug 16 12:30:31 2017 +0300 +++ b/controls/LogViewer.py Wed Aug 16 12:48:08 2017 +0300 @@ -179,6 +179,7 @@ dc.EndDrawing() event.Skip() + BUTTON_SIZE = (70, 15) @@ -223,6 +224,7 @@ self.Position.x + (self.Size.width - w) / 2, self.Position.y + (self.Size.height - h) / 2) + DATE_INFO_SIZE = 10 MESSAGE_INFO_SIZE = 18 @@ -275,6 +277,7 @@ return DATE_INFO_SIZE + MESSAGE_INFO_SIZE return MESSAGE_INFO_SIZE + SECOND = 1 MINUTE = 60 * SECOND HOUR = 60 * MINUTE diff -r ba5f64fe0e00 -r d73b64672238 controls/PouInstanceVariablesPanel.py --- a/controls/PouInstanceVariablesPanel.py Wed Aug 16 12:30:31 2017 +0300 +++ b/controls/PouInstanceVariablesPanel.py Wed Aug 16 12:48:08 2017 +0300 @@ -34,11 +34,15 @@ def SetRightImages(self, images): self._rightimages = images + + CT.GenericTreeItem.SetRightImages = SetRightImages def GetRightImages(self): return self._rightimages + + CT.GenericTreeItem.GetRightImages = GetRightImages @@ -109,6 +113,7 @@ wx.IMAGELIST_DRAW_TRANSPARENT) x_pos += r_image_w + 4 + _ButtonCallbacks = namedtuple("ButtonCallbacks", ["leftdown", "dclick"]) from PLCControler import ITEMS_VARIABLE, ITEM_CONFIGURATION, ITEM_RESOURCE, ITEM_POU, ITEM_TRANSITION, ITEM_ACTION diff -r ba5f64fe0e00 -r d73b64672238 controls/SearchResultPanel.py --- a/controls/SearchResultPanel.py Wed Aug 16 12:30:31 2017 +0300 +++ b/controls/SearchResultPanel.py Wed Aug 16 12:48:08 2017 +0300 @@ -45,6 +45,7 @@ # Search Result Panel #------------------------------------------------------------------------------- + [ID_SEARCHRESULTPANEL, ID_SEARCHRESULTPANELHEADERLABEL, ID_SEARCHRESULTPANELSEARCHRESULTSTREE, ID_SEARCHRESULTPANELRESETBUTTON, ] = [wx.NewId() for _init_ctrls in range(4)] diff -r ba5f64fe0e00 -r d73b64672238 controls/VariablePanel.py --- a/controls/VariablePanel.py Wed Aug 16 12:30:31 2017 +0300 +++ b/controls/VariablePanel.py Wed Aug 16 12:48:08 2017 +0300 @@ -65,6 +65,8 @@ if non_retain: options.append(_("Non-Retain")) return options + + OPTIONS_DICT = dict([(_(option), option) for option in GetOptions()]) @@ -74,6 +76,8 @@ _(" Input"): _("Input"), _(" Output"): _("Output"), _(" InOut"): _("InOut"), _(" External"): _("External"), _("Variables"): _("Variables"), _(" Local"): _("Local"), _(" Temp"): _("Temp"), _("Global"): _("Global")} #, _("Access") : _("Access")} + + VARIABLE_CHOICES_DICT = dict([(_(_class), _class) for _class in GetFilterChoiceTransfer().iterkeys()]) VARIABLE_CLASSES_DICT = dict([(_(_class), _class) for _class in GetFilterChoiceTransfer().itervalues()]) diff -r ba5f64fe0e00 -r d73b64672238 dialogs/BrowseLocationsDialog.py --- a/dialogs/BrowseLocationsDialog.py Wed Aug 16 12:30:31 2017 +0300 +++ b/dialogs/BrowseLocationsDialog.py Wed Aug 16 12:48:08 2017 +0300 @@ -42,6 +42,8 @@ (_("Input"), [LOCATION_VAR_INPUT]), (_("Output"), [LOCATION_VAR_OUTPUT]), (_("Memory"), [LOCATION_VAR_MEMORY])] + + DIRFILTERCHOICE_OPTIONS = dict([(_(option), filter) for option, filter in GetDirFilterChoiceOptions()]) @@ -51,6 +53,7 @@ _("Type and derivated"), _("Type strict")] + # turn LOCATIONDATATYPES inside-out LOCATION_SIZES = {} for size, types in LOCATIONDATATYPES.iteritems(): diff -r ba5f64fe0e00 -r d73b64672238 dialogs/DiscoveryDialog.py --- a/dialogs/DiscoveryDialog.py Wed Aug 16 12:30:31 2017 +0300 +++ b/dialogs/DiscoveryDialog.py Wed Aug 16 12:48:08 2017 +0300 @@ -39,6 +39,7 @@ wx.ListCtrl.__init__(self, parent, id, pos, size, style, name=name) listmix.ListCtrlAutoWidthMixin.__init__(self) + [ID_DISCOVERYDIALOG, ID_DISCOVERYDIALOGSTATICTEXT1, ID_DISCOVERYDIALOGSERVICESLIST, ID_DISCOVERYDIALOGREFRESHBUTTON, ID_DISCOVERYDIALOGLOCALBUTTON, ID_DISCOVERYDIALOGIPBUTTON, diff -r ba5f64fe0e00 -r d73b64672238 dialogs/ForceVariableDialog.py --- a/dialogs/ForceVariableDialog.py Wed Aug 16 12:30:31 2017 +0300 +++ b/dialogs/ForceVariableDialog.py Wed Aug 16 12:48:08 2017 +0300 @@ -55,6 +55,7 @@ return None return get_string + getinteger = gen_get_function(int) getfloat = gen_get_function(float) getstring = gen_get_string("'") @@ -136,6 +137,7 @@ else: return None + GetTypeValue = {"BOOL": lambda x: {"TRUE": True, "FALSE": False, "0": False, "1": True}.get(x.upper(), None), "SINT": getinteger, "INT": getinteger, diff -r ba5f64fe0e00 -r d73b64672238 dialogs/PouActionDialog.py --- a/dialogs/PouActionDialog.py Wed Aug 16 12:30:31 2017 +0300 +++ b/dialogs/PouActionDialog.py Wed Aug 16 12:48:08 2017 +0300 @@ -31,6 +31,8 @@ def GetActionLanguages(): _ = lambda x: x return [_("IL"), _("ST"), _("LD"), _("FBD")] + + ACTION_LANGUAGES_DICT = dict([(_(language), language) for language in GetActionLanguages()]) diff -r ba5f64fe0e00 -r d73b64672238 dialogs/PouDialog.py --- a/dialogs/PouDialog.py Wed Aug 16 12:30:31 2017 +0300 +++ b/dialogs/PouDialog.py Wed Aug 16 12:48:08 2017 +0300 @@ -31,6 +31,8 @@ def GetPouTypes(): _ = lambda x: x return [_("function"), _("functionBlock"), _("program")] + + POU_TYPES_DICT = dict([(_(pou_type), pou_type) for pou_type in GetPouTypes()]) diff -r ba5f64fe0e00 -r d73b64672238 dialogs/PouTransitionDialog.py --- a/dialogs/PouTransitionDialog.py Wed Aug 16 12:30:31 2017 +0300 +++ b/dialogs/PouTransitionDialog.py Wed Aug 16 12:48:08 2017 +0300 @@ -35,6 +35,8 @@ def GetTransitionLanguages(): _ = lambda x: x return [_("IL"), _("ST"), _("LD"), _("FBD")] + + TRANSITION_LANGUAGES_DICT = dict([(_(language), language) for language in GetTransitionLanguages()]) diff -r ba5f64fe0e00 -r d73b64672238 docutil/dochtml.py --- a/docutil/dochtml.py Wed Aug 16 12:30:31 2017 +0300 +++ b/docutil/dochtml.py Wed Aug 16 12:48:08 2017 +0300 @@ -39,6 +39,7 @@ window.SetClientSize(size) window.Show() + [ID_HTMLFRAME, ID_HTMLFRAMEHTMLCONTENT] = [wx.NewId() for _init_ctrls in range(2)] EVT_HTML_URL_CLICK = wx.NewId() diff -r ba5f64fe0e00 -r d73b64672238 editors/DataTypeEditor.py --- a/editors/DataTypeEditor.py Wed Aug 16 12:30:31 2017 +0300 +++ b/editors/DataTypeEditor.py Wed Aug 16 12:48:08 2017 +0300 @@ -55,6 +55,8 @@ def GetDatatypeTypes(): _ = lambda x: x return [_("Directly"), _("Subrange"), _("Enumerated"), _("Array"), _("Structure")] + + DATATYPE_TYPES_DICT = dict([(_(datatype), datatype) for datatype in GetDatatypeTypes()]) #------------------------------------------------------------------------------- diff -r ba5f64fe0e00 -r d73b64672238 editors/ResourceEditor.py --- a/editors/ResourceEditor.py Wed Aug 16 12:30:31 2017 +0300 +++ b/editors/ResourceEditor.py Wed Aug 16 12:48:08 2017 +0300 @@ -72,6 +72,8 @@ def GetTaskTriggeringOptions(): _ = lambda x: x return [_("Interrupt"), _("Cyclic")] + + TASKTRIGGERINGOPTIONS_DICT = dict([(_(option), option) for option in GetTaskTriggeringOptions()]) SingleCellEditor = lambda *x: wx.grid.GridCellChoiceEditor() diff -r ba5f64fe0e00 -r d73b64672238 editors/Viewer.py --- a/editors/Viewer.py Wed Aug 16 12:30:31 2017 +0300 +++ b/editors/Viewer.py Wed Aug 16 12:48:08 2017 +0300 @@ -64,6 +64,7 @@ else: parent.Append(helpString=help, id=id, kind=kind, item=text) + if wx.Platform == '__WXMSW__': faces = { 'times': 'Times New Roman', @@ -115,6 +116,7 @@ specific_values.connectors) return powerRailCreationFunction + NEGATED_VALUE = lambda x: x if x is not None else False MODIFIER_VALUE = lambda x: x if x is not None else 'none' @@ -129,6 +131,7 @@ CONTACT_NORMAL) return LD_Contact(viewer, contact_type, specific_values.name, id) + COIL_TYPES = {(True, "none", "none"): COIL_REVERSE, (False, "none", "set"): COIL_SET, (False, "none", "reset"): COIL_RESET, @@ -160,6 +163,7 @@ specific_values.priority, id) return transition + divergence_types = [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE, SIMULTANEOUS_DIVERGENCE, SIMULTANEOUS_CONVERGENCE] @@ -178,6 +182,7 @@ def actionBlockCreationFunction(viewer, id, specific_values): return SFC_ActionBlock(viewer, specific_values.actions, id) + ElementCreationFunctions = { "input": GetVariableCreationFunction(INPUT), "output": GetVariableCreationFunction(OUTPUT), @@ -212,6 +217,7 @@ # Graphic elements Viewer base class #------------------------------------------------------------------------------- + # ID Constants for alignment menu items [ID_VIEWERALIGNMENTMENUITEMS0, ID_VIEWERALIGNMENTMENUITEMS1, ID_VIEWERALIGNMENTMENUITEMS2, ID_VIEWERALIGNMENTMENUITEMS4, diff -r ba5f64fe0e00 -r d73b64672238 graphics/DebugDataConsumer.py --- a/graphics/DebugDataConsumer.py Wed Aug 16 12:30:31 2017 +0300 +++ b/graphics/DebugDataConsumer.py Wed Aug 16 12:48:08 2017 +0300 @@ -136,6 +136,7 @@ return data + # Dictionary of translation functions from value send by debugger to IEC # literal stored by type TYPE_TRANSLATOR = { diff -r ba5f64fe0e00 -r d73b64672238 graphics/GraphicCommons.py --- a/graphics/GraphicCommons.py Wed Aug 16 12:30:31 2017 +0300 +++ b/graphics/GraphicCommons.py Wed Aug 16 12:48:08 2017 +0300 @@ -126,6 +126,7 @@ xround += 1 return int(xround * n) + """ Basic vector operations for calculate wire points """ diff -r ba5f64fe0e00 -r d73b64672238 i18n/mki18n.py --- a/i18n/mki18n.py Wed Aug 16 12:30:31 2017 +0300 +++ b/i18n/mki18n.py Wed Aug 16 12:48:08 2017 +0300 @@ -423,6 +423,7 @@ else: return thePath.replace(os.sep, '/') + # ----------------------------------------------------------------------------- # S c r i p t e x e c u t i o n -- Runs when invoked from the command line -- diff -r ba5f64fe0e00 -r d73b64672238 plcopen/definitions.py --- a/plcopen/definitions.py Wed Aug 16 12:30:31 2017 +0300 +++ b/plcopen/definitions.py Wed Aug 16 12:48:08 2017 +0300 @@ -64,6 +64,7 @@ # Data Types definitions #------------------------------------------------------------------------------- + """ Ordored list of common data types defined in the IEC 61131-3 Each type is associated to his direct parent type. It defines then a hierarchy diff -r ba5f64fe0e00 -r d73b64672238 plcopen/plcopen.py --- a/plcopen/plcopen.py Wed Aug 16 12:30:31 2017 +0300 +++ b/plcopen/plcopen.py Wed Aug 16 12:48:08 2017 +0300 @@ -152,6 +152,7 @@ def TextMatched(str1, str2): return str1 and str2 and (str1.upper() == str2.upper()) + PLCOpenParser = GenerateParserFromXSD(paths.AbsNeighbourFile(__file__, "tc6_xml_v201.xsd")) PLCOpen_XPath = lambda xpath: etree.XPath(xpath, namespaces=PLCOpenParser.NSMAP) @@ -188,6 +189,7 @@ """ % locals() + PLCOpen_v1_file = open(paths.AbsNeighbourFile(__file__, "TC6_XML_V10_B.xsd")) PLCOpen_v1_xml = PLCOpen_v1_file.read() PLCOpen_v1_file.close() @@ -289,6 +291,7 @@ project_file.close() return LoadProjectXML(project_xml) + project_pou_xpath = PLCOpen_XPath("/ppx:project/ppx:types/ppx:pous/ppx:pou") @@ -296,6 +299,7 @@ root, error = LoadProjectXML(LOAD_POU_PROJECT_TEMPLATE % xml_string) return project_pou_xpath(root)[0], error + project_pou_instances_xpath = { body_type: PLCOpen_XPath( "/ppx:project/ppx:types/ppx:pous/ppx:pou[@name='paste_pou']/ppx:body/ppx:%s/*" % body_type) @@ -317,6 +321,7 @@ encoding='utf-8')) project_file.close() + cls = PLCOpenParser.GetElementClass("formattedText") if cls: def updateElementName(self, old_name, new_name): @@ -712,6 +717,7 @@ var_number += 1 return search_result + cls = PLCOpenParser.GetElementClass("configuration", "configurations") if cls: @@ -968,6 +974,7 @@ def _updateBaseTypeElementName(self, old_name, new_name): self.baseType.updateElementName(old_name, new_name) + cls = PLCOpenParser.GetElementClass("dataType", "dataTypes") if cls: setattr(cls, "updateElementName", _updateBaseTypeElementName) @@ -1043,6 +1050,7 @@ criteria, parent_infos)) return search_result + cls = PLCOpenParser.GetElementClass("subrangeSigned", "dataType") if cls: setattr(cls, "updateElementName", _updateBaseTypeElementName) @@ -1077,6 +1085,7 @@ return type_content.getname() return type_content_type.upper() + cls = PLCOpenParser.GetElementClass("pou", "pous") if cls: @@ -1926,6 +1935,7 @@ def _SearchInElement(self, criteria, parent_infos=[]): return [] + _connectionsFunctions = { "bbox": {"none": _getBoundingBox, "single": _getBoundingBoxSingle, @@ -1958,6 +1968,7 @@ setattr(cls, "Search", _SearchInElement) return cls + cls = _initElementClass("comment", "commonObjects") if cls: def setcontentText(self, text): @@ -2044,6 +2055,7 @@ return _Search([("reference", self.variable)], criteria, parent_infos + [ld_element_type, self.getlocalId()]) return SearchInLDElement + cls = _initElementClass("contact", "ldObjects", "single") if cls: setattr(cls, "updateElementName", _UpdateLDElementName) @@ -2310,6 +2322,7 @@ def _UpdateIOElementAddress(self, address_model, new_leading): self.expression = update_address(self.expression, address_model, new_leading) + cls = _initElementClass("inVariable", "fbdObjects") if cls: setattr(cls, "updateElementName", _UpdateIOElementName) @@ -2332,6 +2345,7 @@ def _SearchInConnector(self, criteria, parent_infos=[]): return _Search([("name", self.getname())], criteria, parent_infos + ["connector", self.getlocalId()]) + cls = _initElementClass("continuation", "commonObjects") if cls: setattr(cls, "Search", _SearchInConnector) @@ -2495,6 +2509,7 @@ raise ValueError, _("\"%s\" is an invalid value!") % value return items + cls = PLCOpenParser.GetElementClass("arrayValue", "value") if cls: arrayValue_model = re.compile("([0-9]+)\((.*)\)$") diff -r ba5f64fe0e00 -r d73b64672238 plcopen/structures.py --- a/plcopen/structures.py Wed Aug 16 12:30:31 2017 +0300 +++ b/plcopen/structures.py Wed Aug 16 12:48:08 2017 +0300 @@ -52,6 +52,7 @@ """ return [typename for typename, parenttype in TypeHierarchy.items() if not typename.startswith("ANY") and IsOfType(typename, type)] + DataTypeRange = dict(DataTypeRange_list) """ @@ -265,6 +266,7 @@ return Standard_Functions_Decl + StdBlckLst.extend(get_standard_funtions(csv_file_to_table(open(StdFuncsCSV)))) # Dictionary to speedup block type fetching by name diff -r ba5f64fe0e00 -r d73b64672238 runtime/PLCObject.py --- a/runtime/PLCObject.py Wed Aug 16 12:30:31 2017 +0300 +++ b/runtime/PLCObject.py Wed Aug 16 12:48:08 2017 +0300 @@ -46,6 +46,7 @@ tb = tb.tb_next return tb + lib_ext = { "linux2": ".so", "win32": ".dll", diff -r ba5f64fe0e00 -r d73b64672238 svgui/pyjs/build.py --- a/svgui/pyjs/build.py Wed Aug 16 12:30:31 2017 +0300 +++ b/svgui/pyjs/build.py Wed Aug 16 12:48:08 2017 +0300 @@ -541,6 +541,7 @@ d.append('.'.join(m[:i+1])) return d + import time @@ -731,5 +732,6 @@ options.debug, options.dynamic and 1 or 0, data_dir, options.cache_buster, options.optimize) + if __name__ == "__main__": main() diff -r ba5f64fe0e00 -r d73b64672238 svgui/pyjs/jsonrpc/django/jsonrpc.py --- a/svgui/pyjs/jsonrpc/django/jsonrpc.py Wed Aug 16 12:30:31 2017 +0300 +++ b/svgui/pyjs/jsonrpc/django/jsonrpc.py Wed Aug 16 12:48:08 2017 +0300 @@ -207,6 +207,7 @@ # list_some_model and list_another_model part of the django app: # (r'^service1/$', 'djangoapp.views.jsonservice'), + from django.core.serializers import serialize import datetime from datetime import date diff -r ba5f64fe0e00 -r d73b64672238 svgui/pyjs/lib/pyjslib.py --- a/svgui/pyjs/lib/pyjslib.py Wed Aug 16 12:30:31 2017 +0300 +++ b/svgui/pyjs/lib/pyjslib.py Wed Aug 16 12:48:08 2017 +0300 @@ -106,6 +106,7 @@ """) + JS(""" function import_wait(proceed_fn, parent_mod, dynamic) { @@ -189,6 +190,7 @@ class Object: pass + object = Object @@ -228,6 +230,7 @@ loader = Modload(path, app_modnames, app_imported_fn, dynamic, parent_mod) loader.next() + import sys @@ -278,6 +281,7 @@ def toString(self): return "AttributeError: %s of %s" % (self.args[1], self.args[0]) + JS(""" pyjslib.StopIteration = function () { }; pyjslib.StopIteration.prototype = new Error(); @@ -618,6 +622,7 @@ def __str__(self): return repr(self) + list = List @@ -768,6 +773,7 @@ def __str__(self): return repr(self) + tuple = Tuple @@ -913,6 +919,7 @@ def __str__(self): return repr(self) + dict = Dict # taken from mochikit: range( [start,] stop[, step] ) diff -r ba5f64fe0e00 -r d73b64672238 svgui/pyjs/pyjs.py --- a/svgui/pyjs/pyjs.py Wed Aug 16 12:30:31 2017 +0300 +++ b/svgui/pyjs/pyjs.py Wed Aug 16 12:48:08 2017 +0300 @@ -103,6 +103,7 @@ name = 'Tuple' return name + # XXX: this is a hack: these should be dealt with another way # however, console is currently the only global name which is causing # problems. @@ -1740,6 +1741,7 @@ print >>sys.stderr, 'Warning: Unable to find imported javascript:', js return lib_code.getvalue(), app_code.getvalue() + usage = """ usage: %s file_name [module_name] """ @@ -1760,5 +1762,6 @@ module_name = None print translate(file_name, module_name), + if __name__ == "__main__": main() diff -r ba5f64fe0e00 -r d73b64672238 targets/__init__.py --- a/targets/__init__.py Wed Aug 16 12:30:31 2017 +0300 +++ b/targets/__init__.py Wed Aug 16 12:48:08 2017 +0300 @@ -43,6 +43,7 @@ def _GetLocalTargetClassFactory(name): return lambda: getattr(__import__(name, globals(), locals()), name+"_target") + targets = dict([(name, {"xsd": path.join(_base_path, name, "XSD"), "class": _GetLocalTargetClassFactory(name), "code": {fname: path.join(_base_path, name, fname) diff -r ba5f64fe0e00 -r d73b64672238 targets/typemapping.py --- a/targets/typemapping.py Wed Aug 16 12:30:31 2017 +0300 +++ b/targets/typemapping.py Wed Aug 16 12:48:08 2017 +0300 @@ -54,6 +54,7 @@ lambda x: td(0, x.s, x.ns/1000), lambda t, x: t(x.days * 24 * 3600 + x.seconds, x.microseconds*1000)) + SameEndianessTypeTranslator = { "BOOL": _t(c_uint8, lambda x: x.value != 0), "STEP": _t(c_uint8), diff -r ba5f64fe0e00 -r d73b64672238 util/Zeroconf.py --- a/util/Zeroconf.py Wed Aug 16 12:30:31 2017 +0300 +++ b/util/Zeroconf.py Wed Aug 16 12:48:08 2017 +0300 @@ -1557,6 +1557,7 @@ # Test a few module features, including service registration, service # query (for Zoe), and service unregistration. + if __name__ == '__main__': print "Multicast DNS Service Discovery for Python, version", __version__ r = Zeroconf() diff -r ba5f64fe0e00 -r d73b64672238 version.py --- a/version.py Wed Aug 16 12:30:31 2017 +0300 +++ b/version.py Wed Aug 16 12:48:08 2017 +0300 @@ -122,6 +122,7 @@ ) return info + app_version = "1.2" rev = GetAppRevision() if rev is not None: diff -r ba5f64fe0e00 -r d73b64672238 xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Wed Aug 16 12:30:31 2017 +0300 +++ b/xmlclass/xmlclass.py Wed Aug 16 12:48:08 2017 +0300 @@ -53,6 +53,7 @@ attr.childNodes[0] = text node._attrs[name] = attr + """ Regular expression models for checking all kind of string values defined in XML standard @@ -98,6 +99,7 @@ def dst(self, dt): return ZERO + [SYNTAXELEMENT, SYNTAXATTRIBUTE, SIMPLETYPE, COMPLEXTYPE, COMPILEDCOMPLEXTYPE, ATTRIBUTESGROUP, ELEMENTSGROUP, ATTRIBUTE, ELEMENT, CHOICE, ANY, TAG, CONSTRAINT, ] = range(13) @@ -1711,6 +1713,7 @@ return len(getattr(self, attr)) return countMethod + """ This function generate a xml parser from a class factory """ diff -r ba5f64fe0e00 -r d73b64672238 xmlclass/xsdschema.py --- a/xmlclass/xsdschema.py Wed Aug 16 12:30:31 2017 +0300 +++ b/xmlclass/xsdschema.py Wed Aug 16 12:48:08 2017 +0300 @@ -67,6 +67,7 @@ return text return generateXMLTextMethod + DEFAULT_FACETS = GenerateDictFacets(["pattern", "whiteSpace", "enumeration"]) NUMBER_FACETS = GenerateDictFacets(DEFAULT_FACETS.keys() + ["maxInclusive", "maxExclusive", "minInclusive", "minExclusive"]) DECIMAL_FACETS = GenerateDictFacets(NUMBER_FACETS.keys() + ["totalDigits", "fractionDigits"])