--- a/BeremizIDE.py Tue Aug 15 17:01:51 2017 +0300
+++ b/BeremizIDE.py Tue Aug 15 22:38:43 2017 +0300
@@ -107,7 +107,7 @@
self.LastRefreshTime = gettime()
self.LastRefreshTimer = None
- def write(self, s, style = None):
+ def write(self, s, style=None):
if self.lock.acquire():
self.stack.append((s, style))
self.lock.release()
@@ -382,7 +382,7 @@
self.ConnectionStatusBar = esb.EnhancedStatusBar(self, style=wx.ST_SIZEGRIP)
self._init_coll_ConnectionStatusBar_Fields(self.ConnectionStatusBar)
- self.ProgressStatusBar = wx.Gauge(self.ConnectionStatusBar, -1, range = 100)
+ self.ProgressStatusBar = wx.Gauge(self.ConnectionStatusBar, -1, range=100)
self.ConnectionStatusBar.AddWidget(self.ProgressStatusBar, esb.ESB_EXACT_FIT, esb.ESB_EXACT_FIT, 2)
self.ProgressStatusBar.Hide()
self.SetStatusBar(self.ConnectionStatusBar)
@@ -472,7 +472,7 @@
else:
self.SetTitle(name)
- def StartLocalRuntime(self, taskbaricon = True):
+ def StartLocalRuntime(self, taskbaricon=True):
if (self.local_runtime is None) or (self.local_runtime.exitcode is not None):
# create temporary directory for runtime working directory
self.local_runtime_tmpdir = tempfile.mkdtemp()
@@ -487,8 +487,8 @@
{False: "-x 0", True: "-x 1"}[taskbaricon],
self.local_runtime_tmpdir),
no_gui=False,
- timeout=500, keyword = self.local_runtime_tmpdir,
- cwd = self.local_runtime_tmpdir)
+ timeout=500, keyword=self.local_runtime_tmpdir,
+ cwd=self.local_runtime_tmpdir)
self.local_runtime.spin()
return self.runtime_port
--- a/Beremiz_service.py Tue Aug 15 17:01:51 2017 +0300
+++ b/Beremiz_service.py Tue Aug 15 22:38:43 2017 +0300
@@ -189,14 +189,14 @@
class ParamsEntryDialog(wx.TextEntryDialog):
if wx.VERSION < (2, 6, 0):
- def Bind(self, event, function, id = None):
+ def Bind(self, event, function, id=None):
if id is not None:
event(self, id, function)
else:
event(self, function)
- def __init__(self, parent, message, caption = _("Please enter text"), defaultValue = "",
- style = wx.OK|wx.CANCEL|wx.CENTRE, pos = wx.DefaultPosition):
+ def __init__(self, parent, message, caption=_("Please enter text"), defaultValue="",
+ style=wx.OK|wx.CANCEL|wx.CENTRE, pos=wx.DefaultPosition):
wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos)
self.Tests = []
--- a/CodeFileTreeNode.py Tue Aug 15 17:01:51 2017 +0300
+++ b/CodeFileTreeNode.py Tue Aug 15 22:38:43 2017 +0300
@@ -121,10 +121,10 @@
self.CodeFile, error = self.CodeFileParser.LoadXMLString(codefile_xml)
if error is not None:
(fname, lnum, src) = ((self.CODEFILE_NAME,) + error)
- self.GetCTRoot().logger.write_warning(XSDSchemaErrorMessage.format(a1 = fname, a2 = lnum, a3 = src))
+ self.GetCTRoot().logger.write_warning(XSDSchemaErrorMessage.format(a1=fname, a2=lnum, a3=src))
self.CreateCodeFileBuffer(True)
except Exception, exc:
- msg = _("Couldn't load confnode parameters {a1} :\n {a2}").format(a1 = CTNName, a2 = unicode(exc))
+ msg = _("Couldn't load confnode parameters {a1} :\n {a2}").format(a1=CTNName, a2=unicode(exc))
self.GetCTRoot().logger.write_error(msg)
self.GetCTRoot().logger.write_error(traceback.format_exc())
else:
@@ -135,7 +135,7 @@
def GetBaseTypes(self):
return self.GetCTRoot().GetBaseTypes()
- def GetDataTypes(self, basetypes = False):
+ def GetDataTypes(self, basetypes=False):
return self.GetCTRoot().GetDataTypes(basetypes=basetypes)
def GenerateNewName(self, format, start_idx):
--- a/ConfigTreeNode.py Tue Aug 15 17:01:51 2017 +0300
+++ b/ConfigTreeNode.py Tue Aug 15 22:38:43 2017 +0300
@@ -145,7 +145,7 @@
#Default, do nothing and return success
return True
- def GetParamsAttributes(self, path = None):
+ def GetParamsAttributes(self, path=None):
if path:
parts = path.split(".", 1)
if self.MandatoryParams and parts[0] == self.MandatoryParams[0]:
@@ -424,7 +424,7 @@
shutil.move(oldname, self.CTNPath())
# warn user he has two left hands
if DesiredName != res:
- msg = _("A child named \"{a1}\" already exists -> \"{a2}\"\n").format(a1 = DesiredName, a2 = res)
+ msg = _("A child named \"{a1}\" already exists -> \"{a2}\"\n").format(a1=DesiredName, a2=res)
self.GetCTRoot().logger.write_warning(msg)
return res
@@ -529,7 +529,7 @@
try:
CTNClass, CTNHelp = CTNChildrenTypes[CTNType]
except KeyError:
- raise Exception, _("Cannot create child {a1} of type {a2} ").format(a1 = CTNName, a2 = CTNType)
+ raise Exception, _("Cannot create child {a1} of type {a2} ").format(a1=CTNName, a2=CTNType)
# if CTNClass is a class factory, call it. (prevent unneeded imports)
if type(CTNClass) == types.FunctionType:
@@ -539,7 +539,7 @@
ChildrenWithSameClass = self.Children.setdefault(CTNType, list())
# Check count
if getattr(CTNClass, "CTNMaxCount", None) and len(ChildrenWithSameClass) >= CTNClass.CTNMaxCount:
- msg = _("Max count ({a1}) reached for this confnode of type {a2} ").format(a1 = CTNClass.CTNMaxCount, a2 = CTNType)
+ msg = _("Max count ({a1}) reached for this confnode of type {a2} ").format(a1=CTNClass.CTNMaxCount, a2=CTNType)
raise Exception, msg
# create the final class, derived of provided confnode and template
@@ -567,7 +567,7 @@
# Basic check. Better to fail immediately.
if (_self.BaseParams.getName() != NewCTNName):
msg = _("Project tree layout do not match confnode.xml {a1}!={a2} ").\
- format(a1 = NewCTNName, a2 = _self.BaseParams.getName())
+ format(a1=NewCTNName, a2=_self.BaseParams.getName())
raise Exception, msg
# Now, self.CTNPath() should be OK
@@ -608,7 +608,7 @@
child.ClearChildren()
self.Children = {}
- def LoadXMLParams(self, CTNName = None):
+ def LoadXMLParams(self, CTNName=None):
methode_name = os.path.join(self.CTNPath(CTNName), "methods.py")
if os.path.isfile(methode_name):
execfile(methode_name)
@@ -622,11 +622,11 @@
self.BaseParams, error = _BaseParamsParser.LoadXMLString(basexmlfile.read())
if error is not None:
(fname, lnum, src) = ((ConfNodeName + " BaseParams",) + error)
- self.GetCTRoot().logger.write_warning(XSDSchemaErrorMessage.format(a1 = fname, a2 = lnum, a3 = src))
+ self.GetCTRoot().logger.write_warning(XSDSchemaErrorMessage.format(a1=fname, a2=lnum, a3=src))
self.MandatoryParams = ("BaseParams", self.BaseParams)
basexmlfile.close()
except Exception, exc:
- msg = _("Couldn't load confnode base parameters {a1} :\n {a2}").format(a1 = ConfNodeName, a2 = unicode(exc))
+ msg = _("Couldn't load confnode base parameters {a1} :\n {a2}").format(a1=ConfNodeName, a2=unicode(exc))
self.GetCTRoot().logger.write_error(msg)
self.GetCTRoot().logger.write_error(traceback.format_exc())
@@ -637,13 +637,13 @@
obj, error = self.Parser.LoadXMLString(xmlfile.read())
if error is not None:
(fname, lnum, src) = ((ConfNodeName,) + error)
- self.GetCTRoot().logger.write_warning(XSDSchemaErrorMessage.format(a1 = fname, a2 = lnum, a3 = src))
+ self.GetCTRoot().logger.write_warning(XSDSchemaErrorMessage.format(a1=fname, a2=lnum, a3=src))
name = obj.getLocalTag()
setattr(self, name, obj)
self.CTNParams = (name, obj)
xmlfile.close()
except Exception, exc:
- msg = _("Couldn't load confnode parameters {a1} :\n {a2}").format(a1 = ConfNodeName, a2 = unicode(exc))
+ msg = _("Couldn't load confnode parameters {a1} :\n {a2}").format(a1=ConfNodeName, a2=unicode(exc))
self.GetCTRoot().logger.write_error(msg)
self.GetCTRoot().logger.write_error(traceback.format_exc())
@@ -656,6 +656,6 @@
try:
self.CTNAddChild(pname, ptype)
except Exception, exc:
- msg = _("Could not add child \"{a1}\", type {a2} :\n{a3}\n").format(a1 = pname, a2 = ptype, a3 = unicode(exc))
+ msg = _("Could not add child \"{a1}\", type {a2} :\n{a3}\n").format(a1=pname, a2=ptype, a3=unicode(exc))
self.GetCTRoot().logger.write_error(msg)
self.GetCTRoot().logger.write_error(traceback.format_exc())
--- a/IDEFrame.py Tue Aug 15 17:01:51 2017 +0300
+++ b/IDEFrame.py Tue Aug 15 22:38:43 2017 +0300
@@ -336,7 +336,7 @@
# Compatibility function for wx versions < 2.6
if wx.VERSION < (2, 6, 0):
- def Bind(self, event, function, id = None):
+ def Bind(self, event, function, id=None):
if id is not None:
event(self, id, function)
else:
@@ -657,7 +657,7 @@
# @param controler The controler been used by PLCOpenEditor (default: None).
# @param fileOpen The filepath to open if no controler defined (default: None).
# @param debug The filepath to open if no controler defined (default: False).
- def __init__(self, parent, enable_debug = False):
+ def __init__(self, parent, enable_debug=False):
self.Controler = None
self.Config = wx.ConfigBase.Get()
self.EnableDebug = enable_debug
@@ -1607,7 +1607,7 @@
old_name = self.ProjectTree.GetItemText(item)
item_infos = self.ProjectTree.GetPyData(item)
if item_infos["type"] == ITEM_PROJECT:
- self.Controler.SetProjectProperties(name = new_name)
+ self.Controler.SetProjectProperties(name=new_name)
elif item_infos["type"] == ITEM_DATATYPE:
if new_name.upper() in [name.upper() for name in self.Controler.GetProjectDataTypeNames() if name != old_name]:
message = _("\"%s\" data type already exists!") % new_name
@@ -1776,7 +1776,7 @@
else:
event.Skip()
- def EditProjectElement(self, element, tagname, onlyopened = False):
+ def EditProjectElement(self, element, tagname, onlyopened=False):
openedidx = self.IsOpened(tagname)
if openedidx is not None:
old_selected = self.TabsOpened.GetSelection()
@@ -2298,7 +2298,7 @@
self._Refresh(TITLE, FILEMENU, EDITMENU, PROJECTTREE)
self.EditProjectElement(ITEM_DATATYPE, tagname)
- def GenerateAddPouFunction(self, pou_type, type_readonly = False):
+ def GenerateAddPouFunction(self, pou_type, type_readonly=False):
def OnAddPouMenu(event):
dialog = PouDialog(self, pou_type, type_readonly)
dialog.SetPouNames(self.Controler.GetProjectPouNames())
@@ -2557,7 +2557,7 @@
class GraphicPrintout(wx.Printout):
- def __init__(self, viewer, page_size, margins, preview = False):
+ def __init__(self, viewer, page_size, margins, preview=False):
wx.Printout.__init__(self)
self.Viewer = viewer
self.PageSize = page_size
--- a/PLCControler.py Tue Aug 15 17:01:51 2017 +0300
+++ b/PLCControler.py Tue Aug 15 22:38:43 2017 +0300
@@ -456,7 +456,7 @@
Class implementing a buffer of changes made on the current editing model
"""
- def __init__(self, currentstate, issaved = False):
+ def __init__(self, currentstate, issaved=False):
"""
Constructor initialising buffer
"""
@@ -569,7 +569,7 @@
def GetQualifierTypes(self):
return QualifierList
- def GetProject(self, debug = False):
+ def GetProject(self, debug=False):
if debug and self.CurrentCompiledProject is not None:
return self.CurrentCompiledProject
else:
@@ -601,28 +601,28 @@
self.Buffering = False
# Return project data type names
- def GetProjectDataTypeNames(self, debug = False):
+ def GetProjectDataTypeNames(self, debug=False):
project = self.GetProject(debug)
if project is not None:
return [datatype.getname() for datatype in project.getdataTypes()]
return []
# Return project pou names
- def GetProjectPouNames(self, debug = False):
+ def GetProjectPouNames(self, debug=False):
project = self.GetProject(debug)
if project is not None:
return [pou.getname() for pou in project.getpous()]
return []
# Return project pou names
- def GetProjectConfigNames(self, debug = False):
+ def GetProjectConfigNames(self, debug=False):
project = self.GetProject(debug)
if project is not None:
return [config.getname() for config in project.getconfigurations()]
return []
# Return project pou variable names
- def GetProjectPouVariableNames(self, pou_name = None, debug = False):
+ def GetProjectPouVariableNames(self, pou_name=None, debug=False):
variables = []
project = self.GetProject(debug)
if project is not None:
@@ -662,7 +662,7 @@
self.FileName = os.path.splitext(os.path.basename(filepath))[0]
# Change project properties
- def SetProjectProperties(self, name = None, properties = None, buffer = True):
+ def SetProjectProperties(self, name=None, properties=None, buffer=True):
if self.Project is not None:
if name is not None:
self.Project.setname(name)
@@ -680,7 +680,7 @@
return None
# Return project properties
- def GetProjectProperties(self, debug = False):
+ def GetProjectProperties(self, debug=False):
project = self.GetProject(debug)
if project is not None:
properties = project.getfileHeader()
@@ -689,7 +689,7 @@
return None
# Return project informations
- def GetProjectInfos(self, debug = False):
+ def GetProjectInfos(self, debug=False):
project = self.GetProject(debug)
if project is not None:
infos = {"name": project.getname(), "type": ITEM_PROJECT}
@@ -755,7 +755,7 @@
return infos
return None
- def GetPouVariables(self, tagname, debug = False):
+ def GetPouVariables(self, tagname, debug=False):
pou_type = None
project = self.GetProject(debug)
if project is not None:
@@ -768,7 +768,7 @@
etree.parse(
os.path.join(ScriptDirectory, "plcopen", "pou_variables.xslt"),
parser),
- extensions = {("pou_vars_ns", name): getattr(factory, name)
+ extensions={("pou_vars_ns", name): getattr(factory, name)
for name in ["SetRoot", "AddVariable"]})
obj = None
@@ -783,7 +783,7 @@
return None
- def GetInstanceList(self, root, name, debug = False):
+ def GetInstanceList(self, root, name, debug=False):
instances = []
project = self.GetProject(debug)
if project is not None:
@@ -796,7 +796,7 @@
etree.parse(
os.path.join(ScriptDirectory, "plcopen", "instances_path.xslt"),
parser),
- extensions = {
+ extensions={
("instances_ns", "AddInstance"): factory.AddInstance})
instances_path_xslt_tree(root,
@@ -804,7 +804,7 @@
return instances
- def SearchPouInstances(self, tagname, debug = False):
+ def SearchPouInstances(self, tagname, debug=False):
project = self.GetProject(debug)
if project is not None:
words = tagname.split("::")
@@ -820,7 +820,7 @@
self.ComputePouName(words[1]), debug)]
return []
- def GetPouInstanceTagName(self, instance_path, debug = False):
+ def GetPouInstanceTagName(self, instance_path, debug=False):
project = self.GetProject(debug)
factory = InstanceTagName(self)
@@ -831,7 +831,7 @@
etree.parse(
os.path.join(ScriptDirectory, "plcopen", "instance_tagname.xslt"),
parser),
- extensions = {("instance_tagname_ns", name): getattr(factory, name)
+ extensions={("instance_tagname_ns", name): getattr(factory, name)
for name in ["ConfigTagName", "ResourceTagName",
"PouTagName", "ActionTagName",
"TransitionTagName"]})
@@ -841,7 +841,7 @@
return factory.GetTagName()
- def GetInstanceInfos(self, instance_path, debug = False):
+ def GetInstanceInfos(self, instance_path, debug=False):
tagname = self.GetPouInstanceTagName(instance_path)
if tagname is not None:
infos = self.GetPouVariables(tagname, debug)
@@ -858,21 +858,21 @@
return None
# Return if data type given by name is used by another data type or pou
- def DataTypeIsUsed(self, name, debug = False):
+ def DataTypeIsUsed(self, name, debug=False):
project = self.GetProject(debug)
if project is not None:
return len(self.GetInstanceList(project, name, debug)) > 0
return False
# Return if pou given by name is used by another pou
- def PouIsUsed(self, name, debug = False):
+ def PouIsUsed(self, name, debug=False):
project = self.GetProject(debug)
if project is not None:
return len(self.GetInstanceList(project, name, debug)) > 0
return False
# Return if pou given by name is directly or undirectly used by the reference pou
- def PouIsUsedBy(self, name, reference, debug = False):
+ def PouIsUsedBy(self, name, reference, debug=False):
pou_infos = self.GetPou(reference, debug)
if pou_infos is not None:
return len(self.GetInstanceList(pou_infos, name, debug)) > 0
@@ -1005,7 +1005,7 @@
# programs cannot be pasted as functions or function blocks
if orig_type == 'functionBlock' and pou_type == 'function' or \
orig_type == 'program' and pou_type in ['function', 'functionBlock']:
- msg = _('''{a1} "{a2}" can't be pasted as a {a3}.''').format(a1 = orig_type, a2 = name, a3 = pou_type)
+ msg = _('''{a1} "{a2}" can't be pasted as a {a3}.''').format(a1=orig_type, a2=name, a3=pou_type)
return msg
new_pou.setpouType(pou_type)
@@ -1175,7 +1175,7 @@
self.BufferProject()
# Return the description of the pou given by its name
- def GetPouDescription(self, name, debug = False):
+ def GetPouDescription(self, name, debug=False):
project = self.GetProject(debug)
if project is not None:
# Found the pou correponding to name and return its type
@@ -1185,7 +1185,7 @@
return ""
# Return the description of the pou given by its name
- def SetPouDescription(self, name, description, debug = False):
+ def SetPouDescription(self, name, description, debug=False):
project = self.GetProject(debug)
if project is not None:
# Found the pou correponding to name and return its type
@@ -1195,7 +1195,7 @@
self.BufferProject()
# Return the type of the pou given by its name
- def GetPouType(self, name, debug = False):
+ def GetPouType(self, name, debug=False):
project = self.GetProject(debug)
if project is not None:
# Found the pou correponding to name and return its type
@@ -1205,7 +1205,7 @@
return None
# Return pous with SFC language
- def GetSFCPous(self, debug = False):
+ def GetSFCPous(self, debug=False):
list = []
project = self.GetProject(debug)
if project is not None:
@@ -1215,7 +1215,7 @@
return list
# Return the body language of the pou given by its name
- def GetPouBodyType(self, name, debug = False):
+ def GetPouBodyType(self, name, debug=False):
project = self.GetProject(debug)
if project is not None:
# Found the pou correponding to name and return its body language
@@ -1225,7 +1225,7 @@
return None
# Return the actions of a pou
- def GetPouTransitions(self, pou_name, debug = False):
+ def GetPouTransitions(self, pou_name, debug=False):
transitions = []
project = self.GetProject(debug)
if project is not None:
@@ -1237,7 +1237,7 @@
return transitions
# Return the body language of the transition given by its name
- def GetTransitionBodyType(self, pou_name, pou_transition, debug = False):
+ def GetTransitionBodyType(self, pou_name, pou_transition, debug=False):
project = self.GetProject(debug)
if project is not None:
# Found the pou correponding to name
@@ -1250,7 +1250,7 @@
return None
# Return the actions of a pou
- def GetPouActions(self, pou_name, debug = False):
+ def GetPouActions(self, pou_name, debug=False):
actions = []
project = self.GetProject(debug)
if project is not None:
@@ -1262,7 +1262,7 @@
return actions
# Return the body language of the pou given by its name
- def GetActionBodyType(self, pou_name, pou_action, debug = False):
+ def GetActionBodyType(self, pou_name, pou_action, debug=False):
project = self.GetProject(debug)
if project is not None:
# Found the pou correponding to name and return its body language
@@ -1368,7 +1368,7 @@
etree.parse(
os.path.join(ScriptDirectory, "plcopen", "variables_infos.xslt"),
parser),
- extensions = {("var_infos_ns", name): getattr(factory, name)
+ extensions={("var_infos_ns", name): getattr(factory, name)
for name in ["SetType", "AddDimension", "AddTree",
"AddVarToTree", "AddVariable"]})
variables_infos_xslt_tree(object_with_vars,
@@ -1400,7 +1400,7 @@
in self.ExtractVarLists(vars)])
# Return the configuration globalvars
- def GetConfigurationGlobalVars(self, name, debug = False):
+ def GetConfigurationGlobalVars(self, name, debug=False):
project = self.GetProject(debug)
if project is not None:
# Found the configuration corresponding to name
@@ -1412,7 +1412,7 @@
return []
# Return configuration variable names
- def GetConfigurationVariableNames(self, config_name = None, debug = False):
+ def GetConfigurationVariableNames(self, config_name=None, debug=False):
variables = []
project = self.GetProject(debug)
if project is not None:
@@ -1437,7 +1437,7 @@
in self.ExtractVarLists(vars)])
# Return the resource globalvars
- def GetConfigurationResourceGlobalVars(self, config_name, name, debug = False):
+ def GetConfigurationResourceGlobalVars(self, config_name, name, debug=False):
project = self.GetProject(debug)
if project is not None:
# Found the resource corresponding to name
@@ -1450,7 +1450,7 @@
# Return resource variable names
def GetConfigurationResourceVariableNames(self,
- config_name = None, resource_name = None, debug = False):
+ config_name=None, resource_name=None, debug=False):
variables = []
project = self.GetProject(debug)
if project is not None:
@@ -1466,7 +1466,7 @@
return variables
# Return the interface for the given pou
- def GetPouInterfaceVars(self, pou, tree=False, debug = False):
+ def GetPouInterfaceVars(self, pou, tree=False, debug=False):
interface = pou.interface
# Verify that the pou has an interface
if interface is not None:
@@ -1533,7 +1533,7 @@
etree.parse(
os.path.join(ScriptDirectory, "plcopen", "variables_infos.xslt"),
parser),
- extensions = {("var_infos_ns", name): getattr(factory, name)
+ extensions={("var_infos_ns", name): getattr(factory, name)
for name in ["SetType", "AddDimension",
"AddTree", "AddVarToTree"]})
return_type_infos_xslt_tree(return_type,
@@ -1565,7 +1565,7 @@
self.TotalTypesDict = StdBlckDct.copy()
self.TotalTypes = StdBlckLst[:]
- def GetConfNodeDataTypes(self, exclude = None, only_locatables = False):
+ def GetConfNodeDataTypes(self, exclude=None, only_locatables=False):
return [{"name": _("%s Data Types") % confnodetypes["name"],
"list": [
datatype.getname()
@@ -1606,7 +1606,7 @@
return global_vars
# Function that returns the block definition associated to the block type given
- def GetBlockType(self, typename, inputs = None, debug = False):
+ def GetBlockType(self, typename, inputs=None, debug=False):
result_blocktype = None
for sectioname, blocktype in self.TotalTypesDict.get(typename, []):
if inputs is not None and inputs != "undefined":
@@ -1639,7 +1639,7 @@
return None
# Return Block types checking for recursion
- def GetBlockTypes(self, tagname = "", debug = False):
+ def GetBlockTypes(self, tagname="", debug=False):
typename = None
words = tagname.split("::")
name = None
@@ -1666,7 +1666,7 @@
return self.TotalTypes
# Return Function Block types checking for recursion
- def GetFunctionBlockTypes(self, tagname = "", debug = False):
+ def GetFunctionBlockTypes(self, tagname="", debug=False):
project = self.GetProject(debug)
words = tagname.split("::")
name = None
@@ -1685,7 +1685,7 @@
return blocktypes
# Return Block types checking for recursion
- def GetBlockResource(self, debug = False):
+ def GetBlockResource(self, debug=False):
blocktypes = []
for category in StdBlckLst[:-1]:
for blocktype in category["list"]:
@@ -1699,7 +1699,7 @@
return blocktypes
# Return Data Types checking for recursion
- def GetDataTypes(self, tagname = "", basetypes = True, confnodetypes = True, only_locatables = False, debug = False):
+ def GetDataTypes(self, tagname="", basetypes=True, confnodetypes=True, only_locatables=False, debug=False):
if basetypes:
datatypes = self.GetBaseTypes()
else:
@@ -1722,7 +1722,7 @@
return datatypes
# Return Data Type Object
- def GetPou(self, typename, debug = False):
+ def GetPou(self, typename, debug=False):
project = self.GetProject(debug)
if project is not None:
result = project.getpou(typename)
@@ -1739,7 +1739,7 @@
return None
# Return Data Type Object
- def GetDataType(self, typename, debug = False):
+ def GetDataType(self, typename, debug=False):
project = self.GetProject(debug)
if project is not None:
result = project.getdataType(typename)
@@ -1765,7 +1765,7 @@
return None
# Return Base Type of given possible derived type
- def GetBaseType(self, typename, debug = False):
+ def GetBaseType(self, typename, debug=False):
if TypeHierarchy.has_key(typename):
return typename
@@ -1786,7 +1786,7 @@
'''
return [x for x, y in TypeHierarchy_list if not x.startswith("ANY")]
- def IsOfType(self, typename, reference, debug = False):
+ def IsOfType(self, typename, reference, debug=False):
if reference is None or typename == reference:
return True
@@ -1807,7 +1807,7 @@
return not typename.startswith("ANY")
return True
- def IsLocatableDataType(self, datatype, debug = False):
+ def IsLocatableDataType(self, datatype, debug=False):
basetype_content = datatype.baseType.getcontent()
basetype_content_type = basetype_content.getLocalTag()
if basetype_content_type in ["enum", "struct"]:
@@ -1820,7 +1820,7 @@
return self.IsLocatableType(array_base_type.getname(), debug)
return True
- def IsLocatableType(self, typename, debug = False):
+ def IsLocatableType(self, typename, debug=False):
if isinstance(typename, TupleType) or self.GetBlockType(typename) is not None:
return False
@@ -1833,7 +1833,7 @@
return self.IsLocatableDataType(datatype)
return True
- def IsEnumeratedType(self, typename, debug = False):
+ def IsEnumeratedType(self, typename, debug=False):
if isinstance(typename, TupleType):
typename = typename[1]
datatype = self.GetDataType(typename, debug)
@@ -1845,7 +1845,7 @@
return basetype_content_type == "enum"
return False
- def IsSubrangeType(self, typename, exclude=None, debug = False):
+ def IsSubrangeType(self, typename, exclude=None, debug=False):
if typename == exclude:
return False
if isinstance(typename, TupleType):
@@ -1861,11 +1861,11 @@
self.GetDataTypeBaseType(datatype), exclude)
return False
- def IsNumType(self, typename, debug = False):
+ def IsNumType(self, typename, debug=False):
return self.IsOfType(typename, "ANY_NUM", debug) or\
self.IsOfType(typename, "ANY_BIT", debug)
- def GetDataTypeRange(self, typename, debug = False):
+ def GetDataTypeRange(self, typename, debug=False):
range = DataTypeRange.get(typename)
if range is not None:
return range
@@ -1881,7 +1881,7 @@
return None
# Return Subrange types
- def GetSubrangeBaseTypes(self, exclude, debug = False):
+ def GetSubrangeBaseTypes(self, exclude, debug=False):
subrange_basetypes = DataTypeRange.keys()
project = self.GetProject(debug)
if project is not None:
@@ -1895,7 +1895,7 @@
return subrange_basetypes
# Return Enumerated Values
- def GetEnumeratedDataValues(self, typename = None, debug = False):
+ def GetEnumeratedDataValues(self, typename=None, debug=False):
values = []
if typename is not None:
datatype_obj = self.GetDataType(typename, debug)
@@ -1961,7 +1961,7 @@
#-------------------------------------------------------------------------------
# Return the data type informations
- def GetDataTypeInfos(self, tagname, debug = False):
+ def GetDataTypeInfos(self, tagname, debug=False):
project = self.GetProject(debug)
if project is not None:
words = tagname.split("::")
@@ -2161,7 +2161,7 @@
#-------------------------------------------------------------------------------
# Return edited element
- def GetEditedElement(self, tagname, debug = False):
+ def GetEditedElement(self, tagname, debug=False):
project = self.GetProject(debug)
if project is not None:
words = tagname.split("::")
@@ -2192,14 +2192,14 @@
return None
# Return edited element name and type
- def GetEditedElementType(self, tagname, debug = False):
+ def GetEditedElementType(self, tagname, debug=False):
words = tagname.split("::")
if words[0] in ["P", "T", "A"]:
return words[1], self.GetPouType(words[1], debug)
return None, None
# Return language in which edited element is written
- def GetEditedElementBodyType(self, tagname, debug = False):
+ def GetEditedElementBodyType(self, tagname, debug=False):
words = tagname.split("::")
if words[0] == "P":
return self.GetPouBodyType(words[1], debug)
@@ -2210,7 +2210,7 @@
return None
# Return the edited element variables
- def GetEditedElementInterfaceVars(self, tagname, tree=False, debug = False):
+ def GetEditedElementInterfaceVars(self, tagname, tree=False, debug=False):
words = tagname.split("::")
if words[0] in ["P", "T", "A"]:
project = self.GetProject(debug)
@@ -2221,7 +2221,7 @@
return []
# Return the edited element return type
- def GetEditedElementInterfaceReturnType(self, tagname, tree=False, debug = False):
+ def GetEditedElementInterfaceReturnType(self, tagname, tree=False, debug=False):
words = tagname.split("::")
if words[0] == "P":
project = self.GetProject(debug)
@@ -2241,14 +2241,14 @@
element.settext(text)
# Return the edited element text
- def GetEditedElementText(self, tagname, debug = False):
+ def GetEditedElementText(self, tagname, debug=False):
element = self.GetEditedElement(tagname, debug)
if element is not None:
return element.gettext()
return ""
# Return the edited element transitions
- def GetEditedElementTransitions(self, tagname, debug = False):
+ def GetEditedElementTransitions(self, tagname, debug=False):
pou = self.GetEditedElement(tagname, debug)
if pou is not None and pou.getbodyType() == "SFC":
transitions = []
@@ -2258,7 +2258,7 @@
return []
# Return edited element transitions
- def GetEditedElementActions(self, tagname, debug = False):
+ def GetEditedElementActions(self, tagname, debug=False):
pou = self.GetEditedElement(tagname, debug)
if pou is not None and pou.getbodyType() == "SFC":
actions = []
@@ -2268,7 +2268,7 @@
return []
# Return the names of the pou elements
- def GetEditedElementVariables(self, tagname, debug = False):
+ def GetEditedElementVariables(self, tagname, debug=False):
words = tagname.split("::")
if words[0] in ["P", "T", "A"]:
return self.GetProjectPouVariableNames(words[1], debug)
@@ -2280,13 +2280,13 @@
return names
return []
- def GetEditedElementCopy(self, tagname, debug = False):
+ def GetEditedElementCopy(self, tagname, debug=False):
element = self.GetEditedElement(tagname, debug)
if element is not None:
return element.tostring()
return ""
- def GetEditedElementInstancesCopy(self, tagname, blocks_id = None, wires = None, debug = False):
+ def GetEditedElementInstancesCopy(self, tagname, blocks_id=None, wires=None, debug=False):
element = self.GetEditedElement(tagname, debug)
text = ""
if element is not None:
@@ -2444,7 +2444,7 @@
return new_id, connections
- def GetEditedElementInstancesInfos(self, tagname, debug = False):
+ def GetEditedElementInstancesInfos(self, tagname, debug=False):
element_instances = OrderedDict()
element = self.GetEditedElement(tagname, debug)
if element is not None:
@@ -2452,7 +2452,7 @@
pou_block_instances_xslt_tree = etree.XSLT(
pou_block_instances_xslt,
- extensions = {
+ extensions={
("pou_block_instances_ns", name): getattr(factory, name)
for name in ["AddBlockInstance", "SetSpecificValues",
"AddInstanceConnection", "AddConnectionLink",
@@ -2540,7 +2540,7 @@
if pou is not None:
pou.removepouVar(type, name)
- def AddEditedElementBlock(self, tagname, id, blocktype, blockname = None):
+ def AddEditedElementBlock(self, tagname, id, blocktype, blockname=None):
element = self.GetEditedElement(tagname)
if element is not None:
block = PLCOpenParser.CreateElement("block", "fbdObjects")
@@ -3093,7 +3093,7 @@
self.RemoveEditedElementPouVar(tagname, instance.gettypeName(), instance.getinstanceName())
element.removeinstance(id)
- def GetEditedResourceVariables(self, tagname, debug = False):
+ def GetEditedResourceVariables(self, tagname, debug=False):
varlist = []
words = tagname.split("::")
for var in self.GetConfigurationGlobalVars(words[1], debug):
@@ -3143,7 +3143,7 @@
new_instance.setname(instance["Name"])
new_instance.settypeName(instance["Type"])
- def GetEditedResourceInfos(self, tagname, debug = False):
+ def GetEditedResourceInfos(self, tagname, debug=False):
resource = self.GetEditedElement(tagname, debug)
if resource is not None:
tasks = resource.gettask()
@@ -3212,7 +3212,7 @@
self.CurrentElementEditing = None
return error
- def SaveXMLFile(self, filepath = None):
+ def SaveXMLFile(self, filepath=None):
if not filepath and self.FilePath == "":
return False
else:
--- a/PLCGenerator.py Tue Aug 15 17:01:51 2017 +0300
+++ b/PLCGenerator.py Tue Aug 15 22:38:43 2017 +0300
@@ -398,7 +398,7 @@
if single is not None:
if len(single) == 0:
msg = _("Source signal has to be defined for single task '{a1}' in resource '{a2}.{a3}'.").\
- format(a1 = task.getname(), a2 = config_name, a3 = resource.getname())
+ format(a1=task.getname(), a2=config_name, a3=resource.getname())
raise PLCGenException, msg
if single[0] == '[' and single[-1] == ']':
@@ -787,7 +787,7 @@
for element in body.getcontentInstances():
if isinstance(element, ConnectorClass) and element.getname() == name:
if connector is not None:
- msg = _("More than one connector found corresponding to \"{a1}\" continuation in \"{a2}\" POU").format(a1 = name, a2 = self.Name)
+ msg = _("More than one connector found corresponding to \"{a1}\" continuation in \"{a2}\" POU").format(a1=name, a2=self.Name)
raise PLCGenException, msg
connector = element
if connector is not None:
@@ -807,7 +807,7 @@
for connection in related:
self.ConnectionTypes[connection] = var_type
else:
- msg = _("No connector found corresponding to \"{a1}\" continuation in \"{a2}\" POU").format(a1 = name, a2 = self.Name)
+ msg = _("No connector found corresponding to \"{a1}\" continuation in \"{a2}\" POU").format(a1=name, a2=self.Name)
raise PLCGenException, msg
elif isinstance(instance, BlockClass):
block_infos = self.GetBlockType(instance.gettypeName(), "undefined")
@@ -962,7 +962,7 @@
if block_infos is None:
block_infos = self.GetBlockType(block_type)
if block_infos is None:
- raise PLCGenException, _("Undefined block type \"{a1}\" in \"{a2}\" POU").format(a1 = block_type, a2 = self.Name)
+ raise PLCGenException, _("Undefined block type \"{a1}\" in \"{a2}\" POU").format(a1=block_type, a2=self.Name)
try:
self.GenerateBlock(instance, block_infos, body, None)
except ValueError, e:
@@ -1102,7 +1102,7 @@
self.Program += JoinList([(", ", ())], vars)
self.Program += [(");\n", ())]
else:
- msg = _("\"{a1}\" function cancelled in \"{a2}\" POU: No input connected").format(a1 = type, a2 = self.TagName.split("::")[-1])
+ msg = _("\"{a1}\" function cancelled in \"{a2}\" POU: No input connected").format(a1=type, a2=self.TagName.split("::")[-1])
self.Warnings.append(msg)
elif block_infos["type"] == "functionBlock":
if not self.ComputedBlocks.get(block, False) and not order:
@@ -1192,14 +1192,14 @@
if output_parameter is None:
output_parameter = ""
if name:
- blockname = "{a1}({a2})".format(a1 = name, a2 = type)
+ blockname = "{a1}({a2})".format(a1=name, a2=type)
else:
blockname = type
msg = _("No output {a1} variable found in block {a2} in POU {a3}. Connection must be broken").\
- format(a1 = output_parameter, a2 = blockname, a3 = self.Name)
+ format(a1=output_parameter, a2=blockname, a3=self.Name)
raise ValueError, msg
- def GeneratePaths(self, connections, body, order = False, to_inout = False):
+ def GeneratePaths(self, connections, body, order=False, to_inout=False):
paths = []
for connection in connections:
localId = connection.getrefLocalId()
@@ -1215,7 +1215,7 @@
if block_infos is None:
block_infos = self.GetBlockType(block_type)
if block_infos is None:
- msg = _("Undefined block type \"{a1}\" in \"{a2}\" POU").format(a1 = block_type, a2 = self.Name)
+ msg = _("Undefined block type \"{a1}\" in \"{a2}\" POU").format(a1=block_type, a2=self.Name)
raise PLCGenException, msg
try:
paths.append(str(self.GenerateBlock(next, block_infos, body, connection, order, to_inout)))
@@ -1231,7 +1231,7 @@
for instance in body.getcontentInstances():
if isinstance(instance, ConnectorClass) and instance.getname() == name:
if connector is not None:
- msg = _("More than one connector found corresponding to \"{a1}\" continuation in \"{a2}\" POU").format(a1 = name, a2 = self.Name)
+ msg = _("More than one connector found corresponding to \"{a1}\" continuation in \"{a2}\" POU").format(a1=name, a2=self.Name)
raise PLCGenException, msg
connector = instance
if connector is not None:
@@ -1242,7 +1242,7 @@
self.ComputedConnectors[name] = expression
paths.append(str(expression))
else:
- msg = _("No connector found corresponding to \"{a1}\" continuation in \"{a2}\" POU").format(a1 = name, a2 = self.Name)
+ msg = _("No connector found corresponding to \"{a1}\" continuation in \"{a2}\" POU").format(a1=name, a2=self.Name)
raise PLCGenException, msg
elif isinstance(next, ContactClass):
contact_info = (self.TagName, "contact", next.getlocalId())
@@ -1264,7 +1264,7 @@
paths.append(str(self.GeneratePaths(next.connectionPointIn.getconnections(), body, order)))
return paths
- def ComputePaths(self, paths, first = False):
+ def ComputePaths(self, paths, first=False):
if type(paths) == TupleType:
if None in paths:
return [("TRUE", ())]
@@ -1282,7 +1282,7 @@
else:
return eval(paths)
- def ComputeExpression(self, body, connections, order = False, to_inout = False):
+ def ComputeExpression(self, body, connections, order=False, to_inout=False):
paths = self.GeneratePaths(connections, body, order, to_inout)
if len(paths) == 0:
return None
@@ -1393,7 +1393,7 @@
jump_target = jump.gettargetName()
if not pou.hasstep(jump_target):
pname = pou.getname()
- msg = _("SFC jump in pou \"{a1}\" refers to non-existent SFC step \"{a2}\"").format( a1 = pname, a2 = jump_target)
+ msg = _("SFC jump in pou \"{a1}\" refers to non-existent SFC step \"{a2}\"").format( a1=pname, a2=jump_target)
raise PLCGenException, msg
if jump.connectionPointIn is not None:
instances = []
@@ -1600,7 +1600,7 @@
self.Program += transition_infos["from"][0]
else:
msg = _("Transition with content \"{a1}\" not connected to a previous step in \"{a2}\" POU").\
- format(a1 = transition_infos["content"], a2 = self.Name)
+ format(a1=transition_infos["content"], a2=self.Name)
raise PLCGenException, msg
self.Program += [(" TO ", ())]
if len(transition_infos["to"]) > 1:
@@ -1611,7 +1611,7 @@
self.Program += transition_infos["to"][0]
else:
msg = _("Transition with content \"{a1}\" not connected to a next step in \"{a2}\" POU").\
- format(a1 = transition_infos["content"], a2 = self.Name)
+ format(a1=transition_infos["content"], a2=self.Name)
raise PLCGenException, msg
self.Program += transition_infos["content"]
self.Program += [("%sEND_TRANSITION\n\n" % self.CurrentIndent, ())]
--- a/PLCOpenEditor.py Tue Aug 15 17:01:51 2017 +0300
+++ b/PLCOpenEditor.py Tue Aug 15 22:38:43 2017 +0300
@@ -98,7 +98,7 @@
# Compatibility function for wx versions < 2.6
if wx.VERSION < (2, 6, 0):
- def Bind(self, event, function, id = None):
+ def Bind(self, event, function, id=None):
if id is not None:
event(self, id, function)
else:
@@ -180,7 +180,7 @@
# @param controler The controler been used by PLCOpenEditor (default: None).
# @param fileOpen The filepath to open if no controler defined (default: None).
# @param debug The filepath to open if no controler defined (default: False).
- def __init__(self, parent, fileOpen = None):
+ def __init__(self, parent, fileOpen=None):
self.icon = wx.Icon(os.path.join(beremiz_dir, "images", "poe.ico"), wx.BITMAP_TYPE_ICO)
IDEFrame.__init__(self, parent)
@@ -208,7 +208,7 @@
if result is not None:
(num, line) = result
- self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1 = num, a2 = line))
+ self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1=num, a2=line))
def OnCloseFrame(self, event):
if self.Controler is None or self.CheckSaveBeforeClosing(_("Close Application")):
@@ -321,7 +321,7 @@
if result is not None:
(num, line) = result
- self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1 = num, a2 = line))
+ self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1=num, a2=line))
def OnCloseProjectMenu(self, event):
if not self.CheckSaveBeforeClosing():
--- a/ProjectController.py Tue Aug 15 17:01:51 2017 +0300
+++ b/ProjectController.py Tue Aug 15 22:38:43 2017 +0300
@@ -354,7 +354,7 @@
target.setcontent(self.Parser.CreateElement(target_name, "TargetType"))
return target
- def GetParamsAttributes(self, path = None):
+ def GetParamsAttributes(self, path=None):
params = ConfigTreeNode.GetParamsAttributes(self, path)
if params[0]["name"] == "BeremizRoot":
for child in params[0]["children"]:
@@ -460,7 +460,7 @@
if error is not None:
if self.Project is not None:
(fname_err, lnum, src) = (("PLC",) + error)
- self.logger.write_warning(XSDSchemaErrorMessage.format(a1 = fname_err, a2 = lnum, a3 = src))
+ self.logger.write_warning(XSDSchemaErrorMessage.format(a1=fname_err, a2=lnum, a3=src))
else:
return error, False
if len(self.GetProjectConfigNames()) == 0:
@@ -1206,7 +1206,7 @@
text = file(plc_file).read()
except:
text = '(* No IEC code have been generated at that time ! *)'
- self._IECCodeView.SetText(text = text)
+ self._IECCodeView.SetText(text=text)
self._IECCodeView.Editor.SetReadOnly(True)
self._IECCodeView.SetIcon(GetBitmap("ST"))
setattr(self._IECCodeView, "_OnClose", self.OnCloseEditor)
@@ -1373,7 +1373,7 @@
}
return msgs.get(status, status)
- def ShowPLCProgress(self, status = "", progress = 0):
+ def ShowPLCProgress(self, status="", progress=0):
self.AppFrame.ProgressStatusBar.Show()
self.AppFrame.ConnectionStatusBar.SetStatusText(self.GetTextStatus(status), 1)
self.AppFrame.ProgressStatusBar.SetValue(progress)
@@ -1446,7 +1446,7 @@
if self.IsPLCStarted():
# Timer to prevent rapid-fire when registering many variables
# use wx.CallAfter use keep using same thread. TODO : use wx.Timer instead
- self.DebugTimer = Timer(0.5, wx.CallAfter, args = [self.RegisterDebugVarToConnector])
+ self.DebugTimer = Timer(0.5, wx.CallAfter, args=[self.RegisterDebugVarToConnector])
# Rearm anti-rapid-fire timer
self.DebugTimer.start()
--- a/canfestival/canfestival.py Tue Aug 15 17:01:51 2017 +0300
+++ b/canfestival/canfestival.py Tue Aug 15 22:38:43 2017 +0300
@@ -482,8 +482,8 @@
CTNChildrenTypes = [("CanOpenNode", _NodeListCTN, "CanOpen Master"),
("CanOpenSlave", _SlaveCTN, "CanOpen Slave" )]
- def GetParamsAttributes(self, path = None):
- infos = ConfigTreeNode.GetParamsAttributes(self, path = path)
+ def GetParamsAttributes(self, path=None):
+ infos = ConfigTreeNode.GetParamsAttributes(self, path=path)
for element in infos:
if element["name"] == "CanFestivalInstance":
for child in element["children"]:
--- a/canfestival/config_utils.py Tue Aug 15 17:01:51 2017 +0300
+++ b/canfestival/config_utils.py Tue Aug 15 22:38:43 2017 +0300
@@ -84,7 +84,7 @@
return "".join([chr(int(car, 16)) for car in list_car])
-def GetNodePDOIndexes(node, type, parameters = False):
+def GetNodePDOIndexes(node, type, parameters=False):
"""
Find the PDO indexes of a node
@param node: node
@@ -367,7 +367,7 @@
# Check Id is in slave node list
if nodeid not in self.NodeList.SlaveNodes.keys():
- raise PDOmappingException, _("Non existing node ID : {a1} (variable {a2})").format(a1 = nodeid, a2 = name)
+ raise PDOmappingException, _("Non existing node ID : {a1} (variable {a2})").format(a1=nodeid, a2=name)
# Get the model for this node (made from EDS)
node = self.NodeList.SlaveNodes[nodeid]["Node"]
@@ -375,7 +375,7 @@
# Extract and check index and subindex
if not node.IsEntry(index, subindex):
msg = _("No such index/subindex ({a1},{a2}) in ID : {a3} (variable {a4})").\
- format(a1 = "%x" % index, a2 ="%x" % subindex, a3 = nodeid, a4 = name)
+ format(a1="%x" % index, a2="%x" % subindex, a3=nodeid, a4=name)
raise PDOmappingException, msg
# Get the entry info
@@ -387,14 +387,14 @@
numbit = loc[3]
elif sizelocation != "X" and len(loc) > 3:
msg = _("Cannot set bit offset for non bool '{a1}' variable (ID:{a2},Idx:{a3},sIdx:{a4}))").\
- format(a1 = name, a2 = nodeid, a3 = "%x" % index, a4 = "%x" % subindex)
+ format(a1=name, a2=nodeid, a3="%x" % index, a4="%x" % subindex)
raise PDOmappingException, msg
else:
numbit = None
if location["IEC_TYPE"] != "BOOL" and subentry_infos["type"] != COlocationtype:
raise PDOmappingException, _("Invalid type \"{a1}\"-> {a2} != {a3} for location \"{a4}\"").\
- format(a1 = location["IEC_TYPE"], a2 = COlocationtype, a3 = subentry_infos["type"], a4 = name)
+ format(a1=location["IEC_TYPE"], a2=COlocationtype, a3=subentry_infos["type"], a4=name)
typeinfos = node.GetEntryInfos(COlocationtype)
self.IECLocations[name] = {
@@ -409,7 +409,7 @@
}
else:
raise PDOmappingException, _("Not PDO mappable variable : '{a1}' (ID:{a2},Idx:{a3},sIdx:{a4}))").\
- format(a1 = name, a2 = nodeid, a3 = "%x" % index, a4 = "%x" % subindex)
+ format(a1=name, a2=nodeid, a3="%x" % index, a4="%x" % subindex)
#-------------------------------------------------------------------------------
# Search for locations already mapped
@@ -602,8 +602,8 @@
self.Manager.AddSubentriesToCurrent(mapvariableidx, 1, self.MasterNode)
nbsubentries += 1
# Add informations to the new subentry created
- self.MasterNode.SetMappingEntry(mapvariableidx, nbsubentries, values = {"name": subindexname})
- self.MasterNode.SetMappingEntry(mapvariableidx, nbsubentries, values = {"type": typeidx})
+ self.MasterNode.SetMappingEntry(mapvariableidx, nbsubentries, values={"name": subindexname})
+ self.MasterNode.SetMappingEntry(mapvariableidx, nbsubentries, values={"type": typeidx})
# Set value of the PDO mapping
typeinfos = self.Manager.GetEntryInfos(typeidx)
@@ -661,13 +661,13 @@
# Extract and check index and subindex
if not slave.IsEntry(index, subindex):
raise PDOmappingException, _("No such index/subindex ({a1},{a2}) (variable {a3})").\
- format(a1 = "%x" % index, a2 = "%x" % subindex, a3 = name)
+ format(a1="%x" % index, a2="%x" % subindex, a3=name)
# Get the entry info
subentry_infos = slave.GetSubentryInfos(index, subindex)
if subentry_infos["type"] != COlocationtype:
raise PDOmappingException, _("Invalid type \"{a1}\"-> {a2} != {a3} for location \"{a4}\"").\
- format( a1 = location["IEC_TYPE"], a2 = COlocationtype, a3 = subentry_infos["type"], a4 = name)
+ format( a1=location["IEC_TYPE"], a2=COlocationtype, a3=subentry_infos["type"], a4=name)
IECLocations[name] = COlocationtype
pointers[(index, subindex)] = name
--- a/connectors/PYRO/__init__.py Tue Aug 15 17:01:51 2017 +0300
+++ b/connectors/PYRO/__init__.py Tue Aug 15 22:38:43 2017 +0300
@@ -88,7 +88,7 @@
ip = str(socket.inet_ntoa(i.getAddress()))
port = str(i.getPort())
newlocation = ip + ':' + port
- confnodesroot.logger.write(_("'{a1}' is located at {a2}\n").format(a1 = location, a2 = newlocation))
+ confnodesroot.logger.write(_("'{a1}' is located at {a2}\n").format(a1=location, a2=newlocation))
location = newlocation
r.close()
except Exception, msg:
--- a/connectors/WAMP/__init__.py Tue Aug 15 17:01:51 2017 +0300
+++ b/connectors/WAMP/__init__.py Tue Aug 15 22:38:43 2017 +0300
@@ -76,19 +76,19 @@
# create a WAMP application session factory
component_config = types.ComponentConfig(
- realm = realm,
- extra = {"ID": ID})
+ realm=realm,
+ extra={"ID": ID})
session_factory = wamp.ApplicationSessionFactory(
- config = component_config)
+ config=component_config)
session_factory.session = WampSession
# create a WAMP-over-WebSocket transport client factory
transport_factory = WampWebSocketClientFactory(
session_factory,
- url = url,
- serializers = [MsgPackSerializer()],
- debug = False,
- debug_wamp = False)
+ url=url,
+ serializers=[MsgPackSerializer()],
+ debug=False,
+ debug_wamp=False)
# start the client from a Twisted endpoint
conn = connectWS(transport_factory)
--- a/controls/CustomToolTip.py Tue Aug 15 17:01:51 2017 +0300
+++ b/controls/CustomToolTip.py Tue Aug 15 22:38:43 2017 +0300
@@ -61,7 +61,7 @@
wx.SWISS,
wx.NORMAL,
wx.NORMAL,
- faceName = faces["mono"])
+ faceName=faces["mono"])
self.Bind(wx.EVT_PAINT, self.OnPaint)
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Tue Aug 15 17:01:51 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Tue Aug 15 22:38:43 2017 +0300
@@ -1092,8 +1092,8 @@
# Update position of figure (keeping up and bottom border the same
# size)
self.Figure.subplotpars.update(
- top= 1.0 - CANVAS_BORDER[1] * canvas_ratio,
- bottom= CANVAS_BORDER[0] * canvas_ratio)
+ top=1.0 - CANVAS_BORDER[1] * canvas_ratio,
+ bottom=CANVAS_BORDER[0] * canvas_ratio)
# Update position of items labels
if self.GraphType == GRAPH_PARALLEL or self.Is3DCanvas():
@@ -1296,7 +1296,7 @@
# Add plot to canvas
self.Axes.plot(x_data[:, 1][:length],
y_data[:, 1][:length],
- zs = z_data[:, 1][:length])
+ zs=z_data[:, 1][:length])
# Display cursor in canvas if a cursor tick is defined and
# it is include in values tick range
--- a/controls/DebugVariablePanel/DebugVariablePanel.py Tue Aug 15 17:01:51 2017 +0300
+++ b/controls/DebugVariablePanel/DebugVariablePanel.py Tue Aug 15 22:38:43 2017 +0300
@@ -749,7 +749,7 @@
def GetVariableNameMask(self):
return self.VariableNameMask
- def InsertValue(self, iec_path, idx = None, force=False, graph=False):
+ def InsertValue(self, iec_path, idx=None, force=False, graph=False):
for panel in self.GraphicPanels:
if panel.GetItem(iec_path) is not None:
if graph and isinstance(panel, DebugVariableTextViewer):
@@ -777,7 +777,7 @@
self.Thaw()
self.ForceRefresh()
- def MoveValue(self, iec_path, idx = None, graph=False):
+ def MoveValue(self, iec_path, idx=None, graph=False):
if idx is None:
idx = len(self.GraphicPanels)
source_panel = None
--- a/controls/EnhancedStatusBar.py Tue Aug 15 17:01:51 2017 +0300
+++ b/controls/EnhancedStatusBar.py Tue Aug 15 22:38:43 2017 +0300
@@ -195,7 +195,7 @@
event.Skip()
def AddWidget(self, widget, horizontalalignment=ESB_ALIGN_CENTER_HORIZONTAL,
- verticalalignment=ESB_ALIGN_CENTER_VERTICAL, pos = -1):
+ verticalalignment=ESB_ALIGN_CENTER_VERTICAL, pos=-1):
"""Add A Widget To The EnhancedStatusBar.
Parameters:
--- a/controls/LibraryPanel.py Tue Aug 15 17:01:51 2017 +0300
+++ b/controls/LibraryPanel.py Tue Aug 15 22:38:43 2017 +0300
@@ -319,7 +319,7 @@
self.Tree.SelectItem(item)
self.Tree.EnsureVisible(item)
- def FindTreeItem(self, item, name, inputs = None):
+ def FindTreeItem(self, item, name, inputs=None):
"""
Find Tree item corresponding to block informations given
Function is recursive
--- a/controls/SearchResultPanel.py Tue Aug 15 17:01:51 2017 +0300
+++ b/controls/SearchResultPanel.py Tue Aug 15 22:38:43 2017 +0300
@@ -53,7 +53,7 @@
class SearchResultPanel(wx.Panel):
if wx.VERSION < (2, 6, 0):
- def Bind(self, event, function, id = None):
+ def Bind(self, event, function, id=None):
if id is not None:
event(self, id, function)
else:
@@ -242,7 +242,7 @@
else:
header_format = _("'{a1}' - {a2} matches in project")
- self.HeaderLabel.SetLabel(header_format.format(a1 = self.Criteria["find_pattern"], a2 = matches_number))
+ self.HeaderLabel.SetLabel(header_format.format(a1=self.Criteria["find_pattern"], a2=matches_number))
self.ResetButton.Enable(True)
if matches_number > 0:
--- a/controls/VariablePanel.py Tue Aug 15 17:01:51 2017 +0300
+++ b/controls/VariablePanel.py Tue Aug 15 22:38:43 2017 +0300
@@ -175,9 +175,9 @@
grid.SetReadOnly(row, col, True)
else:
if colname == "Option":
- options = GetOptions(constant = var_class in ["Local", "External", "Global"],
- retain = self.Parent.ElementType != "function" and var_class in ["Local", "Input", "Output", "Global"],
- non_retain = self.Parent.ElementType != "function" and var_class in ["Local", "Input", "Output"])
+ options = GetOptions(constant=var_class in ["Local", "External", "Global"],
+ retain=self.Parent.ElementType != "function" and var_class in ["Local", "Input", "Output", "Global"],
+ non_retain=self.Parent.ElementType != "function" and var_class in ["Local", "Input", "Output"])
if len(options) > 1:
editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(",".join(map(_, options)))
@@ -279,7 +279,7 @@
base_location_type = self.ParentWindow.Controler.GetBaseType(values[2])
if values[2] != variable_type and base_type != base_location_type:
message = _("Incompatible data types between \"{a1}\" and \"{a2}\"").\
- format(a1 = values[2], a2 = variable_type)
+ format(a1=values[2], a2=variable_type)
if message is None:
if not location.startswith("%"):
@@ -289,7 +289,7 @@
message = _("Unrecognized data size \"%s\"") % location[0]
elif base_type not in LOCATIONDATATYPES[location[0]]:
message = _("Incompatible size of data between \"{a1}\" and \"{a2}\"").\
- format(a1 = location, a2 = variable_type)
+ format(a1=location, a2=variable_type)
else:
dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow,
_("Select a variable class:"), _("Variable class"),
@@ -598,7 +598,7 @@
new_row = self.Table.GetNumberRows()
self.SaveValues()
if self.ElementType == "resource":
- self.ParentWindow.RefreshView(variablepanel = False)
+ self.ParentWindow.RefreshView(variablepanel=False)
self.RefreshValues()
return new_row
setattr(self.VariablesGrid, "_AddRow", _AddVariable)
@@ -608,7 +608,7 @@
self.Values.remove(self.Table.GetRow(row))
self.SaveValues()
if self.ElementType == "resource":
- self.ParentWindow.RefreshView(variablepanel = False)
+ self.ParentWindow.RefreshView(variablepanel=False)
self.RefreshValues()
setattr(self.VariablesGrid, "_DeleteRow", _DeleteVariable)
@@ -731,7 +731,7 @@
words = self.TagName.split("::")
self.Controler.SetPouInterfaceReturnType(words[1], self.ReturnType.GetStringSelection())
self.Controler.BufferProject()
- self.ParentWindow.RefreshView(variablepanel = False)
+ self.ParentWindow.RefreshView(variablepanel=False)
self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
event.Skip()
@@ -824,7 +824,7 @@
def BuildUserTypesMenu(self, type_menu):
# build a submenu containing user-defined types
datatype_menu = wx.Menu(title='')
- datatypes = self.Controler.GetDataTypes(basetypes = False, confnodetypes = False)
+ datatypes = self.Controler.GetDataTypes(basetypes=False, confnodetypes=False)
for datatype in datatypes:
new_id = wx.NewId()
datatype_menu.Append(help='', id=new_id, kind=wx.ITEM_NORMAL, text=datatype)
@@ -903,7 +903,7 @@
self.Table.SetValueByName(row, "Type", base_type)
self.Table.ResetView(self.VariablesGrid)
self.SaveValues(False)
- self.ParentWindow.RefreshView(variablepanel = False)
+ self.ParentWindow.RefreshView(variablepanel=False)
self.Controler.BufferProject()
self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
return VariableTypeFunction
@@ -917,7 +917,7 @@
self.Table.SetValueByName(row, "Type", dialog.GetValue())
self.Table.ResetView(self.VariablesGrid)
self.SaveValues(False)
- self.ParentWindow.RefreshView(variablepanel = False)
+ self.ParentWindow.RefreshView(variablepanel=False)
self.Controler.BufferProject()
self.ParentWindow._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
dialog.Destroy()
@@ -943,7 +943,7 @@
self.Table.SetData(data)
self.Table.ResetView(self.VariablesGrid)
- def SaveValues(self, buffer = True):
+ def SaveValues(self, buffer=True):
words = self.TagName.split("::")
if self.ElementType == "config":
self.Controler.SetConfigurationGlobalVars(words[1], self.Values)
--- a/dialogs/FBDBlockDialog.py Tue Aug 15 17:01:51 2017 +0300
+++ b/dialogs/FBDBlockDialog.py Tue Aug 15 22:38:43 2017 +0300
@@ -344,10 +344,10 @@
(self.BlockName.GetValue()
if self.BlockName.IsEnabled()
else ""),
- extension = self.Inputs.GetValue(),
- inputs = values["inputs"],
- executionControl = self.ExecutionControl.GetValue(),
- executionOrder = self.ExecutionOrder.GetValue())
+ extension=self.Inputs.GetValue(),
+ inputs=values["inputs"],
+ executionControl=self.ExecutionControl.GetValue(),
+ executionOrder=self.ExecutionOrder.GetValue())
# Reset graphic element displayed
else:
--- a/dialogs/FBDVariableDialog.py Tue Aug 15 17:01:51 2017 +0300
+++ b/dialogs/FBDVariableDialog.py Tue Aug 15 22:38:43 2017 +0300
@@ -290,7 +290,7 @@
self.Class.GetStringSelection()],
name,
self.VariableList.get(name, ("", ""))[1],
- executionOrder = self.ExecutionOrder.GetValue())
+ executionOrder=self.ExecutionOrder.GetValue())
# Call BlockPreviewDialog function
BlockPreviewDialog.RefreshPreview(self)
--- a/dialogs/FindInPouDialog.py Tue Aug 15 17:01:51 2017 +0300
+++ b/dialogs/FindInPouDialog.py Tue Aug 15 22:38:43 2017 +0300
@@ -113,7 +113,7 @@
# set the longest message here, to use it length to calculate
# optimal size of dialog window
self.RegExpSyntaxErrMsg = _("Syntax error in regular expression of pattern to search!")
- self.StatusLabel = wx.StaticText(panel, label= self.RegExpSyntaxErrMsg)
+ self.StatusLabel = wx.StaticText(panel, label=self.RegExpSyntaxErrMsg)
controls_sizer.AddWindow(self.StatusLabel, flag=wx.ALIGN_CENTER_VERTICAL)
panel.SetSizer(main_sizer)
--- a/dialogs/ForceVariableDialog.py Tue Aug 15 17:01:51 2017 +0300
+++ b/dialogs/ForceVariableDialog.py Tue Aug 15 22:38:43 2017 +0300
@@ -166,9 +166,9 @@
class ForceVariableDialog(wx.TextEntryDialog):
def __init__(self, parent, iec_type, defaultValue=""):
- wx.TextEntryDialog.__init__(self, parent, message = _("Forcing Variable Value"),
- caption = _("Please enter value for a \"%s\" variable:") % iec_type, defaultValue = defaultValue,
- style = wx.OK|wx.CANCEL|wx.CENTRE, pos = wx.DefaultPosition)
+ wx.TextEntryDialog.__init__(self, parent, message=_("Forcing Variable Value"),
+ caption=_("Please enter value for a \"%s\" variable:") % iec_type, defaultValue=defaultValue,
+ style=wx.OK|wx.CANCEL|wx.CENTRE, pos=wx.DefaultPosition)
self.IEC_Type = iec_type
@@ -199,7 +199,7 @@
if value == "":
message = _("You must type a value!")
elif GetTypeValue[self.IEC_Type](value) is None:
- message = _("Invalid value \"{a1}\" for \"{a2}\" variable!").format(a1 = value, a2 = self.IEC_Type)
+ message = _("Invalid value \"{a1}\" for \"{a2}\" variable!").format(a1=value, a2=self.IEC_Type)
if message is not None:
dialog = wx.MessageDialog(self, message, _("Error"), wx.OK|wx.ICON_ERROR)
dialog.ShowModal()
--- a/dialogs/LDPowerRailDialog.py Tue Aug 15 17:01:51 2017 +0300
+++ b/dialogs/LDPowerRailDialog.py Tue Aug 15 22:38:43 2017 +0300
@@ -161,7 +161,7 @@
# Set graphic element displayed, creating a power rail element
self.Element = LD_PowerRail(self.Preview,
self.GetPowerRailType(),
- connectors = self.PinNumber.GetValue())
+ connectors=self.PinNumber.GetValue())
# Call BlockPreviewDialog function
BlockPreviewDialog.RefreshPreview(self)
--- a/dialogs/PouNameDialog.py Tue Aug 15 17:01:51 2017 +0300
+++ b/dialogs/PouNameDialog.py Tue Aug 15 22:38:43 2017 +0300
@@ -31,8 +31,8 @@
class PouNameDialog(wx.TextEntryDialog):
- def __init__(self, parent, message, caption = "Please enter text", defaultValue = "",
- style = wx.OK|wx.CANCEL|wx.CENTRE, pos = wx.DefaultPosition):
+ def __init__(self, parent, message, caption="Please enter text", defaultValue="",
+ style=wx.OK|wx.CANCEL|wx.CENTRE, pos=wx.DefaultPosition):
wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos)
self.PouNames = []
--- a/dialogs/SFCDivergenceDialog.py Tue Aug 15 17:01:51 2017 +0300
+++ b/dialogs/SFCDivergenceDialog.py Tue Aug 15 22:38:43 2017 +0300
@@ -41,7 +41,7 @@
divergence graphic element
"""
- def __init__(self, parent, controller, tagname, poss_div_types = None):
+ def __init__(self, parent, controller, tagname, poss_div_types=None):
"""
Constructor
@param parent: Parent wx.Window of dialog for modal
--- a/dialogs/SFCStepNameDialog.py Tue Aug 15 17:01:51 2017 +0300
+++ b/dialogs/SFCStepNameDialog.py Tue Aug 15 22:38:43 2017 +0300
@@ -31,8 +31,8 @@
class SFCStepNameDialog(wx.TextEntryDialog):
- def __init__(self, parent, message, caption = "Please enter text", defaultValue = "",
- style = wx.OK|wx.CANCEL|wx.CENTRE, pos = wx.DefaultPosition):
+ def __init__(self, parent, message, caption="Please enter text", defaultValue="",
+ style=wx.OK|wx.CANCEL|wx.CENTRE, pos=wx.DefaultPosition):
wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos)
self.PouNames = []
--- a/docutil/docpdf.py Tue Aug 15 17:01:51 2017 +0300
+++ b/docutil/docpdf.py Tue Aug 15 22:38:43 2017 +0300
@@ -47,14 +47,14 @@
return None
-def open_win_pdf(readerexepath, pdffile, pagenum = None):
+def open_win_pdf(readerexepath, pdffile, pagenum=None):
if pagenum is not None:
os.spawnl(os.P_DETACH, readerexepath, "AcroRd32.exe", "/A", "page=%d=OpenActions" % pagenum, '"%s"' % pdffile)
else:
os.spawnl(os.P_DETACH, readerexepath, "AcroRd32.exe", '"%s"' % pdffile)
-def open_lin_pdf(readerexepath, pdffile, pagenum = None):
+def open_lin_pdf(readerexepath, pdffile, pagenum=None):
if pagenum is None:
os.system("%s -remote DS301 %s &" % (readerexepath, pdffile))
else:
@@ -62,7 +62,7 @@
os.system("%s -remote DS301 %s %d &" % (readerexepath, pdffile, pagenum))
-def open_pdf(pdffile, pagenum = None):
+def open_pdf(pdffile, pagenum=None):
if wx.Platform == '__WXMSW__':
try:
readerpath = get_acroversion()
--- a/editors/ConfTreeNodeEditor.py Tue Aug 15 17:01:51 2017 +0300
+++ b/editors/ConfTreeNodeEditor.py Tue Aug 15 22:38:43 2017 +0300
@@ -111,9 +111,9 @@
""" Customized GenStaticBitmap, fix transparency redraw bug on wx2.8/win32,
and accept image name as __init__ parameter, fail silently if file do not exist"""
def __init__(self, parent, ID, bitmapname,
- pos = wx.DefaultPosition, size = wx.DefaultSize,
- style = 0,
- name = "genstatbmp"):
+ pos=wx.DefaultPosition, size=wx.DefaultSize,
+ style=0,
+ name="genstatbmp"):
bitmap = GetBitmap(bitmapname)
if bitmap is None:
@@ -151,7 +151,7 @@
self.FullIECChannel = wx.StaticText(self.Editor, -1)
self.FullIECChannel.SetFont(
wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL,
- wx.BOLD, faceName = faces["helv"]))
+ wx.BOLD, faceName=faces["helv"]))
baseparamseditor_sizer.AddWindow(self.FullIECChannel,
flag=wx.ALIGN_CENTER_VERTICAL)
@@ -175,7 +175,7 @@
size=wx.Size(150, 25))
self.ConfNodeName.SetFont(
wx.Font(faces["size"] * 0.75, wx.DEFAULT, wx.NORMAL,
- wx.BOLD, faceName = faces["helv"]))
+ wx.BOLD, faceName=faces["helv"]))
self.ConfNodeName.Bind(wx.EVT_TEXT,
self.GetTextCtrlCallBackFunction(self.ConfNodeName, "BaseParams.Name", True),
self.ConfNodeName)
@@ -296,8 +296,8 @@
self.Thaw()
def GenerateMethodButtonSizer(self):
- 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)
+ 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)
@@ -327,7 +327,7 @@
msizer.AddWindow(button, flag=wx.ALIGN_CENTER)
return msizer
- def GenerateSizerElements(self, sizer, elements, path, clean = True):
+ def GenerateSizerElements(self, sizer, elements, path, clean=True):
if clean:
sizer.Clear(True)
first = True
--- a/editors/LDViewer.py Tue Aug 15 17:01:51 2017 +0300
+++ b/editors/LDViewer.py Tue Aug 15 22:38:43 2017 +0300
@@ -170,7 +170,7 @@
Class derived from Viewer class that implements a Viewer of Ladder Diagram
"""
- def __init__(self, parent, tagname, window, controler, debug = False, instancepath = ""):
+ def __init__(self, parent, tagname, window, controler, debug=False, instancepath=""):
Viewer.__init__(self, parent, tagname, window, controler, debug, instancepath)
self.Rungs = []
self.RungComments = []
@@ -262,7 +262,7 @@
return i
return None
- def FindElement(self, event, exclude_group = False, connectors = True):
+ def FindElement(self, event, exclude_group=False, connectors=True):
if self.GetDrawingMode() == FREEDRAWING_MODE:
return Viewer.FindElement(self, event, exclude_group, connectors)
--- a/editors/SFCViewer.py Tue Aug 15 17:01:51 2017 +0300
+++ b/editors/SFCViewer.py Tue Aug 15 22:38:43 2017 +0300
@@ -82,7 +82,7 @@
"LD_Coil": [("SFC_Transition", WEST)]
}
- def __init__(self, parent, tagname, window, controler, debug = False, instancepath = ""):
+ def __init__(self, parent, tagname, window, controler, debug=False, instancepath=""):
Viewer.__init__(self, parent, tagname, window, controler, debug, instancepath)
self.CurrentLanguage = "SFC"
@@ -97,7 +97,7 @@
wire.ConnectEndPoint(None, end)
return wire
- def CreateTransition(self, connector, next = None):
+ def CreateTransition(self, connector, next=None):
previous = connector.GetParentBlock()
id = self.GetNewId()
transition = SFC_Transition(self, "reference", "", 0, id)
@@ -147,7 +147,7 @@
wire = self.ConnectConnectors(next, previous)
return wire
- def CreateStep(self, name, connector, next = None):
+ def CreateStep(self, name, connector, next=None):
previous = connector.GetParentBlock()
id = self.GetNewId()
step = SFC_Step(self, name, False, id)
@@ -341,7 +341,7 @@
return blockName
# This method check the IEC 61131-3 compatibility between two SFC blocks
- def BlockCompatibility(self, startblock = None, endblock = None, direction = None):
+ def BlockCompatibility(self, startblock=None, endblock=None, direction=None):
if startblock is not None and endblock is not None and (isinstance(startblock, SFC_Objects)\
or isinstance(endblock, SFC_Objects)):
# Full "SFC_StandardRules" table would be symmetrical and
--- a/editors/TextViewer.py Tue Aug 15 17:01:51 2017 +0300
+++ b/editors/TextViewer.py Tue Aug 15 22:38:43 2017 +0300
@@ -77,7 +77,7 @@
ID = ID_TEXTVIEWER
if wx.VERSION < (2, 6, 0):
- def Bind(self, event, function, id = None):
+ def Bind(self, event, function, id=None):
if id is not None:
event(self, id, function)
else:
@@ -151,7 +151,7 @@
self.Bind(wx.stc.EVT_STC_DO_DROP, self.OnDoDrop, id=ID_TEXTVIEWERTEXTCTRL)
self.Bind(wx.stc.EVT_STC_MODIFIED, self.OnModification, id=ID_TEXTVIEWERTEXTCTRL)
- def __init__(self, parent, tagname, window, controler, debug = False, instancepath = ""):
+ def __init__(self, parent, tagname, window, controler, debug=False, instancepath=""):
if tagname != "" and controler is not None:
self.VARIABLE_PANEL_TYPE = controler.GetPouType(tagname.split("::")[1])
--- a/editors/Viewer.py Tue Aug 15 17:01:51 2017 +0300
+++ b/editors/Viewer.py Tue Aug 15 22:38:43 2017 +0300
@@ -262,7 +262,7 @@
elif pou_type == "function" and values[1] != "function":
message = _("Function Blocks can't be used in Functions!")
elif self.ParentWindow.Controler.PouIsUsedBy(pou_name, values[0], self.ParentWindow.Debug):
- message = _("\"{a1}\" is already used by \"{a2}\"!").format(a1 = pou_name, a2 = values[0])
+ message = _("\"{a1}\" is already used by \"{a2}\"!").format(a1=pou_name, a2=values[0])
else:
blockname = values[2]
if len(values) > 3:
@@ -277,7 +277,7 @@
message = _("\"%s\" element for this pou already exists!") % blockname
else:
id = self.ParentWindow.GetNewId()
- block = FBD_Block(self.ParentWindow, values[0], blockname, id, inputs = blockinputs)
+ block = FBD_Block(self.ParentWindow, values[0], blockname, id, inputs=blockinputs)
width, height = block.GetMinSize()
if scaling is not None:
x = round(float(x) / float(scaling[0])) * scaling[0]
@@ -504,7 +504,7 @@
"""
if wx.VERSION < (2, 6, 0):
- def Bind(self, event, function, id = None):
+ def Bind(self, event, function, id=None):
if id is not None:
event(self, id, function)
else:
@@ -680,7 +680,7 @@
self.Editor.ParentWindow = self
# Create a new Viewer
- def __init__(self, parent, tagname, window, controler, debug = False, instancepath = ""):
+ def __init__(self, parent, tagname, window, controler, debug=False, instancepath=""):
self.VARIABLE_PANEL_TYPE = controler.GetPouType(tagname.split("::")[1])
EditorPanel.__init__(self, parent, tagname, window, controler, debug)
@@ -735,17 +735,17 @@
self.ElementRefreshList_lock = Lock()
dc = wx.ClientDC(self.Editor)
- font = wx.Font(faces["size"], wx.SWISS, wx.NORMAL, wx.NORMAL, faceName = faces["mono"])
+ font = wx.Font(faces["size"], wx.SWISS, wx.NORMAL, wx.NORMAL, faceName=faces["mono"])
dc.SetFont(font)
width, height = dc.GetTextExtent("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
while width > 260:
faces["size"] -= 1
- font = wx.Font(faces["size"], wx.SWISS, wx.NORMAL, wx.NORMAL, faceName = faces["mono"])
+ font = wx.Font(faces["size"], wx.SWISS, wx.NORMAL, wx.NORMAL, faceName=faces["mono"])
dc.SetFont(font)
width, height = dc.GetTextExtent("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
self.SetFont(font)
self.MiniTextDC = wx.MemoryDC()
- self.MiniTextDC.SetFont(wx.Font(faces["size"] * 0.75, wx.SWISS, wx.NORMAL, wx.NORMAL, faceName = faces["helv"]))
+ self.MiniTextDC.SetFont(wx.Font(faces["size"] * 0.75, wx.SWISS, wx.NORMAL, wx.NORMAL, faceName=faces["helv"]))
self.CurrentScale = None
self.SetScale(ZOOM_FACTORS.index(1.0), False)
@@ -977,7 +977,7 @@
return block
return None
- def RefreshVisibleElements(self, xp = None, yp = None):
+ def RefreshVisibleElements(self, xp=None, yp=None):
x, y = self.Editor.CalcUnscrolledPosition(0, 0)
if xp is not None:
x = xp * self.Editor.GetScrollPixelsPerUnit()[0]
@@ -1220,7 +1220,7 @@
self.ResetBuffer()
instance = {}
# List of ids of already loaded blocks
- instances = self.Controler.GetEditedElementInstancesInfos(self.TagName, debug = self.Debug)
+ instances = self.Controler.GetEditedElementInstancesInfos(self.TagName, debug=self.Debug)
# Load Blocks until they are all loaded
while len(instances) > 0:
self.loadInstance(instances.popitem(0)[1], instances, selection)
@@ -1411,7 +1411,7 @@
connector_pos = wx.Point(*output_connector.position)
if isinstance(element, FBD_Block):
connector = element.GetConnector(connector_pos,
- output_name = output_connector.name)
+ output_name=output_connector.name)
elif i < len(connectors["outputs"]):
connector = connectors["outputs"][i]
else:
@@ -1427,7 +1427,7 @@
connector_pos = wx.Point(*input_connector.position)
if isinstance(element, FBD_Block):
connector = element.GetConnector(connector_pos,
- input_name = input_connector.name)
+ input_name=input_connector.name)
elif i < len(connectors["inputs"]):
connector = connectors["inputs"][i]
else:
@@ -1499,7 +1499,7 @@
def IsEndType(self, type):
return self.Controler.IsEndType(type)
- def GetBlockType(self, type, inputs = None):
+ def GetBlockType(self, type, inputs=None):
return self.Controler.GetBlockType(type, inputs, self.Debug)
#-------------------------------------------------------------------------------
@@ -1522,7 +1522,7 @@
return wire
return None
- def FindElement(self, event, exclude_group = False, connectors = True):
+ def FindElement(self, event, exclude_group=False, connectors=True):
dc = self.GetLogicalDC()
pos = event.GetLogicalPosition(dc)
if self.SelectedElement and not (exclude_group and isinstance(self.SelectedElement, Graphic_Group)):
@@ -1533,11 +1533,11 @@
return element
return None
- def FindBlockConnector(self, pos, direction = None, exclude = None):
+ def FindBlockConnector(self, pos, direction=None, exclude=None):
result, error = self.FindBlockConnectorWithError(pos, direction, exclude)
return result
- def FindBlockConnectorWithError(self, pos, direction = None, exclude = None):
+ def FindBlockConnectorWithError(self, pos, direction=None, exclude=None):
error = False
startblock = None
for block in self.Blocks.itervalues():
@@ -1623,7 +1623,7 @@
self.Editor.PopupMenu(menu)
menu.Destroy()
- def PopupBlockMenu(self, connector = None):
+ def PopupBlockMenu(self, connector=None):
menu = wx.Menu(title='')
if connector is not None and connector.IsCompatible("BOOL"):
self.AddBlockPinMenuItems(menu, connector)
@@ -2383,11 +2383,11 @@
elif position.y > window_size[1] - SCROLL_ZONE:
move_window.y = 1
if move_window.x != 0 or move_window.y != 0:
- self.RefreshVisibleElements(xp = xstart + move_window.x, yp = ystart + move_window.y)
+ self.RefreshVisibleElements(xp=xstart + move_window.x, yp=ystart + move_window.y)
self.Scroll(xstart + move_window.x, ystart + move_window.y)
self.RefreshScrollBars(move_window.x, move_window.y)
- def BlockCompatibility(self, startblock=None, endblock=None, direction = None):
+ def BlockCompatibility(self, startblock=None, endblock=None, direction=None):
return True
def GetPopupMenuItems(self):
@@ -2585,8 +2585,8 @@
values.setdefault("name", "")
block = FBD_Block(self, values["type"], values["name"], id,
values["extension"], values["inputs"],
- executionControl = values["executionControl"],
- executionOrder = values["executionOrder"])
+ executionControl=values["executionControl"],
+ executionOrder=values["executionOrder"])
self.Controler.AddEditedElementBlock(self.TagName, id, values["type"], values.get("name", None))
connector = None
if wire is not None:
@@ -2748,7 +2748,7 @@
connector = transition.GetConnectors()["inputs"][0]
self.AddNewElement(transition, bbox, wire, connector)
- def AddNewDivergence(self, bbox, poss_div_types = None, wire=None):
+ def AddNewDivergence(self, bbox, poss_div_types=None, wire=None):
dialog = SFCDivergenceDialog(self.ParentWindow, self.Controler, self.TagName, poss_div_types)
dialog.SetPreviewFont(self.GetFont())
dialog.SetMinElementSize((bbox.width, bbox.height))
@@ -2812,7 +2812,7 @@
else:
block.SetName("")
block.SetSize(*self.GetScaledSize(new_values["width"], new_values["height"]))
- block.SetType(new_values["type"], new_values["extension"], executionControl = new_values["executionControl"])
+ block.SetType(new_values["type"], new_values["extension"], executionControl=new_values["executionControl"])
block.SetExecutionOrder(new_values["executionOrder"])
rect = rect.Union(block.GetRedrawRect())
self.RefreshBlockModel(block)
@@ -3622,9 +3622,9 @@
self.Editor.Freeze()
wx.CallAfter(self.Editor.Thaw)
elif event.GetOrientation() == wx.HORIZONTAL:
- self.RefreshVisibleElements(xp = event.GetPosition())
+ self.RefreshVisibleElements(xp=event.GetPosition())
else:
- self.RefreshVisibleElements(yp = event.GetPosition())
+ self.RefreshVisibleElements(yp=event.GetPosition())
# Handle scroll in debug to fully redraw area and ensuring
# instance path is fully draw without flickering
@@ -3647,16 +3647,16 @@
if event.ShiftDown():
x, y = self.GetViewStart()
xp = max(0, min(x - rotation * 3, self.Editor.GetVirtualSize()[0] / self.Editor.GetScrollPixelsPerUnit()[0]))
- self.RefreshVisibleElements(xp = xp)
+ self.RefreshVisibleElements(xp=xp)
self.Scroll(xp, y)
elif event.ControlDown():
dc = self.GetLogicalDC()
- self.SetScale(self.CurrentScale + rotation, mouse_event = event)
+ self.SetScale(self.CurrentScale + rotation, mouse_event=event)
self.ParentWindow.RefreshDisplayMenu()
else:
x, y = self.GetViewStart()
yp = max(0, min(y - rotation * 3, self.Editor.GetVirtualSize()[1] / self.Editor.GetScrollPixelsPerUnit()[1]))
- self.RefreshVisibleElements(yp = yp)
+ self.RefreshVisibleElements(yp=yp)
self.Scroll(x, yp)
def OnMoveWindow(self, event):
@@ -3667,7 +3667,7 @@
self.RefreshVisibleElements()
event.Skip()
- def DoDrawing(self, dc, printing = False):
+ def DoDrawing(self, dc, printing=False):
if printing:
if getattr(dc, "printing", False):
font = wx.Font(self.GetFont().GetPointSize(), wx.MODERN, wx.NORMAL, wx.NORMAL)
--- a/graphics/FBD_Objects.py Tue Aug 15 17:01:51 2017 +0300
+++ b/graphics/FBD_Objects.py Tue Aug 15 22:38:43 2017 +0300
@@ -42,7 +42,7 @@
"""
# Create a new block
- def __init__(self, parent, type, name, id = None, extension = 0, inputs = None, connectors = {}, executionControl = False, executionOrder = 0):
+ def __init__(self, parent, type, name, id=None, extension=0, inputs=None, connectors={}, executionControl=False, executionOrder=0):
Graphic_Element.__init__(self, parent)
self.Type = None
self.Description = None
@@ -59,7 +59,7 @@
self.Highlights = {}
# Make a clone of this FBD_Block
- def Clone(self, parent, id = None, name = "", pos = None):
+ def Clone(self, parent, id=None, name="", pos=None):
if self.Name != "" and name == "":
name = self.Name
block = FBD_Block(parent, self.Type, name, id, self.Extension)
@@ -84,7 +84,7 @@
self.Outputs = []
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = Graphic_Element.GetRedrawRect(self, movex, movey)
if movex != 0 or movey != 0:
for input in self.Inputs:
@@ -102,9 +102,9 @@
# Unconnect all inputs and outputs
def Clean(self):
for input in self.Inputs:
- input.UnConnect(delete = True)
+ input.UnConnect(delete=True)
for output in self.Outputs:
- output.UnConnect(delete = True)
+ output.UnConnect(delete=True)
# Refresh the size of text for name
def RefreshNameSize(self):
@@ -173,14 +173,14 @@
self.RefreshConnected()
# Refresh the positions of wires connected to inputs and outputs
- def RefreshConnected(self, exclude = []):
+ def RefreshConnected(self, exclude=[]):
for input in self.Inputs:
input.MoveConnected(exclude)
for output in self.Outputs:
output.MoveConnected(exclude)
# Returns the block connector that starts with the point given if it exists
- def GetConnector(self, position, output_name = None, input_name = None):
+ def GetConnector(self, position, output_name=None, input_name=None):
if input_name is not None:
# Test each input connector
for input in self.Inputs:
@@ -223,7 +223,7 @@
return {"inputs": self.Inputs, "outputs": self.Outputs}
# Test if point given is on one of the block connectors
- def TestConnector(self, pt, direction = None, exclude = True):
+ def TestConnector(self, pt, direction=None, exclude=True):
# Test each input connector
for input in self.Inputs:
if input.TestPoint(pt, direction, exclude):
@@ -235,7 +235,7 @@
return None
# Changes the block type
- def SetType(self, type, extension, inputs = None, connectors = {}, executionControl = False):
+ def SetType(self, type, extension, inputs=None, connectors={}, executionControl=False):
if type != self.Type or self.Extension != extension or executionControl != self.ExecutionControl:
if type != self.Type:
self.Type = type
@@ -269,7 +269,7 @@
# Extract the inputs properties and create or modify the corresponding connector
input_connectors = []
for input_name, input_type, input_modifier in inputs:
- connector = Connector(self, input_name, input_type, wx.Point(0, 0), WEST, onlyone = True)
+ connector = Connector(self, input_name, input_type, wx.Point(0, 0), WEST, onlyone=True)
if input_modifier == "negated":
connector.SetNegated(True)
elif input_modifier != "none":
@@ -283,7 +283,7 @@
break
input_connectors.append(connector)
for input in self.Inputs:
- input.UnConnect(delete = True)
+ input.UnConnect(delete=True)
self.Inputs = input_connectors
# Extract the outputs properties and create or modify the corresponding connector
@@ -303,7 +303,7 @@
break
output_connectors.append(connector)
for output in self.Outputs:
- output.UnConnect(delete = True)
+ output.UnConnect(delete=True)
self.Outputs = output_connectors
self.RefreshMinSize()
@@ -506,7 +506,7 @@
"""
# Create a new variable
- def __init__(self, parent, type, name, value_type, id = None, executionOrder = 0):
+ def __init__(self, parent, type, name, value_type, id=None, executionOrder=0):
Graphic_Element.__init__(self, parent)
self.Type = None
self.ValueType = None
@@ -519,7 +519,7 @@
self.Highlights = []
# Make a clone of this FBD_Variable
- def Clone(self, parent, id = None, pos = None):
+ def Clone(self, parent, id=None, pos=None):
variable = FBD_Variable(parent, self.Type, self.Name, self.ValueType, id)
variable.SetSize(self.Size[0], self.Size[1])
if pos is not None:
@@ -549,7 +549,7 @@
self.Output = None
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = Graphic_Element.GetRedrawRect(self, movex, movey)
if movex != 0 or movey != 0:
if self.Input and self.Input.IsConnected():
@@ -561,9 +561,9 @@
# Unconnect connector
def Clean(self):
if self.Input:
- self.Input.UnConnect(delete = True)
+ self.Input.UnConnect(delete=True)
if self.Output:
- self.Output.UnConnect(delete = True)
+ self.Output.UnConnect(delete=True)
# Delete this variable by calling the appropriate method
def Delete(self):
@@ -610,14 +610,14 @@
self.RefreshConnected()
# Refresh the position of wires connected to connector
- def RefreshConnected(self, exclude = []):
+ def RefreshConnected(self, exclude=[]):
if self.Input:
self.Input.MoveConnected(exclude)
if self.Output:
self.Output.MoveConnected(exclude)
# Test if point given is on the variable connector
- def TestConnector(self, pt, direction = None, exclude=True):
+ def TestConnector(self, pt, direction=None, exclude=True):
if self.Input and self.Input.TestPoint(pt, direction, exclude):
return self.Input
if self.Output and self.Output.TestPoint(pt, direction, exclude):
@@ -625,7 +625,7 @@
return None
# Returns the block connector that starts with the point given if it exists
- def GetConnector(self, position, name = None):
+ def GetConnector(self, position, name=None):
# if a name is given
if name is not None:
# Test input and output connector if they exists
@@ -665,15 +665,15 @@
# Create an input or output connector according to variable type
if self.Type != INPUT:
if self.Input is None:
- self.Input = Connector(self, "", value_type, wx.Point(0, 0), WEST, onlyone = True)
+ self.Input = Connector(self, "", value_type, wx.Point(0, 0), WEST, onlyone=True)
elif self.Input:
- self.Input.UnConnect(delete = True)
+ self.Input.UnConnect(delete=True)
self.Input = None
if self.Type != OUTPUT:
if self.Output is None:
self.Output = Connector(self, "", value_type, wx.Point(0, 0), EAST)
elif self.Output:
- self.Output.UnConnect(delete = True)
+ self.Output.UnConnect(delete=True)
self.Output = None
self.RefreshConnectors()
self.RefreshBoundingBox()
@@ -802,7 +802,7 @@
"""
# Create a new connection
- def __init__(self, parent, type, name, id = None):
+ def __init__(self, parent, type, name, id=None):
Graphic_Element.__init__(self, parent)
self.Type = type
self.Id = id
@@ -812,7 +812,7 @@
self.Highlights = []
# Create an input or output connector according to connection type
if self.Type == CONNECTOR:
- self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), WEST, onlyone = True)
+ self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), WEST, onlyone=True)
else:
self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), EAST)
self.RefreshConnectors()
@@ -824,7 +824,7 @@
self.Connector = None
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = Graphic_Element.GetRedrawRect(self, movex, movey)
if movex != 0 or movey != 0:
if self.Connector and self.Connector.IsConnected():
@@ -832,7 +832,7 @@
return rect
# Make a clone of this FBD_Connector
- def Clone(self, parent, id = None, pos = None):
+ def Clone(self, parent, id=None, pos=None):
connection = FBD_Connector(parent, self.Type, self.Name, id)
connection.SetSize(self.Size[0], self.Size[1])
if pos is not None:
@@ -848,7 +848,7 @@
# Unconnect connector
def Clean(self):
if self.Connector:
- self.Connector.UnConnect(delete = True)
+ self.Connector.UnConnect(delete=True)
# Delete this connection by calling the appropriate method
def Delete(self):
@@ -881,18 +881,18 @@
self.RefreshConnected()
# Refresh the position of wires connected to connector
- def RefreshConnected(self, exclude = []):
+ def RefreshConnected(self, exclude=[]):
if self.Connector:
self.Connector.MoveConnected(exclude)
# Test if point given is on the connection connector
- def TestConnector(self, pt, direction = None, exclude=True):
+ def TestConnector(self, pt, direction=None, exclude=True):
if self.Connector and self.Connector.TestPoint(pt, direction, exclude):
return self.Connector
return None
# Returns the connection connector
- def GetConnector(self, position = None, name = None):
+ def GetConnector(self, position=None, name=None):
return self.Connector
# Returns all the block connectors
@@ -919,7 +919,7 @@
self.Clean()
# Create an input or output connector according to connection type
if self.Type == CONNECTOR:
- self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), WEST, onlyone = True)
+ self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), WEST, onlyone=True)
else:
self.Connector = Connector(self, "", "ANY", wx.Point(0, 0), EAST)
self.RefreshConnectors()
--- a/graphics/GraphicCommons.py Tue Aug 15 17:01:51 2017 +0300
+++ b/graphics/GraphicCommons.py Tue Aug 15 22:38:43 2017 +0300
@@ -131,7 +131,7 @@
"""
-def vector(p1, p2, normal = True):
+def vector(p1, p2, normal=True):
"""
Create a vector from two points and define if vector must be normal
"""
@@ -258,7 +258,7 @@
"""
# Create a new graphic element
- def __init__(self, parent, id = None):
+ def __init__(self, parent, id=None):
ToolTipProducer.__init__(self, parent)
self.Parent = parent
self.Id = id
@@ -404,7 +404,7 @@
return self.BoundingBox
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
scalex, scaley = self.Parent.GetViewScale()
rect = wx.Rect()
rect.x = self.BoundingBox.x - int(HANDLE_SIZE / scalex) - 3 - abs(movex)
@@ -413,7 +413,7 @@
rect.height = self.BoundingBox.height + 2 * (int(HANDLE_SIZE / scaley) + abs(movey) + 1) + 4
return rect
- def Refresh(self, rect = None):
+ def Refresh(self, rect=None):
if self.Visible:
if rect is not None:
self.Parent.RefreshRect(self.Parent.GetScrolledRect(rect), False)
@@ -554,7 +554,7 @@
return 0, 0
# Moves the element
- def Move(self, dx, dy, exclude = []):
+ def Move(self, dx, dy, exclude=[]):
self.Pos.x += max(-self.BoundingBox.x, dx)
self.Pos.y += max(-self.BoundingBox.y, dy)
self.RefreshConnected(exclude)
@@ -566,7 +566,7 @@
self.SetSize(width, height)
# Refreshes the element state according to move defined and handle selected
- def ProcessDragging(self, movex, movey, event, scaling, width_fac = 1, height_fac = 1):
+ def ProcessDragging(self, movex, movey, event, scaling, width_fac=1, height_fac=1):
handle_type, handle = self.Handle
# If it is a resize handle, calculate the values from resizing
if handle_type == HANDLE_RESIZE:
@@ -733,7 +733,7 @@
return blocks, wires
# Make a clone of this element
- def Clone(self, parent, pos = None):
+ def Clone(self, parent, pos=None):
group = Graphic_Group(parent)
connectors = {}
exclude_names = {}
@@ -751,9 +751,9 @@
if parent.IsNamedElement(element):
name = parent.GenerateNewName(element, exclude_names)
exclude_names[name.upper()] = True
- new_element = element.Clone(parent, newid, name, pos = new_pos)
+ new_element = element.Clone(parent, newid, name, pos=new_pos)
else:
- new_element = element.Clone(parent, newid, pos = new_pos)
+ new_element = element.Clone(parent, newid, pos=new_pos)
new_element.SetBestSize(parent.Scaling)
else:
new_element = element.Clone(parent)
@@ -798,7 +798,7 @@
self.WireExcluded.append(element)
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = None
for element in self.Elements:
if rect is None:
@@ -1031,7 +1031,7 @@
"""
# Create a new connector
- def __init__(self, parent, name, type, position, direction, negated = False, edge = "none", onlyone = False):
+ def __init__(self, parent, name, type, position, direction, negated=False, edge="none", onlyone=False):
DebugDataConsumer.__init__(self)
ToolTipProducer.__init__(self, parent.Parent)
self.ParentBlock = parent
@@ -1063,7 +1063,7 @@
self.Wires = []
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
parent_pos = self.ParentBlock.GetPosition()
x = min(parent_pos[0] + self.Pos.x, parent_pos[0] + self.Pos.x + self.Direction[0] * CONNECTOR_SIZE)
y = min(parent_pos[1] + self.Pos.y, parent_pos[1] + self.Pos.y + self.Direction[1] * CONNECTOR_SIZE)
@@ -1100,7 +1100,7 @@
self.Selected = selected
# Make a clone of the connector
- def Clone(self, parent = None):
+ def Clone(self, parent=None):
if parent is None:
parent = self.ParentBlock
return Connector(parent, self.Name, self.Type, wx.Point(self.Pos[0], self.Pos[1]),
@@ -1111,7 +1111,7 @@
return self.ParentBlock
# Returns the connector type
- def GetType(self, raw = False):
+ def GetType(self, raw=False):
if self.ParentBlock.IsEndType(self.Type) or raw:
return self.Type
elif (self.Negated or self.Edge != "none") and self.ParentBlock.IsOfType("BOOL", self.Type):
@@ -1235,7 +1235,7 @@
return self.Pos
# Returns the connector absolute position
- def GetPosition(self, size = True):
+ def GetPosition(self, size=True):
parent_pos = self.ParentBlock.GetPosition()
# If the position of the end of the connector is asked
if size:
@@ -1259,11 +1259,11 @@
self.Direction = direction
# Connect a wire to this connector at the last place
- def Connect(self, wire, refresh = True):
+ def Connect(self, wire, refresh=True):
self.InsertConnect(len(self.Wires), wire, refresh)
# Connect a wire to this connector at the place given
- def InsertConnect(self, idx, wire, refresh = True):
+ def InsertConnect(self, idx, wire, refresh=True):
if wire not in self.Wires:
self.Wires.insert(idx, wire)
if wire[1] == 0:
@@ -1281,7 +1281,7 @@
return None
# Unconnect a wire or all wires connected to the connector
- def UnConnect(self, wire = None, unconnect = True, delete = False):
+ def UnConnect(self, wire=None, unconnect=True, delete=False):
i = 0
found = False
while i < len(self.Wires) and not found:
@@ -1309,7 +1309,7 @@
return len(self.Wires) > 0
# Move the wires connected
- def MoveConnected(self, exclude = []):
+ def MoveConnected(self, exclude=[]):
if len(self.Wires) > 0:
# Calculate the new position of the end point
parent_pos = self.ParentBlock.GetPosition()
@@ -1565,7 +1565,7 @@
"""
# Create a new wire
- def __init__(self, parent, start = None, end = None):
+ def __init__(self, parent, start=None, end=None):
Graphic_Element.__init__(self, parent)
DebugDataConsumer.__init__(self)
self.StartPoint = start
@@ -1603,7 +1603,7 @@
self.EndConnected = None
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = Graphic_Element.GetRedrawRect(self, movex, movey)
if self.StartConnected:
rect = rect.Union(self.StartConnected.GetRedrawRect(movex, movey))
@@ -1630,7 +1630,7 @@
rect = rect.Union(wx.Rect(x, y, width, height))
return rect
- def Clone(self, parent, connectors = {}, dx = 0, dy = 0):
+ def Clone(self, parent, connectors={}, dx=0, dy=0):
start_connector = connectors.get(self.StartConnected, None)
end_connector = connectors.get(self.EndConnected, None)
if start_connector is not None and end_connector is not None:
@@ -2009,7 +2009,7 @@
return None
# Returns a list of the position of all wire points
- def GetPoints(self, invert = False):
+ def GetPoints(self, invert=False):
points = self.VerifyPoints()
points[0] = wx.Point(points[0].x - CONNECTOR_SIZE * self.StartPoint[1][0],
points[0].y - CONNECTOR_SIZE * self.StartPoint[1][1])
@@ -2050,7 +2050,7 @@
return None
# Update the wire points position by keeping at most possible the current positions
- def GeneratePoints(self, realpoints = True):
+ def GeneratePoints(self, realpoints=True):
i = 0
# Calculate the start enad end points with the minimum segment size in the right direction
end = wx.Point(self.EndPoint[0].x + self.EndPoint[1][0] * MIN_SEGMENT_SIZE,
@@ -2209,7 +2209,7 @@
return points
# Moves all the wire points except the first and the last if they are connected
- def Move(self, dx, dy, endpoints = False):
+ def Move(self, dx, dy, endpoints=False):
for i, point in enumerate(self.Points):
if endpoints or not (i == 0 and self.StartConnected) and not (i == len(self.Points) - 1 and self.EndConnected):
point.x += dx
@@ -2304,12 +2304,12 @@
self.RefreshBoundingBox()
# Unconnects wire start point
- def UnConnectStartPoint(self, delete = False):
+ def UnConnectStartPoint(self, delete=False):
if delete:
self.StartConnected = None
self.Delete()
elif self.StartConnected:
- self.StartConnected.UnConnect(self, unconnect = False)
+ self.StartConnected.UnConnect(self, unconnect=False)
self.StartConnected = None
self.RefreshBoundingBox()
@@ -2339,12 +2339,12 @@
self.RefreshBoundingBox()
# Unconnects wire end point
- def UnConnectEndPoint(self, delete = False):
+ def UnConnectEndPoint(self, delete=False):
if delete:
self.EndConnected = None
self.Delete()
elif self.EndConnected:
- self.EndConnected.UnConnect(self, unconnect = False)
+ self.EndConnected.UnConnect(self, unconnect=False)
self.EndConnected = None
self.RefreshBoundingBox()
@@ -2767,7 +2767,7 @@
"""
# Create a new comment
- def __init__(self, parent, content, id = None):
+ def __init__(self, parent, content, id=None):
Graphic_Element.__init__(self, parent)
self.Id = id
self.Content = content
@@ -2776,7 +2776,7 @@
self.Highlights = []
# Make a clone of this comment
- def Clone(self, parent, id = None, pos = None):
+ def Clone(self, parent, id=None, pos=None):
comment = Comment(parent, self.Content, id)
if pos is not None:
comment.SetPosition(pos.x, pos.y)
@@ -2841,7 +2841,7 @@
return self.Pos.x, self.Pos.y
# Moves the comment
- def Move(self, dx, dy, connected = True):
+ def Move(self, dx, dy, connected=True):
self.Pos.x += dx
self.Pos.y += dy
self.RefreshBoundingBox()
--- a/graphics/LD_Objects.py Tue Aug 15 17:01:51 2017 +0300
+++ b/graphics/LD_Objects.py Tue Aug 15 22:38:43 2017 +0300
@@ -54,7 +54,7 @@
self.Connectors = []
# Make a clone of this LD_PowerRail
- def Clone(self, parent, id = None, pos = None):
+ def Clone(self, parent, id=None, pos=None):
powerrail = LD_PowerRail(parent, self.Type, id)
powerrail.SetSize(self.Size[0], self.Size[1])
if pos is not None:
@@ -71,7 +71,7 @@
[connector for connector in element.Connectors]))
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = Graphic_Element.GetRedrawRect(self, movex, movey)
for connector in self.Connectors:
rect = rect.Union(connector.GetRedrawRect(movex, movey))
@@ -108,7 +108,7 @@
# Unconnect all connectors
def Clean(self):
for connector in self.Connectors:
- connector.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ connector.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Refresh the power rail bounding box
def RefreshBoundingBox(self):
@@ -195,12 +195,12 @@
self.RefreshConnected()
# Refresh the position of wires connected to power rail
- def RefreshConnected(self, exclude = []):
+ def RefreshConnected(self, exclude=[]):
for connector in self.Connectors:
connector.MoveConnected(exclude)
# Returns the power rail connector that starts with the point given if it exists
- def GetConnector(self, position, name = None):
+ def GetConnector(self, position, name=None):
# if a name is given
if name is not None:
# Test each connector if it exists
@@ -218,7 +218,7 @@
return {"inputs": connectors, "outputs": []}
# Test if point given is on one of the power rail connectors
- def TestConnector(self, pt, direction = None, exclude = True):
+ def TestConnector(self, pt, direction=None, exclude=True):
for connector in self.Connectors:
if connector.TestPoint(pt, direction, exclude):
return connector
@@ -350,7 +350,7 @@
"""
# Create a new contact
- def __init__(self, parent, type, name, id = None):
+ def __init__(self, parent, type, name, id=None):
Graphic_Element.__init__(self, parent)
DebugDataConsumer.__init__(self)
self.Type = type
@@ -416,7 +416,7 @@
self.PreviousSpreading = spreading
# Make a clone of this LD_Contact
- def Clone(self, parent, id = None, pos = None):
+ def Clone(self, parent, id=None, pos=None):
contact = LD_Contact(parent, self.Type, self.Name, id)
contact.SetSize(self.Size[0], self.Size[1])
if pos is not None:
@@ -431,7 +431,7 @@
return {self.Input: element.Input, self.Output: element.Output}
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = Graphic_Element.GetRedrawRect(self, movex, movey)
rect = rect.Union(self.Input.GetRedrawRect(movex, movey))
rect = rect.Union(self.Output.GetRedrawRect(movex, movey))
@@ -445,7 +445,7 @@
def ProcessDragging(self, movex, movey, event, scaling):
if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
movex = movey = 0
- return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling, height_fac = 2)
+ return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling, height_fac=2)
# Forbids to change the contact size
def SetSize(self, width, height):
@@ -459,8 +459,8 @@
# Unconnect input and output
def Clean(self):
- self.Input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
- self.Output.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Input.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Output.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Refresh the size of text for name
def RefreshNameSize(self):
@@ -505,12 +505,12 @@
return LD_ELEMENT_SIZE
# Refresh the position of wire connected to contact
- def RefreshConnected(self, exclude = []):
+ def RefreshConnected(self, exclude=[]):
self.Input.MoveConnected(exclude)
self.Output.MoveConnected(exclude)
# Returns the contact connector that starts with the point given if it exists
- def GetConnector(self, position, name = None):
+ def GetConnector(self, position, name=None):
# if a name is given
if name is not None:
# Test input and output connector
@@ -525,7 +525,7 @@
return {"inputs": [self.Input], "outputs": [self.Output]}
# Test if point given is on contact input or output connector
- def TestConnector(self, pt, direction = None, exclude=True):
+ def TestConnector(self, pt, direction=None, exclude=True):
# Test input connector
if self.Input.TestPoint(pt, direction, exclude):
return self.Input
@@ -696,7 +696,7 @@
"""
# Create a new coil
- def __init__(self, parent, type, name, id = None):
+ def __init__(self, parent, type, name, id=None):
Graphic_Element.__init__(self, parent)
self.Type = type
self.Name = name
@@ -731,7 +731,7 @@
self.Parent.ElementNeedRefresh(self)
# Make a clone of this LD_Coil
- def Clone(self, parent, id = None, pos = None):
+ def Clone(self, parent, id=None, pos=None):
coil = LD_Coil(parent, self.Type, self.Name, id)
coil.SetSize(self.Size[0], self.Size[1])
if pos is not None:
@@ -746,7 +746,7 @@
return {self.Input: element.Input, self.Output: element.Output}
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = Graphic_Element.GetRedrawRect(self, movex, movey)
rect = rect.Union(self.Input.GetRedrawRect(movex, movey))
rect = rect.Union(self.Output.GetRedrawRect(movex, movey))
@@ -760,7 +760,7 @@
def ProcessDragging(self, movex, movey, event, scaling):
if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
movex = movey = 0
- return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling, height_fac = 2)
+ return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling, height_fac=2)
# Forbids to change the Coil size
def SetSize(self, width, height):
@@ -774,8 +774,8 @@
# Unconnect input and output
def Clean(self):
- self.Input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
- self.Output.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Input.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Output.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Refresh the size of text for name
def RefreshNameSize(self):
@@ -824,12 +824,12 @@
return LD_ELEMENT_SIZE
# Refresh the position of wire connected to coil
- def RefreshConnected(self, exclude = []):
+ def RefreshConnected(self, exclude=[]):
self.Input.MoveConnected(exclude)
self.Output.MoveConnected(exclude)
# Returns the coil connector that starts with the point given if it exists
- def GetConnector(self, position, name = None):
+ def GetConnector(self, position, name=None):
# if a name is given
if name is not None:
# Test input and output connector
@@ -844,7 +844,7 @@
return {"inputs": [self.Input], "outputs": [self.Output]}
# Test if point given is on coil input or output connector
- def TestConnector(self, pt, direction = None, exclude=True):
+ def TestConnector(self, pt, direction=None, exclude=True):
# Test input connector
if self.Input.TestPoint(pt, direction, exclude):
return self.Input
--- a/graphics/RubberBand.py Tue Aug 15 17:01:51 2017 +0300
+++ b/graphics/RubberBand.py Tue Aug 15 22:38:43 2017 +0300
@@ -169,7 +169,7 @@
# Restore Viewer scale factor
dc.SetUserScale(scalex, scaley)
- def Redraw(self, dc = None):
+ def Redraw(self, dc=None):
"""
Redraw rubberband on Viewer
@param dc: Device Context of Viewer (default None)
@@ -177,7 +177,7 @@
# Erase last bbox and draw current bbox
self.DrawBoundingBoxes([self.LastBBox, self.CurrentBBox], dc)
- def Erase(self, dc = None):
+ def Erase(self, dc=None):
"""
Erase rubberband from Viewer
@param dc: Device Context of Viewer (default None)
@@ -185,7 +185,7 @@
# Erase last bbox
self.DrawBoundingBoxes([self.LastBBox], dc)
- def Draw(self, dc = None):
+ def Draw(self, dc=None):
"""
Draw rubberband on Viewer
@param dc: Device Context of Viewer (default None)
--- a/graphics/SFC_Objects.py Tue Aug 15 17:01:51 2017 +0300
+++ b/graphics/SFC_Objects.py Tue Aug 15 22:38:43 2017 +0300
@@ -46,7 +46,7 @@
"""
# Create a new step
- def __init__(self, parent, name, initial = False, id = None):
+ def __init__(self, parent, name, initial=False, id=None):
Graphic_Element.__init__(self, parent)
DebugDataConsumer.__init__(self)
self.SetName(name)
@@ -105,7 +105,7 @@
self.PreviousSpreading = spreading
# Make a clone of this SFC_Step
- def Clone(self, parent, id = None, name = "Step", pos = None):
+ def Clone(self, parent, id=None, name="Step", pos=None):
step = SFC_Step(parent, name, self.Initial, id)
step.SetSize(self.Size[0], self.Size[1])
if pos is not None:
@@ -131,7 +131,7 @@
return connectors
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = Graphic_Element.GetRedrawRect(self, movex, movey)
if self.Input:
rect = rect.Union(self.Input.GetRedrawRect(movex, movey))
@@ -155,11 +155,11 @@
# Unconnect input and output
def Clean(self):
if self.Input:
- self.Input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Input.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
if self.Output:
- self.Output.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Output.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
if self.Action:
- self.Action.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Action.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Refresh the size of text for name
def RefreshNameSize(self):
@@ -174,33 +174,33 @@
# Remove output connector from step
def RemoveInput(self):
if self.Input:
- self.Input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Input.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
self.Input = None
self.RefreshBoundingBox()
# Add output connector to step
def AddOutput(self):
if not self.Output:
- self.Output = Connector(self, "", None, wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH, onlyone = True)
+ self.Output = Connector(self, "", None, wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH, onlyone=True)
self.RefreshBoundingBox()
# Remove output connector from step
def RemoveOutput(self):
if self.Output:
- self.Output.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Output.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
self.Output = None
self.RefreshBoundingBox()
# Add action connector to step
def AddAction(self):
if not self.Action:
- self.Action = Connector(self, "", None, wx.Point(self.Size[0], self.Size[1] / 2), EAST, onlyone = True)
+ self.Action = Connector(self, "", None, wx.Point(self.Size[0], self.Size[1] / 2), EAST, onlyone=True)
self.RefreshBoundingBox()
# Remove action connector from step
def RemoveAction(self):
if self.Action:
- self.Action.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Action.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
self.Action = None
self.RefreshBoundingBox()
@@ -244,7 +244,7 @@
self.RefreshConnected()
# Refresh the position of wires connected to step
- def RefreshConnected(self, exclude = []):
+ def RefreshConnected(self, exclude=[]):
if self.Input:
self.Input.MoveConnected(exclude)
if self.Output:
@@ -253,7 +253,7 @@
self.Action.MoveConnected(exclude)
# Returns the step connector that starts with the point given if it exists
- def GetConnector(self, position, name = None):
+ def GetConnector(self, position, name=None):
# if a name is given
if name is not None:
# Test input, output and action connector if they exists
@@ -289,7 +289,7 @@
return connectors
# Test if point given is on step input or output connector
- def TestConnector(self, pt, direction = None, exclude=True):
+ def TestConnector(self, pt, direction=None, exclude=True):
# Test input connector if it exists
if self.Input and self.Input.TestPoint(pt, direction, exclude):
return self.Input
@@ -385,7 +385,7 @@
input_block.RefreshInputPosition()
# Align output element with this step
- def RefreshOutputPosition(self, move = None):
+ def RefreshOutputPosition(self, move=None):
if self.Output:
wires = self.Output.GetWires()
if len(wires) != 1:
@@ -579,7 +579,7 @@
"""
# Create a new transition
- def __init__(self, parent, type = "reference", condition = None, priority = 0, id = None):
+ def __init__(self, parent, type="reference", condition=None, priority=0, id=None):
Graphic_Element.__init__(self, parent)
DebugDataConsumer.__init__(self)
self.Type = None
@@ -587,8 +587,8 @@
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.Output = Connector(self, "", None, wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH, 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)
self.Highlights = {}
@@ -632,7 +632,7 @@
self.PreviousSpreading = spreading
# Make a clone of this SFC_Transition
- def Clone(self, parent, id = None, pos = None):
+ def Clone(self, parent, id=None, pos=None):
transition = SFC_Transition(parent, self.Type, self.Condition, self.Priority, id)
transition.SetSize(self.Size[0], self.Size[1])
if pos is not None:
@@ -652,7 +652,7 @@
return connectors
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = Graphic_Element.GetRedrawRect(self, movex, movey)
if self.Input:
rect = rect.Union(self.Input.GetRedrawRect(movex, movey))
@@ -698,10 +698,10 @@
# Unconnect input and output
def Clean(self):
- self.Input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
- self.Output.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Input.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Output.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
if self.Type == "connection":
- self.Condition.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Condition.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Returns if the point given is in the bounding box
def HitTest(self, pt, connectors=True):
@@ -766,14 +766,14 @@
self.RefreshConnected()
# Refresh the position of the wires connected to transition
- def RefreshConnected(self, exclude = []):
+ def RefreshConnected(self, exclude=[]):
self.Input.MoveConnected(exclude)
self.Output.MoveConnected(exclude)
if self.Type == "connection":
self.Condition.MoveConnected(exclude)
# Returns the transition connector that starts with the point given if it exists
- def GetConnector(self, position, name = None):
+ def GetConnector(self, position, name=None):
# if a name is given
if name is not None:
# Test input and output connector
@@ -799,7 +799,7 @@
return {"inputs": [self.Input], "outputs": [self.Output]}
# Test if point given is on transition input or output connector
- def TestConnector(self, pt, direction = None, exclude=True):
+ def TestConnector(self, pt, direction=None, exclude=True):
# Test input connector
if self.Input.TestPoint(pt, direction, exclude):
return self.Input
@@ -812,10 +812,10 @@
return None
# Changes the transition type
- def SetType(self, type, condition = None):
+ def SetType(self, type, condition=None):
if self.Type != type:
if self.Type == "connection":
- self.Condition.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Condition.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
self.Type = type
if type == "connection":
self.Condition = Connector(self, "", "BOOL", wx.Point(0, self.Size[1] / 2), WEST)
@@ -873,7 +873,7 @@
input_block.RefreshInputPosition()
# Align output element with this step
- def RefreshOutputPosition(self, move = None):
+ def RefreshOutputPosition(self, move=None):
wires = self.Output.GetWires()
if len(wires) != 1:
return
@@ -920,7 +920,7 @@
self.RefreshOutputPosition()
return movex, 0
else:
- return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling, width_fac = 2, height_fac = 2)
+ return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling, width_fac=2, height_fac=2)
# Refresh input element model
def RefreshInputModel(self):
@@ -1049,7 +1049,7 @@
"""
# Create a new divergence
- def __init__(self, parent, type, number = 2, id = None):
+ def __init__(self, parent, type, number=2, id=None):
Graphic_Element.__init__(self, parent)
self.Type = type
self.Id = id
@@ -1058,15 +1058,15 @@
self.Size = wx.Size((number - 1) * SFC_DEFAULT_SEQUENCE_INTERVAL, self.GetMinSize()[1])
# Create an input and output connector
if self.Type in [SELECTION_DIVERGENCE, SIMULTANEOUS_DIVERGENCE]:
- self.Inputs = [Connector(self, "", None, wx.Point(self.Size[0] / 2, 0), NORTH, onlyone = True)]
+ self.Inputs = [Connector(self, "", None, wx.Point(self.Size[0] / 2, 0), NORTH, onlyone=True)]
self.Outputs = []
for i in xrange(number):
- self.Outputs.append(Connector(self, "", None, wx.Point(i * SFC_DEFAULT_SEQUENCE_INTERVAL, self.Size[1]), SOUTH, onlyone = True))
+ self.Outputs.append(Connector(self, "", None, wx.Point(i * SFC_DEFAULT_SEQUENCE_INTERVAL, self.Size[1]), SOUTH, onlyone=True))
elif self.Type in [SELECTION_CONVERGENCE, SIMULTANEOUS_CONVERGENCE]:
self.Inputs = []
for i in xrange(number):
- self.Inputs.append(Connector(self, "", None, wx.Point(i * SFC_DEFAULT_SEQUENCE_INTERVAL, 0), NORTH, onlyone = True))
- self.Outputs = [Connector(self, "", None, wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH, onlyone = True)]
+ self.Inputs.append(Connector(self, "", None, wx.Point(i * SFC_DEFAULT_SEQUENCE_INTERVAL, 0), NORTH, onlyone=True))
+ self.Outputs = [Connector(self, "", None, wx.Point(self.Size[0] / 2, self.Size[1]), SOUTH, onlyone=True)]
self.Value = None
self.PreviousValue = None
@@ -1105,7 +1105,7 @@
output.SpreadCurrent(False)
# Make a clone of this SFC_Divergence
- def Clone(self, parent, id = None, pos = None):
+ def Clone(self, parent, id=None, pos=None):
divergence = SFC_Divergence(parent, self.Type, max(len(self.Inputs), len(self.Outputs)), id)
divergence.SetSize(self.Size[0], self.Size[1])
if pos is not None:
@@ -1120,7 +1120,7 @@
return dict(zip(self.Inputs + self.Outputs, element.Inputs + element.Outputs))
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = Graphic_Element.GetRedrawRect(self, movex, movey)
if movex != 0 or movey != 0:
for input in self.Inputs:
@@ -1147,9 +1147,9 @@
# Unconnect input and output
def Clean(self):
for input in self.Inputs:
- input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ input.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
for output in self.Outputs:
- output.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ output.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Add a branch to the divergence
def AddBranch(self):
@@ -1158,7 +1158,7 @@
for output in self.Outputs:
pos = output.GetRelPosition()
maxx = max(maxx, pos.x)
- connector = Connector(self, "", None, wx.Point(maxx + SFC_DEFAULT_SEQUENCE_INTERVAL, self.Size[1]), SOUTH, onlyone = True)
+ connector = Connector(self, "", None, wx.Point(maxx + SFC_DEFAULT_SEQUENCE_INTERVAL, self.Size[1]), SOUTH, onlyone=True)
self.Outputs.append(connector)
self.MoveConnector(connector, 0)
elif self.Type in [SELECTION_CONVERGENCE, SIMULTANEOUS_CONVERGENCE]:
@@ -1166,7 +1166,7 @@
for input in self.Inputs:
pos = input.GetRelPosition()
maxx = max(maxx, pos.x)
- connector = Connector(self, "", None, wx.Point(maxx + SFC_DEFAULT_SEQUENCE_INTERVAL, 0), NORTH, onlyone = True)
+ connector = Connector(self, "", None, wx.Point(maxx + SFC_DEFAULT_SEQUENCE_INTERVAL, 0), NORTH, onlyone=True)
self.Inputs.append(connector)
self.MoveConnector(connector, SFC_DEFAULT_SEQUENCE_INTERVAL)
@@ -1209,7 +1209,7 @@
self.Size[0] + 2 * SFC_SIMULTANEOUS_SEQUENCE_EXTRA + 1, self.Size[1] + 1)
# Refresh the position of wires connected to divergence
- def RefreshConnected(self, exclude = []):
+ def RefreshConnected(self, exclude=[]):
for input in self.Inputs:
input.MoveConnected(exclude)
for output in self.Outputs:
@@ -1244,7 +1244,7 @@
self.RefreshBoundingBox()
# Returns the divergence connector that starts with the point given if it exists
- def GetConnector(self, position, name = None):
+ def GetConnector(self, position, name=None):
# if a name is given
if name is not None:
# Test each input and output connector
@@ -1261,7 +1261,7 @@
return {"inputs": self.Inputs, "outputs": self.Outputs}
# Test if point given is on divergence input or output connector
- def TestConnector(self, pt, direction = None, exclude=True):
+ def TestConnector(self, pt, direction=None, exclude=True):
# Test input connector
for input in self.Inputs:
if input.TestPoint(pt, direction, exclude):
@@ -1343,7 +1343,7 @@
input.MoveConnected()
# Align output element with this divergence
- def RefreshOutputPosition(self, move = None):
+ def RefreshOutputPosition(self, move=None):
if move:
for output_connector in self.Outputs:
wires = output_connector.GetWires()
@@ -1509,14 +1509,14 @@
"""
# Create a new jump
- def __init__(self, parent, target, id = None):
+ def __init__(self, parent, target, id=None):
Graphic_Element.__init__(self, parent)
self.SetTarget(target)
self.Id = id
self.Size = wx.Size(SFC_JUMP_SIZE[0], SFC_JUMP_SIZE[1])
self.Highlights = []
# 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.Value = None
self.PreviousValue = None
@@ -1533,7 +1533,7 @@
self.Parent.ElementNeedRefresh(self)
# Make a clone of this SFC_Jump
- def Clone(self, parent, id = None, pos = None):
+ def Clone(self, parent, id=None, pos=None):
jump = SFC_Jump(parent, self.Target, id)
jump.SetSize(self.Size[0], self.Size[1])
if pos is not None:
@@ -1547,7 +1547,7 @@
return {self.Input: element.Input}
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = Graphic_Element.GetRedrawRect(self, movex, movey)
if self.Input:
rect = rect.Union(self.Input.GetRedrawRect(movex, movey))
@@ -1572,7 +1572,7 @@
# Unconnect input
def Clean(self):
- self.Input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Input.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Refresh the size of text for target
def RefreshTargetSize(self):
@@ -1613,12 +1613,12 @@
self.RefreshConnected()
# Refresh the position of wires connected to jump
- def RefreshConnected(self, exclude = []):
+ def RefreshConnected(self, exclude=[]):
if self.Input:
self.Input.MoveConnected(exclude)
# Returns input jump connector
- def GetConnector(self, position = None, name = None):
+ def GetConnector(self, position=None, name=None):
return self.Input
# Returns all the jump connectors
@@ -1626,7 +1626,7 @@
return {"inputs": [self.Input], "outputs": []}
# Test if point given is on jump input connector
- def TestConnector(self, pt, direction = None, exclude = True):
+ def TestConnector(self, pt, direction=None, exclude=True):
# Test input connector
if self.Input and self.Input.TestPoint(pt, direction, exclude):
return self.Input
@@ -1664,7 +1664,7 @@
input_block.RefreshInputPosition()
# Can't align output element, because there is no output
- def RefreshOutputPosition(self, move = None):
+ def RefreshOutputPosition(self, move=None):
pass
# Method called when a LeftDClick event have been generated
@@ -1687,7 +1687,7 @@
self.RefreshInputPosition()
return movex, 0
else:
- return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling, width_fac = 2)
+ return Graphic_Element.ProcessDragging(self, movex, movey, event, scaling, width_fac=2)
# Refresh input element model
def RefreshInputModel(self):
@@ -1785,14 +1785,14 @@
"""
# Create a new action block
- def __init__(self, parent, actions = [], id = None):
+ def __init__(self, parent, actions=[], id=None):
Graphic_Element.__init__(self, parent)
self.Id = id
self.Size = wx.Size(SFC_ACTION_MIN_SIZE[0], SFC_ACTION_MIN_SIZE[1])
self.MinSize = wx.Size(SFC_ACTION_MIN_SIZE[0], SFC_ACTION_MIN_SIZE[1])
self.Highlights = {}
# Create an input and output connector
- self.Input = Connector(self, "", None, wx.Point(0, SFC_ACTION_MIN_SIZE[1] / 2), WEST, onlyone = True)
+ self.Input = Connector(self, "", None, wx.Point(0, SFC_ACTION_MIN_SIZE[1] / 2), WEST, onlyone=True)
self.SetActions(actions)
self.Value = None
self.PreviousValue = None
@@ -1810,7 +1810,7 @@
self.Parent.ElementNeedRefresh(self)
# Make a clone of this SFC_ActionBlock
- def Clone(self, parent, id = None, pos = None):
+ def Clone(self, parent, id=None, pos=None):
actions = [action.copy() for action in self.Actions]
action_block = SFC_ActionBlock(parent, actions, id)
action_block.SetSize(self.Size[0], self.Size[1])
@@ -1825,7 +1825,7 @@
return {self.Input: element.Input}
# Returns the RedrawRect
- def GetRedrawRect(self, movex = 0, movey = 0):
+ def GetRedrawRect(self, movex=0, movey=0):
rect = Graphic_Element.GetRedrawRect(self, movex, movey)
if self.Input:
rect = rect.Union(self.Input.GetRedrawRect(movex, movey))
@@ -1858,18 +1858,18 @@
# Unconnect input and output
def Clean(self):
- self.Input.UnConnect(delete = self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
+ self.Input.UnConnect(delete=self.Parent.GetDrawingMode() == FREEDRAWING_MODE)
# Refresh the action block bounding box
def RefreshBoundingBox(self):
self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
# Refresh the position of wires connected to action block
- def RefreshConnected(self, exclude = []):
+ def RefreshConnected(self, exclude=[]):
self.Input.MoveConnected(exclude)
# Returns input action block connector
- def GetConnector(self, position = None, name = None):
+ def GetConnector(self, position=None, name=None):
return self.Input
# Returns all the action block connectors
@@ -1877,7 +1877,7 @@
return {"inputs": [self.Input], "outputs": []}
# Test if point given is on action block input connector
- def TestConnector(self, pt, direction = None, exclude = True):
+ def TestConnector(self, pt, direction=None, exclude=True):
# Test input connector
if self.Input.TestPoint(pt, direction, exclude):
return self.Input
--- a/i18n/mki18n.py Tue Aug 15 17:01:51 2017 +0300
+++ b/i18n/mki18n.py Tue Aug 15 22:38:43 2017 +0300
@@ -110,7 +110,7 @@
return languageDict
-def processCustomFiles(filein, fileout, regexp, prefix = ''):
+def processCustomFiles(filein, fileout, regexp, prefix=''):
appfil_file = open(filein, 'r')
messages_file = open(fileout, 'r')
messages = messages_file.read()
--- a/plcopen/plcopen.py Tue Aug 15 17:01:51 2017 +0300
+++ b/plcopen/plcopen.py Tue Aug 15 22:38:43 2017 +0300
@@ -516,7 +516,7 @@
def addconfigurationResource(self, config_name, name):
if self.getconfigurationResource(config_name, name) is not None:
- msg = _("\"{a1}\" resource already exists in \"{a2}\" configuration !!!").format(a1 = name, a2 = config_name)
+ msg = _("\"{a1}\" resource already exists in \"{a2}\" configuration !!!").format(a1=name, a2=config_name)
raise ValueError, msg
configuration = self.getconfiguration(config_name)
if configuration is not None:
@@ -534,7 +534,7 @@
configuration.remove(resource)
found = True
if not found:
- msg = _("\"{a1}\" resource doesn't exist in \"{a2}\" configuration !!!").format(a1 = name, a2 = config_name)
+ msg = _("\"{a1}\" resource doesn't exist in \"{a2}\" configuration !!!").format(a1=name, a2=config_name)
raise ValueError, msg
setattr(cls, "removeconfigurationResource", removeconfigurationResource)
--- a/py_ext/PythonFileCTNMixin.py Tue Aug 15 17:01:51 2017 +0300
+++ b/py_ext/PythonFileCTNMixin.py Tue Aug 15 22:38:43 2017 +0300
@@ -243,7 +243,7 @@
varpubfmt) % varinfo
for varinfo in varinfos])
varinit = "\n".join([varinitonchangefmt % dict(
- onchangelen = len(varinfo["onchangecode"]), **varinfo)
+ onchangelen=len(varinfo["onchangecode"]), **varinfo)
for varinfo in varinfos if varinfo["onchange"]])
# TODO : use config name obtained from model instead of default
--- a/runtime/NevowServer.py Tue Aug 15 17:01:51 2017 +0300
+++ b/runtime/NevowServer.py Tue Aug 15 22:38:43 2017 +0300
@@ -64,7 +64,7 @@
jsClass = u"WebInterface.PLC"
docFactory = loaders.stan(tags.div(render=tags.directive('liveElement'))[
tags.div(id='content')[
- tags.div(render = tags.directive('PLCElement')),
+ tags.div(render=tags.directive('PLCElement')),
]])
def __init__(self, *a, **kw):
@@ -122,7 +122,7 @@
tags.head(render=tags.directive('liveglue')),
tags.body[
tags.div[
- tags.div( render = tags.directive( "MainPage" ))
+ tags.div( render=tags.directive( "MainPage" ))
]]]])
MainPage = MainPage()
PLCHMI = PLCHMI
--- a/runtime/ServicePublisher.py Tue Aug 15 17:01:51 2017 +0300
+++ b/runtime/ServicePublisher.py Tue Aug 15 22:38:43 2017 +0300
@@ -66,7 +66,7 @@
self.service_name,
self.ip_32b,
self.port,
- properties = self.serviceproperties))
+ properties=self.serviceproperties))
self.retrytimer = None
def UnRegisterService(self):
@@ -78,11 +78,11 @@
self.service_name,
self.ip_32b,
self.port,
- properties = self.serviceproperties))
+ properties=self.serviceproperties))
self.server.close()
self.server = None
- def gethostaddr(self, dst = '224.0.1.41'):
+ def gethostaddr(self, dst='224.0.1.41'):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect((dst, 7))
--- a/runtime/WampClient.py Tue Aug 15 17:01:51 2017 +0300
+++ b/runtime/WampClient.py Tue Aug 15 22:38:43 2017 +0300
@@ -108,19 +108,19 @@
# create a WAMP application session factory
component_config = types.ComponentConfig(
- realm = WSClientConf["realm"],
- extra = {"ID": WSClientConf["ID"]})
+ realm=WSClientConf["realm"],
+ extra={"ID": WSClientConf["ID"]})
session_factory = wamp.ApplicationSessionFactory(
- config = component_config)
+ config=component_config)
session_factory.session = WampSession
# create a WAMP-over-WebSocket transport client factory
transport_factory = ReconnectingWampWebSocketClientFactory(
session_factory,
- url = WSClientConf["url"],
- serializers = [MsgPackSerializer()],
- debug = False,
- debug_wamp = False)
+ url=WSClientConf["url"],
+ serializers=[MsgPackSerializer()],
+ debug=False,
+ debug_wamp=False)
# start the client from a Twisted endpoint
conn = connectWS(transport_factory)
--- a/svgui/pyjs/build.py Tue Aug 15 17:01:51 2017 +0300
+++ b/svgui/pyjs/build.py Tue Aug 15 22:38:43 2017 +0300
@@ -262,8 +262,8 @@
print >> script_selectors, select_tmpl % (platform, file_prefix)
print >>home_nocache_html_output, home_nocache_html_template % dict(
- app_name = app_name,
- script_selectors = script_selectors.getvalue(),
+ app_name=app_name,
+ script_selectors=script_selectors.getvalue(),
)
home_nocache_html_output.close()
@@ -458,13 +458,13 @@
mod_cache_html_output = StringIO()
print >>mod_cache_html_output, mod_cache_html_template % dict(
- mod_name = mod_name,
- app_name = app_name,
- modnames = modnames,
- overrides = overnames,
- mod_libs = mod_libs[platform][mod_name],
- dynamic = dynamic,
- mod_code = mod_code_,
+ mod_name=mod_name,
+ app_name=app_name,
+ modnames=modnames,
+ overrides=overnames,
+ mod_libs=mod_libs[platform][mod_name],
+ dynamic=dynamic,
+ mod_code=mod_code_,
)
if dynamic:
@@ -497,16 +497,16 @@
# library modules
file_contents = all_cache_html_template % dict(
- app_name = app_name,
- early_app_libs = early_app_libs_,
- app_libs = app_libs_,
- app_code = app_code_,
- app_body = app_body,
- overrides = overnames,
- platform = platform.lower(),
- dynamic = dynamic,
- app_modnames = app_modnames,
- app_headers = app_headers
+ app_name=app_name,
+ early_app_libs=early_app_libs_,
+ app_libs=app_libs_,
+ app_code=app_code_,
+ app_body=app_body,
+ overrides=overnames,
+ platform=platform.lower(),
+ dynamic=dynamic,
+ app_modnames=app_modnames,
+ app_headers=app_headers
)
if cache_buster:
digest = md5.new(file_contents).hexdigest()
@@ -672,7 +672,7 @@
def main():
global app_platforms
- parser = OptionParser(usage = usage, version = version)
+ parser = OptionParser(usage=usage, version=version)
parser.add_option("-o", "--output", dest="output",
help="directory to which the webapp should be written")
parser.add_option("-j", "--include-js", dest="js_includes", action="append",
@@ -695,7 +695,7 @@
dest="cache_buster",
help="Enable browser cache-busting (MD5 hash added to output filenames)")
- parser.set_defaults(output = "output", js_includes=[], library_dirs=[],
+ parser.set_defaults(output="output", js_includes=[], library_dirs=[],
platforms=(','.join(app_platforms)),
data_dir=os.path.join(sys.prefix, "share/pyjamas"),
dynamic=False,
--- a/svgui/pyjs/lib/pyjslib.py Tue Aug 15 17:01:51 2017 +0300
+++ b/svgui/pyjs/lib/pyjslib.py Tue Aug 15 22:38:43 2017 +0300
@@ -526,7 +526,7 @@
def insert(self, index, value):
JS(""" var a = this.l; this.l=a.slice(0, index).concat(value, a.slice(index));""")
- def pop(self, index = -1):
+ def pop(self, index=-1):
JS("""
if (index<0) index = this.l.length + index;
var a = this.l[index];
@@ -676,7 +676,7 @@
def insert(self, index, value):
JS(""" var a = this.l; this.l=a.slice(0, index).concat(value, a.slice(index));""")
- def pop(self, index = -1):
+ def pop(self, index=-1):
JS("""
if (index<0) index = this.l.length + index;
var a = this.l[index];
--- a/svgui/pyjs/pyjs.py Tue Aug 15 17:01:51 2017 +0300
+++ b/svgui/pyjs/pyjs.py Tue Aug 15 22:38:43 2017 +0300
@@ -1051,7 +1051,7 @@
rhs = self.expr(node.expr, current_klass)
print >>self.output, " " + lhs + " " + op + " " + rhs + ";"
- def _assign(self, node, current_klass, top_level = False):
+ def _assign(self, node, current_klass, top_level=False):
if len(node.nodes) != 1:
tempvar = '__temp'+str(node.lineno)
tnode = ast.Assign([ast.AssName(tempvar, "OP_ASSIGN", node.lineno)], node.expr, node.lineno)
@@ -1531,7 +1531,7 @@
class PlatformParser:
- def __init__(self, platform_dir = "", verbose=True):
+ def __init__(self, platform_dir="", verbose=True):
self.platform_dir = platform_dir
self.parse_cache = {}
self.platform = ""
--- a/util/MiniTextControler.py Tue Aug 15 17:01:51 2017 +0300
+++ b/util/MiniTextControler.py Tue Aug 15 22:38:43 2017 +0300
@@ -46,7 +46,7 @@
file.write(text)
file.close()
- def GetEditedElementText(self, tagname, debug = False):
+ def GetEditedElementText(self, tagname, debug=False):
if os.path.isfile(self.FilePath):
file = open(self.FilePath, "r")
text = file.read()
@@ -54,22 +54,22 @@
return text
return ""
- def GetEditedElementInterfaceVars(self, tagname, tree=False, debug = False):
+ def GetEditedElementInterfaceVars(self, tagname, tree=False, debug=False):
return []
- def GetEditedElementType(self, tagname, debug = False):
+ def GetEditedElementType(self, tagname, debug=False):
return "program"
- def GetBlockType(self, type, inputs = None, debug = False):
+ def GetBlockType(self, type, inputs=None, debug=False):
return self.BaseController.GetBlockType(type, inputs, debug)
- def GetBlockTypes(self, tagname = "", debug = False):
+ def GetBlockTypes(self, tagname="", debug=False):
return self.BaseController.GetBlockTypes(tagname, debug)
- def GetDataTypes(self, tagname = "", basetypes = True, only_locatables = False, debug = False):
+ def GetDataTypes(self, tagname="", basetypes=True, only_locatables=False, debug=False):
return self.BaseController.GetDataTypes(tagname, basetypes, only_locatables, debug)
- def GetEnumeratedDataValues(self, debug = False):
+ def GetEnumeratedDataValues(self, debug=False):
return self.BaseController.GetEnumeratedDataValues(debug)
def StartBuffering(self):
--- a/util/ProcessLogger.py Tue Aug 15 17:01:51 2017 +0300
+++ b/util/ProcessLogger.py Tue Aug 15 22:38:43 2017 +0300
@@ -71,11 +71,11 @@
class ProcessLogger:
- def __init__(self, logger, Command, finish_callback = None,
- no_stdout = False, no_stderr = False, no_gui = True,
- timeout = None, outlimit = None, errlimit = None,
- endlog = None, keyword = None, kill_it = False, cwd = None,
- encoding = None):
+ def __init__(self, logger, Command, finish_callback=None,
+ no_stdout=False, no_stderr=False, no_gui=True,
+ timeout=None, outlimit=None, errlimit=None,
+ endlog=None, keyword=None, kill_it=False, cwd=None,
+ encoding=None):
self.logger = logger
if not isinstance(Command, list):
self.Command_str = Command
@@ -169,7 +169,7 @@
def log_the_end(self, ecode, pid):
self.logger.write(self.Command_str + "\n")
- self.logger.write_warning(_("exited with status {a1} (pid {a2})\n").format(a1 = str(ecode), a2 = str(pid)))
+ self.logger.write_warning(_("exited with status {a1} (pid {a2})\n").format(a1=str(ecode), a2=str(pid)))
def finish(self, pid, ecode):
# avoid running function before start is finished
--- a/util/Zeroconf.py Tue Aug 15 17:01:51 2017 +0300
+++ b/util/Zeroconf.py Tue Aug 15 22:38:43 2017 +0300
@@ -626,7 +626,7 @@
class DNSOutgoing(object):
"""Object representation of an outgoing packet"""
- def __init__(self, flags, multicast = 1):
+ def __init__(self, flags, multicast=1):
self.finished = 0
self.id = 0
self.multicast = multicast
@@ -1529,7 +1529,7 @@
out.id = msg.id
self.send(out, addr, port)
- def send(self, out, addr = _MDNS_ADDR, port = _MDNS_PORT):
+ def send(self, out, addr=_MDNS_ADDR, port=_MDNS_PORT):
"""Sends an outgoing packet."""
# This is a quick test to see if we can parse the packets we generate
#temp = DNSIncoming(out.packet())
--- a/util/paths.py Tue Aug 15 17:01:51 2017 +0300
+++ b/util/paths.py Tue Aug 15 22:38:43 2017 +0300
@@ -41,7 +41,7 @@
return os.path.join(AbsDir(file), *args)
-def AbsParentDir(file, level = 1):
+def AbsParentDir(file, level=1):
path = AbsDir(file)
for i in range(0, level):
path = os.path.dirname(path)
--- a/version.py Tue Aug 15 17:01:51 2017 +0300
+++ b/version.py Tue Aug 15 22:38:43 2017 +0300
@@ -46,8 +46,8 @@
try:
pipe = subprocess.Popen(
["hg", "id", "-i"],
- stdout = subprocess.PIPE,
- cwd = app_dir
+ stdout=subprocess.PIPE,
+ cwd=app_dir
)
rev = pipe.communicate()[0]
if pipe.returncode != 0:
--- a/xmlclass/xmlclass.py Tue Aug 15 17:01:51 2017 +0300
+++ b/xmlclass/xmlclass.py Tue Aug 15 22:38:43 2017 +0300
@@ -81,7 +81,7 @@
def SetOffset(self, offset):
if offset == "Z":
- self.__offset = timedelta(minutes = 0)
+ self.__offset = timedelta(minutes=0)
self.__name = "UTC"
else:
sign = {"-": -1, "+": 1}[offset[0]]
@@ -243,7 +243,7 @@
@param type: name of the type of float
@return: function generated
"""
- def GetFloat(attr, extract = True):
+ def GetFloat(attr, extract=True):
"""
Function that extracts a float from a tree node or a string
@param attr: tree node containing data to extract or data as a string
@@ -1060,7 +1060,7 @@
return self.ComputedClasses
- def CreateClass(self, name, parent, classinfos, baseclass = False):
+ def CreateClass(self, name, parent, classinfos, baseclass=False):
if parent is not None:
classname = "%s_%s" % (parent, name)
else:
@@ -1842,7 +1842,7 @@
factory.etreeNamespaceFormat,
BaseClass[0] if len(BaseClass) == 1 else None,
etree.XMLSchema(etree.fromstring(xsdstring)),
- strip_cdata = False, remove_blank_text=True)
+ strip_cdata=False, remove_blank_text=True)
class_lookup = XMLElementClassLookUp(factory.ComputedClassesLookUp)
parser.set_element_class_lookup(class_lookup)
--- a/xmlclass/xsdschema.py Tue Aug 15 17:01:51 2017 +0300
+++ b/xmlclass/xsdschema.py Tue Aug 15 22:38:43 2017 +0300
@@ -406,7 +406,7 @@
raise ValueError("Item type can't be derivated by list!")
# Generate extract value for new created type
- def ExtractSimpleTypeValue(attr, extract = True):
+ def ExtractSimpleTypeValue(attr, extract=True):
values = []
for value in GetToken(attr, extract).split(" "):
values.append(itemtypeinfos["extract"](value, False))
@@ -453,7 +453,7 @@
simpleType["basename"] = "union"
# Generate extract value for new created type
- def ExtractSimpleTypeValue(attr, extract = True):
+ def ExtractSimpleTypeValue(attr, extract=True):
if extract:
value = GetAttributeValue(attr)
else:
@@ -1961,7 +1961,7 @@
"minOccurs": {
"type": SYNTAXATTRIBUTE,
"extract": {
- "default": GenerateLimitExtraction(unbounded = False),
+ "default": GenerateLimitExtraction(unbounded=False),
"all": GenerateLimitExtraction(0, 1, False)
},
"default": {