# HG changeset patch # User Andrey Skvortsov # Date 1503048991 -10800 # Node ID c74815729afda4102e4c912d19db46ab09189a02 # Parent c1e5b9f1948346665379a232502e52964d4640ce clean-up: fix PEP8 E127 continuation line over-indented for visual indent diff -r c1e5b9f19483 -r c74815729afd BeremizIDE.py --- a/BeremizIDE.py Thu Aug 17 17:25:17 2017 +0300 +++ b/BeremizIDE.py Fri Aug 18 12:36:31 2017 +0300 @@ -548,8 +548,8 @@ if result is not None: first_line, first_column, last_line, last_column, error = result.groups() infos = self.CTR.ShowError(self.Log, - (int(first_line), int(first_column)), - (int(last_line), int(last_column))) + (int(first_line), int(first_column)), + (int(last_line), int(last_column))) ## Function displaying an Error dialog in PLCOpenEditor. # @return False if closing cancelled. @@ -884,8 +884,8 @@ except: defaultpath = os.path.expanduser("~") - dialog = wx.DirDialog(self, _("Choose a project"), defaultpath, style=wx.DEFAULT_DIALOG_STYLE | - wx.RESIZE_BORDER) + dialog = wx.DirDialog(self, _("Choose a project"), defaultpath, + style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) if dialog.ShowModal() == wx.ID_OK: self.OpenProject(dialog.GetPath()) dialog.Destroy() diff -r c1e5b9f19483 -r c74815729afd Beremiz_service.py --- a/Beremiz_service.py Thu Aug 17 17:25:17 2017 +0300 +++ b/Beremiz_service.py Fri Aug 18 12:36:31 2017 +0300 @@ -198,7 +198,7 @@ event(self, function) def __init__(self, parent, message, caption=_("Please enter text"), defaultValue="", - style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition): + style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition): wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos) self.Tests = [] @@ -312,8 +312,9 @@ ip_addr = '' if ip_addr is None else ip_addr dlg = ParamsEntryDialog(None, _("Enter the IP of the interface to bind"), defaultValue=ip_addr) dlg.SetTests([(re.compile('\d{1,3}(?:\.\d{1,3}){3}$').match, _("IP is not valid!")), - (lambda x:len([x for x in x.split(".") if 0 <= int(x) <= 255]) == 4, _("IP is not valid!")) - ]) + (lambda x:len([x for x in x.split(".") if 0 <= int(x) <= 255]) == 4, + _("IP is not valid!")) + ]) if dlg.ShowModal() == wx.ID_OK: self.pyroserver.ip_addr = dlg.GetValue() self.pyroserver.Stop() diff -r c1e5b9f19483 -r c74815729afd CodeFileTreeNode.py --- a/CodeFileTreeNode.py Thu Aug 17 17:25:17 2017 +0300 +++ b/CodeFileTreeNode.py Fri Aug 18 12:36:31 2017 +0300 @@ -200,7 +200,7 @@ ret = [(variable.getname(), variable.gettype(), variable.getinitial()) - for variable in variables] + for variable in variables] ret.extend([("On"+variable.getname()+"Change", "python_poll", "") for variable in variables if variable.getonchange()]) diff -r c1e5b9f19483 -r c74815729afd ConfigTreeNode.py --- a/ConfigTreeNode.py Thu Aug 17 17:25:17 2017 +0300 +++ b/ConfigTreeNode.py Fri Aug 18 12:36:31 2017 +0300 @@ -530,7 +530,7 @@ CTNClass, CTNHelp = CTNChildrenTypes[CTNType] except KeyError: raise Exception(_("Cannot create child {a1} of type {a2} "). - format(a1=CTNName, a2=CTNType)) + format(a1=CTNName, a2=CTNType)) # if CTNClass is a class factory, call it. (prevent unneeded imports) if type(CTNClass) == types.FunctionType: diff -r c1e5b9f19483 -r c74815729afd PLCControler.py --- a/PLCControler.py Thu Aug 17 17:25:17 2017 +0300 +++ b/PLCControler.py Fri Aug 18 12:36:31 2017 +0300 @@ -784,7 +784,7 @@ os.path.join(ScriptDirectory, "plcopen", "pou_variables.xslt"), parser), extensions={("pou_vars_ns", name): getattr(factory, name) - for name in ["SetRoot", "AddVariable"]}) + for name in ["SetRoot", "AddVariable"]}) obj = None words = tagname.split("::") @@ -847,9 +847,11 @@ os.path.join(ScriptDirectory, "plcopen", "instance_tagname.xslt"), parser), extensions={("instance_tagname_ns", name): getattr(factory, name) - for name in ["ConfigTagName", "ResourceTagName", - "PouTagName", "ActionTagName", - "TransitionTagName"]}) + for name in ["ConfigTagName", + "ResourceTagName", + "PouTagName", + "ActionTagName", + "TransitionTagName"]}) instance_tagname_xslt_tree(project, instance_path=etree.XSLT.strparam(instance_path)) @@ -1393,7 +1395,7 @@ # Add a global var to configuration to configuration def AddConfigurationGlobalVar(self, config_name, var_type, var_name, - location="", description=""): + location="", description=""): if self.Project is not None: # Found the configuration corresponding to name configuration = self.Project.getconfiguration(config_name) @@ -1549,8 +1551,8 @@ os.path.join(ScriptDirectory, "plcopen", "variables_infos.xslt"), parser), extensions={("var_infos_ns", name): getattr(factory, name) - for name in ["SetType", "AddDimension", - "AddTree", "AddVarToTree"]}) + for name in ["SetType", "AddDimension", + "AddTree", "AddVarToTree"]}) return_type_infos_xslt_tree(return_type, tree=etree.XSLT.strparam(str(tree))) if tree: @@ -1567,7 +1569,7 @@ addedcat = [{"name": _("%s POUs") % confnodetypes["name"], "list": [pou.getblockInfos() for pou in confnodetypes["types"].getpous()]} - for confnodetypes in typeslist] + for confnodetypes in typeslist] self.TotalTypes.extend(addedcat) for cat in addedcat: for desc in cat["list"]: diff -r c1e5b9f19483 -r c74815729afd PLCGenerator.py --- a/PLCGenerator.py Thu Aug 17 17:25:17 2017 +0300 +++ b/PLCGenerator.py Fri Aug 18 12:36:31 2017 +0300 @@ -444,10 +444,10 @@ # Generate any program assign to no task for instance in resource.getpouInstance(): resrce += [(" PROGRAM ", ()), - (instance.getname(), (tagname, "instance", instance_number, "name")), - (" : ", ()), - (instance.gettypeName(), (tagname, "instance", instance_number, "type")), - (";\n", ())] + (instance.getname(), (tagname, "instance", instance_number, "name")), + (" : ", ()), + (instance.gettypeName(), (tagname, "instance", instance_number, "type")), + (";\n", ())] instance_number += 1 resrce += [(" END_RESOURCE\n", ())] return resrce diff -r c1e5b9f19483 -r c74815729afd ProjectController.py --- a/ProjectController.py Thu Aug 17 17:25:17 2017 +0300 +++ b/ProjectController.py Fri Aug 18 12:36:31 2017 +0300 @@ -1700,10 +1700,7 @@ return # Get connector uri - uri = self.\ - BeremizRoot.\ - getURI_location().\ - strip() + uri = self.BeremizRoot.getURI_location().strip() # if uri is empty launch discovery dialog if uri == "": diff -r c1e5b9f19483 -r c74815729afd canfestival/canfestival.py --- a/canfestival/canfestival.py Thu Aug 17 17:25:17 2017 +0300 +++ b/canfestival/canfestival.py Fri Aug 18 12:36:31 2017 +0300 @@ -74,7 +74,7 @@ "IEC_type": IECTypeConversion.get(typeinfos["name"]), "var_name": "%s_%4.4x_%2.2x" % ("_".join(name.split()), index, subindex), "location": "%s%s" % (SizeConversion[size], ".".join(map(str, current_location + - (index, subindex)))), + (index, subindex)))), "description": "", "children": []}) return {"name": name, @@ -352,16 +352,19 @@ current_location = self.GetCurrentLocation() nodeindexes = self.SlaveNodes.keys() nodeindexes.sort() - return {"name": self.BaseParams.getName(), - "type": LOCATION_CONFNODE, - "location": self.GetFullIEC_Channel(), - "children": [GetSlaveLocationTree(self.Manager.GetCurrentNodeCopy(), - current_location, - _("Local entries"))] + - [GetSlaveLocationTree(self.SlaveNodes[nodeid]["Node"], - current_location + (nodeid,), - self.SlaveNodes[nodeid]["Name"]) - for nodeid in nodeindexes] + children = [] + children += [GetSlaveLocationTree(self.Manager.GetCurrentNodeCopy(), + current_location, + _("Local entries"))] + children += [GetSlaveLocationTree(self.SlaveNodes[nodeid]["Node"], + current_location + (nodeid,), + self.SlaveNodes[nodeid]["Name"]) for nodeid in nodeindexes] + + return { + "name": self.BaseParams.getName(), + "type": LOCATION_CONFNODE, + "location": self.GetFullIEC_Channel(), + "children": children } _GeneratedMasterView = None diff -r c1e5b9f19483 -r c74815729afd canfestival/config_utils.py --- a/canfestival/config_utils.py Thu Aug 17 17:25:17 2017 +0300 +++ b/canfestival/config_utils.py Fri Aug 18 12:36:31 2017 +0300 @@ -572,15 +572,16 @@ variable_infos = self.IECLocations[varname] # Calculate base index for storing variable - mapvariableidx = VariableStartIndex[variable_infos["pdotype"]] + \ - VariableTypeOffset[variable_infos["sizelocation"]] * VariableIncrement + \ - variable_infos["nodeid"] + mapvariableidx = \ + VariableStartIndex[variable_infos["pdotype"]] + \ + VariableTypeOffset[variable_infos["sizelocation"]] * VariableIncrement + \ + variable_infos["nodeid"] # Generate entry name indexname = "%s%s%s_%d" % (VariableDirText[variable_infos["pdotype"]], - variable_infos["sizelocation"], - '_'.join(map(str, current_location)), - variable_infos["nodeid"]) + variable_infos["sizelocation"], + '_'.join(map(str, current_location)), + variable_infos["nodeid"]) # Search for an entry that has an empty subindex while mapvariableidx < VariableStartIndex[variable_infos["pdotype"]] + 0x2000: diff -r c1e5b9f19483 -r c74815729afd connectors/__init__.py --- a/connectors/__init__.py Thu Aug 17 17:25:17 2017 +0300 +++ b/connectors/__init__.py Fri Aug 18 12:36:31 2017 +0300 @@ -35,10 +35,12 @@ 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)) - and not name.startswith("__")} +connectors = {name: + _GetLocalConnectorClassFactory(name) + for name in listdir(_base_path) + if (path.isdir(path.join(_base_path, name)) + and not name.startswith("__")) +} def ConnectorFactory(uri, confnodesroot): diff -r c1e5b9f19483 -r c74815729afd controls/DebugVariablePanel/DebugVariableGraphicViewer.py --- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Aug 17 17:25:17 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Fri Aug 18 12:36:31 2017 +0300 @@ -797,8 +797,9 @@ # If middle button is pressed and moving graph along X coordinate # is in progress - elif event.button == 2 and self.GraphType == GRAPH_PARALLEL and \ - self.MouseStartPos is not None: + elif (event.button == 2 and + self.GraphType == GRAPH_PARALLEL and + self.MouseStartPos is not None): start_tick, end_tick = self.ParentWindow.GetRange() rect = self.GetAxesBoundingBox() @@ -1038,8 +1039,8 @@ for idx in xrange(num_item): # Get color from color cycle (black if only one item) - color = ('k' if num_item == 1 - else COLOR_CYCLE[idx % len(COLOR_CYCLE)]) + color = ('k' if num_item == 1 else + COLOR_CYCLE[idx % len(COLOR_CYCLE)]) # In 3D graph items variable label are not displayed as text # in figure, but as axis title diff -r c1e5b9f19483 -r c74815729afd controls/DebugVariablePanel/DebugVariableItem.py --- a/controls/DebugVariablePanel/DebugVariableItem.py Thu Aug 17 17:25:17 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableItem.py Fri Aug 18 12:36:31 2017 +0300 @@ -335,9 +335,10 @@ idx = self.GetNearestData(tick, 0) # Get value and forced flag at given index - value, forced = self.RawData[int(self.Data[idx, 2])] \ - if self.VariableType in ["STRING", "WSTRING"] \ - else self.Data[idx, 1:3] + value, forced = \ + self.RawData[int(self.Data[idx, 2])] \ + if self.VariableType in ["STRING", "WSTRING"] \ + else self.Data[idx, 1:3] # Get raw value if asked if not raw: diff -r c1e5b9f19483 -r c74815729afd controls/DurationCellEditor.py --- a/controls/DurationCellEditor.py Thu Aug 17 17:25:17 2017 +0300 +++ b/controls/DurationCellEditor.py Fri Aug 18 12:36:31 2017 +0300 @@ -138,8 +138,8 @@ def SetSize(self, rect): self.CellControl.SetDimensions(rect.x + 1, rect.y, - rect.width, rect.height, - wx.SIZE_ALLOW_MINUS_ONE) + rect.width, rect.height, + wx.SIZE_ALLOW_MINUS_ONE) def Clone(self): return DurationCellEditor(self.Table) diff -r c1e5b9f19483 -r c74815729afd controls/LibraryPanel.py --- a/controls/LibraryPanel.py Thu Aug 17 17:25:17 2017 +0300 +++ b/controls/LibraryPanel.py Fri Aug 18 12:36:31 2017 +0300 @@ -170,14 +170,14 @@ # Get current selected item for selected it when values refreshed selected_item = self.Tree.GetSelection() selected_pydata = (self.Tree.GetPyData(selected_item) - if selected_item.IsOk() and - selected_item != self.Tree.GetRootItem() + if (selected_item.IsOk() and + selected_item != self.Tree.GetRootItem()) else None) # Don't save selected item if it is a category selected_infos = ((self.Tree.GetItemText(selected_item), selected_pydata["inputs"]) - if selected_pydata is not None and - selected_pydata["type"] == BLOCK + if (selected_pydata is not None and + selected_pydata["type"] == BLOCK) else (None, None)) # Get TreeCtrl root item (hidden) @@ -295,15 +295,15 @@ # Get selected item associated data in tree selected_item = self.Tree.GetSelection() selected_pydata = (self.Tree.GetPyData(selected_item) - if selected_item.IsOk() and - selected_item != self.Tree.GetRootItem() + if (selected_item.IsOk() and + selected_item != self.Tree.GetRootItem()) else None) # Return value is None if selected tree item is root or a category return ({"type": self.Tree.GetItemText(selected_item), "inputs": selected_pydata["inputs"]} - if selected_pydata is not None and - selected_pydata["type"] == BLOCK + if (selected_pydata is not None and + selected_pydata["type"] == BLOCK) else None) def SelectTreeItem(self, name, inputs): diff -r c1e5b9f19483 -r c74815729afd controls/LocationCellEditor.py --- a/controls/LocationCellEditor.py Thu Aug 17 17:25:17 2017 +0300 +++ b/controls/LocationCellEditor.py Fri Aug 18 12:36:31 2017 +0300 @@ -182,8 +182,8 @@ def SetSize(self, rect): self.CellControl.SetDimensions(rect.x + 1, rect.y, - rect.width, rect.height, - wx.SIZE_ALLOW_MINUS_ONE) + rect.width, rect.height, + wx.SIZE_ALLOW_MINUS_ONE) def Clone(self): return LocationCellEditor(self.Table, self.Controller) diff -r c1e5b9f19483 -r c74815729afd controls/TextCtrlAutoComplete.py --- a/controls/TextCtrlAutoComplete.py Thu Aug 17 17:25:17 2017 +0300 +++ b/controls/TextCtrlAutoComplete.py Fri Aug 18 12:36:31 2017 +0300 @@ -60,9 +60,10 @@ itemcount = min(len(choices), MAX_ITEM_SHOWN) width = self.Parent.GetSize()[0] - height = max_text_height * itemcount + \ - LISTBOX_INTERVAL_HEIGHT * max(0, itemcount - 1) + \ - 2 * LISTBOX_BORDER_HEIGHT + height = \ + max_text_height * itemcount + \ + LISTBOX_INTERVAL_HEIGHT * max(0, itemcount - 1) + \ + 2 * LISTBOX_BORDER_HEIGHT if max_text_width + 10 > width: height += 15 size = wx.Size(width, height) diff -r c1e5b9f19483 -r c74815729afd controls/VariablePanel.py --- a/controls/VariablePanel.py Thu Aug 17 17:25:17 2017 +0300 +++ b/controls/VariablePanel.py Fri Aug 18 12:36:31 2017 +0300 @@ -506,8 +506,8 @@ self.FilterChoices = ["All", "Global"] # ,"Access"] else: self.FilterChoices = ["All", - "Interface", " Input", " Output", " InOut", " External", - "Variables", " Local", " Temp"] # ,"Access"] + "Interface", " Input", " Output", " InOut", " External", + "Variables", " Local", " Temp"] # ,"Access"] # these condense the ColAlignements list left = wx.ALIGN_LEFT @@ -526,12 +526,12 @@ if element_type == "function": self.FilterChoices = ["All", - "Interface", " Input", " Output", " InOut", - "Variables", " Local"] + "Interface", " Input", " Output", " InOut", + "Variables", " Local"] else: self.FilterChoices = ["All", - "Interface", " Input", " Output", " InOut", " External", - "Variables", " Local", " Temp"] + "Interface", " Input", " Output", " InOut", " External", + "Variables", " Local", " Temp"] # these condense the alignements list left = wx.ALIGN_LEFT diff -r c1e5b9f19483 -r c74815729afd dialogs/BlockPreviewDialog.py --- a/dialogs/BlockPreviewDialog.py Thu Aug 17 17:25:17 2017 +0300 +++ b/dialogs/BlockPreviewDialog.py Fri Aug 18 12:36:31 2017 +0300 @@ -92,9 +92,10 @@ # Remove reference to project controller self.Controller = None - def _init_sizers(self, main_rows, main_growable_row, - left_rows, left_growable_row, - right_rows, right_growable_row): + def _init_sizers(self, + main_rows, main_growable_row, + left_rows, left_growable_row, + right_rows, right_growable_row): """ Initialize common sizers @param main_rows: Number of rows in main sizer @@ -278,11 +279,11 @@ # If graphic element is too big to be displayed in preview panel, # calculate preview panel scale so that graphic element fit inside + k = 1.1 if (bbox.width * 1.1 > client_size.width or + bbox.height * 1.1 > client_size.height) \ + else 1.0 scale = (max(float(bbox.width) / client_size.width, - float(bbox.height) / client_size.height) * 1.1 - if bbox.width * 1.1 > client_size.width or - bbox.height * 1.1 > client_size.height - else 1.0) + float(bbox.height) / client_size.height) * k) dc.SetUserScale(1.0 / scale, 1.0 / scale) # Center graphic element in preview panel diff -r c1e5b9f19483 -r c74815729afd dialogs/LDElementDialog.py --- a/dialogs/LDElementDialog.py Thu Aug 17 17:25:17 2017 +0300 +++ b/dialogs/LDElementDialog.py Fri Aug 18 12:36:31 2017 +0300 @@ -72,9 +72,10 @@ if type == "contact" else [COIL_NORMAL, COIL_REVERSE, COIL_SET, COIL_RESET, COIL_RISING, COIL_FALLING]) - modifiers_label = [_("Normal"), _("Negated")] + \ - ([_("Set"), _("Reset")] if type == "coil" else []) + \ - [_("Rising Edge"), _("Falling Edge")] + modifiers_label = \ + [_("Normal"), _("Negated")] + \ + ([_("Set"), _("Reset")] if type == "coil" else []) + \ + [_("Rising Edge"), _("Falling Edge")] for modifier, label in zip(element_modifiers, modifiers_label): radio_button = wx.RadioButton(self, label=label, diff -r c1e5b9f19483 -r c74815729afd dialogs/PouNameDialog.py --- a/dialogs/PouNameDialog.py Thu Aug 17 17:25:17 2017 +0300 +++ b/dialogs/PouNameDialog.py Fri Aug 18 12:36:31 2017 +0300 @@ -32,7 +32,7 @@ class PouNameDialog(wx.TextEntryDialog): def __init__(self, parent, message, caption="Please enter text", defaultValue="", - style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition): + style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition): wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos) self.PouNames = [] diff -r c1e5b9f19483 -r c74815729afd dialogs/SFCStepNameDialog.py --- a/dialogs/SFCStepNameDialog.py Thu Aug 17 17:25:17 2017 +0300 +++ b/dialogs/SFCStepNameDialog.py Fri Aug 18 12:36:31 2017 +0300 @@ -32,7 +32,7 @@ class SFCStepNameDialog(wx.TextEntryDialog): def __init__(self, parent, message, caption="Please enter text", defaultValue="", - style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition): + style=wx.OK | wx.CANCEL | wx.CENTRE, pos=wx.DefaultPosition): wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos) self.PouNames = [] diff -r c1e5b9f19483 -r c74815729afd editors/CodeFileEditor.py --- a/editors/CodeFileEditor.py Thu Aug 17 17:25:17 2017 +0300 +++ b/editors/CodeFileEditor.py Fri Aug 18 12:36:31 2017 +0300 @@ -135,9 +135,10 @@ for section in self.Controler.SECTIONS_NAMES: section_comment = " %s section " % (section) len_headers = EDGE_COLUMN - len(section_comment) - section_comment = self.COMMENT_HEADER * (len_headers / 2) + \ - section_comment + \ - self.COMMENT_HEADER * (len_headers - len_headers / 2) + section_comment = \ + self.COMMENT_HEADER * (len_headers / 2) + \ + section_comment + \ + self.COMMENT_HEADER * (len_headers - len_headers / 2) self.SectionsComments[section] = { "comment": section_comment, diff -r c1e5b9f19483 -r c74815729afd editors/SFCViewer.py --- a/editors/SFCViewer.py Thu Aug 17 17:25:17 2017 +0300 +++ b/editors/SFCViewer.py Fri Aug 18 12:36:31 2017 +0300 @@ -61,7 +61,7 @@ SELECTION_DIVERGENCE: [("SFC_Transition", SOUTH)], SELECTION_CONVERGENCE: [("SFC_Step", SOUTH), - ("SFC_Jump", SOUTH)], + ("SFC_Jump", SOUTH)], SIMULTANEOUS_DIVERGENCE: [("SFC_Step", SOUTH)], diff -r c1e5b9f19483 -r c74815729afd editors/Viewer.py --- a/editors/Viewer.py Thu Aug 17 17:25:17 2017 +0300 +++ b/editors/Viewer.py Fri Aug 18 12:36:31 2017 +0300 @@ -91,18 +91,21 @@ def GetVariableCreationFunction(variable_type): def variableCreationFunction(viewer, id, specific_values): - return FBD_Variable(viewer, variable_type, - specific_values.name, - specific_values.value_type, - id, - specific_values.execution_order) + return FBD_Variable(viewer, + variable_type, + specific_values.name, + specific_values.value_type, + id, + specific_values.execution_order) return variableCreationFunction def GetConnectorCreationFunction(connector_type): def connectorCreationFunction(viewer, id, specific_values): - return FBD_Connector(viewer, connector_type, - specific_values.name, id) + return FBD_Connector(viewer, + connector_type, + specific_values.name, + id) return connectorCreationFunction @@ -112,8 +115,10 @@ def GetPowerRailCreationFunction(powerrail_type): def powerRailCreationFunction(viewer, id, specific_values): - return LD_PowerRail(viewer, powerrail_type, id, - specific_values.connectors) + return LD_PowerRail(viewer, + powerrail_type, + id, + specific_values.connectors) return powerRailCreationFunction @@ -153,8 +158,10 @@ def stepCreationFunction(viewer, id, specific_values): - step = SFC_Step(viewer, specific_values.name, - specific_values.initial, id) + step = SFC_Step(viewer, + specific_values.name, + specific_values.initial, + id) if specific_values.action is not None: step.AddAction() connector = step.GetActionConnector() @@ -163,9 +170,11 @@ def transitionCreationFunction(viewer, id, specific_values): - transition = SFC_Transition(viewer, specific_values.condition_type, - specific_values.condition, - specific_values.priority, id) + transition = SFC_Transition(viewer, + specific_values.condition_type, + specific_values.condition, + specific_values.priority, + id) return transition @@ -176,7 +185,7 @@ def GetDivergenceCreationFunction(divergence_type): def divergenceCreationFunction(viewer, id, specific_values): return SFC_Divergence(viewer, divergence_type, - specific_values.connectors, id) + specific_values.connectors, id) return divergenceCreationFunction diff -r c1e5b9f19483 -r c74815729afd graphics/GraphicCommons.py --- a/graphics/GraphicCommons.py Thu Aug 17 17:25:17 2017 +0300 +++ b/graphics/GraphicCommons.py Fri Aug 18 12:36:31 2017 +0300 @@ -1548,10 +1548,10 @@ if self.ValueSize is not None: width, height = self.ValueSize dc.DrawText(self.ComputedValue, - parent_pos[0] + self.Pos.x + CONNECTOR_SIZE * self.Direction[0] + - width * (self.Direction[0] - 1) / 2, - parent_pos[1] + self.Pos.y + CONNECTOR_SIZE * self.Direction[1] + - height * (self.Direction[1] - 1)) + parent_pos[0] + self.Pos.x + CONNECTOR_SIZE * self.Direction[0] + + width * (self.Direction[0] - 1) / 2, + parent_pos[1] + self.Pos.y + CONNECTOR_SIZE * self.Direction[1] + + height * (self.Direction[1] - 1)) dc.SetFont(self.ParentBlock.Parent.GetFont()) dc.SetTextForeground(wx.BLACK) diff -r c1e5b9f19483 -r c74815729afd runtime/NevowServer.py --- a/runtime/NevowServer.py Thu Aug 17 17:25:17 2017 +0300 +++ b/runtime/NevowServer.py Fri Aug 18 12:36:31 2017 +0300 @@ -118,12 +118,12 @@ class WebInterface(athena.LivePage): docFactory = loaders.stan([tags.raw(xhtml_header), - tags.html(xmlns="http://www.w3.org/1999/xhtml")[ - tags.head(render=tags.directive('liveglue')), - tags.body[ - tags.div[ - tags.div(render=tags.directive("MainPage")) - ]]]]) + tags.html(xmlns="http://www.w3.org/1999/xhtml")[ + tags.head(render=tags.directive('liveglue')), + tags.body[ + tags.div[ + tags.div(render=tags.directive("MainPage")) + ]]]]) MainPage = MainPage() PLCHMI = PLCHMI diff -r c1e5b9f19483 -r c74815729afd runtime/PLCObject.py --- a/runtime/PLCObject.py Thu Aug 17 17:25:17 2017 +0300 +++ b/runtime/PLCObject.py Fri Aug 18 12:36:31 2017 +0300 @@ -483,7 +483,7 @@ if force is not None: c_type, unpack_func, pack_func = \ TypeTranslator.get(iectype, - (None, None, None)) + (None, None, None)) force = ctypes.byref(pack_func(c_type, force)) self._RegisterDebugVariable(idx, force) self._TracesSwap() diff -r c1e5b9f19483 -r c74815729afd svgui/pyjs/build.py --- a/svgui/pyjs/build.py Thu Aug 17 17:25:17 2017 +0300 +++ b/svgui/pyjs/build.py Fri Aug 18 12:36:31 2017 +0300 @@ -323,11 +323,11 @@ app_translator = pyjs.AppTranslator( parser=parser, dynamic=dynamic, optimize=optimize) early_app_libs[platform], appcode = \ - app_translator.translate(None, is_app=False, - debug=debug, - library_modules=['dynamicajax.js', - '_pyjs.js', 'sys', - 'pyjslib']) + app_translator.translate(None, is_app=False, + debug=debug, + library_modules=['dynamicajax.js', + '_pyjs.js', 'sys', + 'pyjslib']) pover[platform].update(app_translator.overrides.items()) for mname, name in app_translator.overrides.items(): pd = overrides.setdefault(mname, {}) @@ -370,9 +370,9 @@ parser.setPlatform(platform) mod_translator = pyjs.AppTranslator(parser=parser, optimize=optimize) mod_libs[platform][mod_name], mod_code[platform][mod_name] = \ - mod_translator.translate(mod_name, - is_app=False, - debug=debug) + mod_translator.translate(mod_name, + is_app=False, + debug=debug) pover[platform].update(mod_translator.overrides.items()) for mname, name in mod_translator.overrides.items(): pd = overrides.setdefault(mname, {}) diff -r c1e5b9f19483 -r c74815729afd svgui/pyjs/jsonrpc/django/jsonrpc.py --- a/svgui/pyjs/jsonrpc/django/jsonrpc.py Thu Aug 17 17:25:17 2017 +0300 +++ b/svgui/pyjs/jsonrpc/django/jsonrpc.py Fri Aug 18 12:36:31 2017 +0300 @@ -121,7 +121,7 @@ res = {} field_type = field.__class__.__name__ for fname in field_names.get(field_type, []) + \ - ['help_text', 'label', 'initial', 'required']: + ['help_text', 'label', 'initial', 'required']: res[fname] = getattr(field, fname) if field_type in ['ComboField', 'MultiValueField', 'SplitDateTimeField']: res['fields'] = map(describe_field, field.fields) diff -r c1e5b9f19483 -r c74815729afd svgui/pyjs/pyjs.py --- a/svgui/pyjs/pyjs.py Thu Aug 17 17:25:17 2017 +0300 +++ b/svgui/pyjs/pyjs.py Fri Aug 18 12:36:31 2017 +0300 @@ -547,14 +547,10 @@ except ValueError: # Must be a function call ... return ("pyjs_kwargs_function_call("+call_name+", " - + star_arg_name - + ", ["+fn_args+"]" - + ")") + + star_arg_name + ", ["+fn_args+"]" + ")") else: return ("pyjs_kwargs_method_call("+call_this+", '"+method_name+"', " - + star_arg_name - + ", ["+fn_args+"]" - + ")") + + star_arg_name + ", ["+fn_args+"]" + ")") else: return call_name + "(" + ", ".join(call_args) + ")" @@ -637,7 +633,7 @@ return strip_py(self.module_prefix) def _name(self, v, current_klass, top_level=False, - return_none_for_module=False): + return_none_for_module=False): if v.name == 'ilikesillynamesfornicedebugcode': print top_level, current_klass, repr(v) @@ -689,8 +685,7 @@ cls_name = cls_name.name else: cls_name_ = current_klass + "_" # XXX ??? - name = UU+cls_name_ + ".prototype.__class__." \ - + v.name + name = UU+cls_name_ + ".prototype.__class__." + v.name if v.name == 'listener': name = 'listener+' + name return name @@ -781,8 +776,9 @@ # pass our class to self._name base_class_ = self._name(node.bases[0].expr, None) + \ ".__" + node.bases[0].attrname - base_class = self._name(node.bases[0].expr, None) + \ - "." + node.bases[0].attrname + base_class = \ + self._name(node.bases[0].expr, None) + \ + "." + node.bases[0].attrname else: raise TranslationError("unsupported type (in _class)", node.bases[0]) @@ -949,7 +945,7 @@ print >>self.output, " "+altexpr+".__name__ = '%s';" % node.name print >>self.output, UU + class_name_ + ".prototype.%s.__name__ = '%s';" % \ - (node.name, node.name) + (node.name, node.name) if node.kwargs or len(node.defaults): print >>self.output, " "+altexpr + ".parse_kwargs = " + fexpr + ".parse_kwargs;" @@ -1014,23 +1010,22 @@ haltException = self.module_prefix + "HaltException" isHaltFunction = self.module_prefix + "IsHaltException" - print >>self.output, ' } catch (__err) {' - print >>self.output, ' if (' + isHaltFunction + '(__err.name)) {' - print >>self.output, ' throw __err;' - print >>self.output, ' } else {' - print >>self.output, " st = sys.printstack() + "\ - + '"%s"' % lt + "+ '\\n' ;" - print >>self.output, ' alert("' + "Error in " \ - + lt + '"' \ - + '+"\\n"+__err.name+": "+__err.message'\ - + '+"\\n\\nStack trace:\\n"' \ - + '+st' \ - + ');' - print >>self.output, ' debugger;' - - print >>self.output, ' throw new ' + self.module_prefix + "HaltException();" - print >>self.output, ' }' - print >>self.output, ' }' + out = ( + ' } catch (__err) {', + ' if (' + isHaltFunction + '(__err.name)) {', + ' throw __err;', + ' } else {', + ' st = sys.printstack() + ' + '"%s"' % lt + "+ '\\n' ;" + ' alert("' + 'Error in ' + lt + '"' + + '+"\\n"+__err.name+": "+__err.message' + + '+"\\n\\nStack trace:\\n"' + '+st' + ');', + ' debugger;', + ' throw new ' + self.module_prefix + 'HaltException();', + ' }', + ' }' + ) + for s in out: + print >>self.output, s def get_line_trace(self, node): lineNum = "Unknown" @@ -1044,9 +1039,9 @@ srcLine = srcLine.replace("'", "\\'") return self.raw_module_name + ".py, line " \ - + str(lineNum) + ":"\ - + "\\n" \ - + " " + srcLine + + str(lineNum) + ":"\ + + "\\n" \ + + " " + srcLine def _augassign(self, node, current_klass): v = node.node @@ -1096,7 +1091,7 @@ self.top_level_vars.add(v.name) vname = self.modpfx() + v.name if not self.modpfx() and v.name not in\ - self.method_imported_globals: + self.method_imported_globals: lhs = "var " + vname else: lhs = UU + vname @@ -1159,7 +1154,7 @@ idx = self.expr(child.subs[0], current_klass) value = self.expr(node.expr, current_klass) print >>self.output, " " + obj + ".__setitem__(" \ - + idx + ", " + rhs + ");" + + idx + ", " + rhs + ");" continue print >>self.output, " " + lhs + " = " + rhs + ";" return @@ -1690,7 +1685,7 @@ mod, override = self.parser.parseModule(module_name, file_name) if override: override_name = "%s.%s" % (self.parser.platform.lower(), - module_name) + module_name) self.overrides[override_name] = override_name if is_app: mn = '__main__' diff -r c1e5b9f19483 -r c74815729afd targets/__init__.py --- a/targets/__init__.py Thu Aug 17 17:25:17 2017 +0300 +++ b/targets/__init__.py Fri Aug 18 12:36:31 2017 +0300 @@ -44,15 +44,15 @@ return lambda: getattr(__import__(name, globals(), locals()), name+"_target") -targets = dict([(name, {"xsd": path.join(_base_path, name, "XSD"), +targets = dict([(name, {"xsd": path.join(_base_path, name, "XSD"), "class": _GetLocalTargetClassFactory(name), - "code": {fname: path.join(_base_path, name, fname) - for fname in listdir(path.join(_base_path, name)) - if fname.startswith("plc_%s_main" % name) and - fname.endswith(".c")}}) + "code": {fname: path.join(_base_path, name, fname) + for fname in listdir(path.join(_base_path, name)) + if (fname.startswith("plc_%s_main" % name) and + fname.endswith(".c"))}}) for name in listdir(_base_path) - if path.isdir(path.join(_base_path, name)) - and not name.startswith("__")]) + if (path.isdir(path.join(_base_path, name)) + and not name.startswith("__"))]) toolchains = {"gcc": path.join(_base_path, "XSD_toolchain_gcc"), "makefile": path.join(_base_path, "XSD_toolchain_makefile")} diff -r c1e5b9f19483 -r c74815729afd targets/toolchain_gcc.py --- a/targets/toolchain_gcc.py Thu Aug 17 17:25:17 2017 +0300 +++ b/targets/toolchain_gcc.py Fri Aug 18 12:36:31 2017 +0300 @@ -54,7 +54,7 @@ Returns list of builder specific LDFLAGS """ return self.CTRInstance.LDFLAGS + \ - [self.CTRInstance.GetTarget().getcontent().getLDFLAGS()] + [self.CTRInstance.GetTarget().getcontent().getLDFLAGS()] def getCompiler(self): """ diff -r c1e5b9f19483 -r c74815729afd targets/typemapping.py --- a/targets/typemapping.py Thu Aug 17 17:25:17 2017 +0300 +++ b/targets/typemapping.py Fri Aug 18 12:36:31 2017 +0300 @@ -100,8 +100,7 @@ buffptr = cast(ctypes.pythonapi.PyString_AsString(id(buff)), c_void_p).value for iectype in indexes: c_type, unpack_func, pack_func = \ - TypeTranslator.get(iectype, - (None, None, None)) + TypeTranslator.get(iectype, (None, None, None)) if c_type is not None and buffoffset < buffsize: cursor = c_void_p(buffptr + buffoffset) value = unpack_func(cast(cursor, diff -r c1e5b9f19483 -r c74815729afd version.py --- a/version.py Thu Aug 17 17:25:17 2017 +0300 +++ b/version.py Fri Aug 18 12:36:31 2017 +0300 @@ -31,13 +31,13 @@ def GetCommunityHelpMsg(): return _("The best place to ask questions about Beremiz/PLCOpenEditor\n" - "is project's mailing list: beremiz-devel@lists.sourceforge.net\n" - "\n" - "This is the main community support channel.\n" - "For posting it is required to be subscribed to the mailing list.\n" - "\n" - "You can subscribe to the list here:\n" - "https://lists.sourceforge.net/lists/listinfo/beremiz-devel") + "is project's mailing list: beremiz-devel@lists.sourceforge.net\n" + "\n" + "This is the main community support channel.\n" + "For posting it is required to be subscribed to the mailing list.\n" + "\n" + "You can subscribe to the list here:\n" + "https://lists.sourceforge.net/lists/listinfo/beremiz-devel") def GetAppRevision(): @@ -81,8 +81,8 @@ info.WebSite = ("http://beremiz.org", "beremiz.org") info.Description = _("Open Source framework for automation, " - "implemented IEC 61131 IDE with constantly growing set of extensions " - "and flexible PLC runtime.") + "implemented IEC 61131 IDE with constantly growing set of extensions " + "and flexible PLC runtime.") info.Developers = ("Andrey Skvortsov ", "Sergey Surkov ", diff -r c1e5b9f19483 -r c74815729afd xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Thu Aug 17 17:25:17 2017 +0300 +++ b/xmlclass/xmlclass.py Fri Aug 18 12:36:31 2017 +0300 @@ -1229,8 +1229,9 @@ if infos["maxOccurs"] == "unbounded": return "(?:%s){%d,}" % (name, infos["minOccurs"], name) else: - return "(?:%s){%d,%d}" % (name, infos["minOccurs"], - infos["maxOccurs"]) + return "(?:%s){%d,%d}" % (name, + infos["minOccurs"], + infos["maxOccurs"]) def GetStructurePattern(classinfos): diff -r c1e5b9f19483 -r c74815729afd xmlclass/xsdschema.py --- a/xmlclass/xsdschema.py Thu Aug 17 17:25:17 2017 +0300 +++ b/xmlclass/xsdschema.py Fri Aug 18 12:36:31 2017 +0300 @@ -588,11 +588,11 @@ if basetypeinfos["type"] == SIMPLETYPE: contenttypeinfos = simpleContent.copy() simpleContent.pop("base") - elif basetypeinfos["type"] == COMPLEXTYPE and \ - len(basetypeinfos["elements"]) == 1 and \ - basetypeinfos["elements"][0]["name"] == "content" and \ - "elmt_type" in basetypeinfos["elements"][0] and \ - basetypeinfos["elements"][0]["elmt_type"]["type"] == SIMPLETYPE: + elif (basetypeinfos["type"] == COMPLEXTYPE and + len(basetypeinfos["elements"]) == 1 and + basetypeinfos["elements"][0]["name"] == "content" and + "elmt_type" in basetypeinfos["elements"][0] and + basetypeinfos["elements"][0]["elmt_type"]["type"] == SIMPLETYPE): contenttypeinfos = simpleContent.copy() contenttypeinfos["base"] = basetypeinfos["elements"][0]["elmt_type"] else: