--- a/BeremizIDE.py Tue Aug 15 16:01:18 2017 +0300
+++ b/BeremizIDE.py Tue Aug 15 16:48:49 2017 +0300
@@ -115,7 +115,7 @@
self.TimerAccessLock.acquire()
if self.LastRefreshTimer:
self.LastRefreshTimer.cancel()
- self.LastRefreshTimer=None
+ self.LastRefreshTimer = None self.TimerAccessLock.release()
if current_time - self.LastRefreshTime > REFRESH_PERIOD and self.RefreshLock.acquire(False):
@@ -148,7 +148,7 @@
for s, style in self.stack:
- if style is None: style=self.black_white
+ if style is None: style = self.black_white if style != self.black_white:
self.output.StartStyling(self.output.GetLength(), 0xff)
@@ -284,7 +284,7 @@
self._RecursiveAddMenuItems(parent, GetAddMenuItems())
def _init_coll_HelpMenu_Items(self, parent):
- handler=lambda event: {
+ handler = lambda event: { wx.MessageBox(version.GetCommunityHelpMsg(), _(u'Community support'), wx.OK | wx.ICON_INFORMATION)
@@ -877,7 +877,7 @@
defaultpath = os.path.expanduser("~")
- dialog = wx.DirDialog(self, _("Choose a project"), defaultpath, style=wx.DEFAULT_DIALOG_STYLE|
+ dialog = wx.DirDialog(self, _("Choose a project"), defaultpath, style=wx.DEFAULT_DIALOG_STYLE | if dialog.ShowModal() == wx.ID_OK:
self.OpenProject(dialog.GetPath())
--- a/Beremiz_service.py Tue Aug 15 16:01:18 2017 +0300
+++ b/Beremiz_service.py Tue Aug 15 16:48:49 2017 +0300
@@ -67,7 +67,7 @@
@@ -111,7 +111,7 @@
if __name__ == '__main__':
@@ -264,7 +264,7 @@
menu.Append(self.TBMENU_START, _("Start PLC"))
menu.Append(self.TBMENU_STOP, _("Stop PLC"))
menu.Append(self.TBMENU_CHANGE_NAME, _("Change Name"))
menu.Append(self.TBMENU_CHANGE_INTERFACE, _("Change IP of interface to bind"))
@@ -382,9 +382,9 @@
def default_evaluator(tocall, *args, **kwargs):
- res=(tocall(*args, **kwargs), None)
+ res = (tocall(*args, **kwargs), None) - res=(None, sys.exc_info())
+ res = (None, sys.exc_info()) @@ -423,7 +423,7 @@
- self.daemon=pyro.Daemon(host=self.ip_addr, port=self.port)
+ self.daemon = pyro.Daemon(host=self.ip_addr, port=self.port) self.plcobj = PLCObject(self.workdir, self.daemon, self.argv,
self.statuschange, self.evaluator,
@@ -511,7 +511,7 @@
# avoid dead lock if called from the wx mainloop
return default_evaluator(tocall, *args, **kwargs)
- o=type('', (object,), dict(call=(tocall, args, kwargs), res=None))
+ o = type('', (object,), dict(call=(tocall, args, kwargs), res=None)) wx.CallAfter(wx_evaluator, o)
@@ -598,7 +598,7 @@
if havetwisted or havewx:
- pyro_thread=Thread(target=pyroserver.Loop)
+ pyro_thread = Thread(target=pyroserver.Loop) --- a/ConfigTreeNode.py Tue Aug 15 16:01:18 2017 +0300
+++ b/ConfigTreeNode.py Tue Aug 15 16:48:49 2017 +0300
@@ -276,19 +276,19 @@
# confnode asks for some LDFLAGS
# LDFLAGS can be either string
- if type(CTNLDFLAGS)==type(str()):
+ if type(CTNLDFLAGS) == type(str()): - elif type(CTNLDFLAGS)==type(list()):
+ elif type(CTNLDFLAGS) == type(list()): + LDFLAGS = CTNLDFLAGS[:]
# recurse through all children, and stack their results
for CTNChild in self.IECSortedChildren():
new_location = CTNChild.GetCurrentLocation()
# How deep are we in the tree ?
- depth=len(new_location)
+ depth = len(new_location) _LocationCFilesAndCFLAGS, _LDFLAGS, _extra_files = \
@@ -397,7 +397,7 @@
# Do nothing if no change
#if CurrentName == DesiredName: return CurrentName
# Build a list of used Name out of parent's Children
for CTNInstance in self.CTNParent.IterChildren():
AllNames.append(CTNInstance.BaseParams.getName())
@@ -429,7 +429,7 @@
def GetAllChannels(self):
for CTNInstance in self.CTNParent.IterChildren():
AllChannels.append(CTNInstance.BaseParams.getIEC_Channel())
--- a/IDEFrame.py Tue Aug 15 16:01:18 2017 +0300
+++ b/IDEFrame.py Tue Aug 15 16:48:49 2017 +0300
@@ -509,8 +509,8 @@
self.LeftNoteBook = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORLEFTNOTEBOOK,
- style=wx.aui.AUI_NB_TOP|wx.aui.AUI_NB_TAB_SPLIT|wx.aui.AUI_NB_TAB_MOVE|
- wx.aui.AUI_NB_SCROLL_BUTTONS|wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
+ style=wx.aui.AUI_NB_TOP | wx.aui.AUI_NB_TAB_SPLIT | wx.aui.AUI_NB_TAB_MOVE | + wx.aui.AUI_NB_SCROLL_BUTTONS | wx.aui.AUI_NB_TAB_EXTERNAL_MOVE) self.LeftNoteBook.Bind(wx.aui.EVT_AUINOTEBOOK_ALLOW_DND,
self.AUIManager.AddPane(self.LeftNoteBook,
@@ -519,8 +519,8 @@
BestSize(wx.Size(300, 500)).CloseButton(False))
self.BottomNoteBook = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORBOTTOMNOTEBOOK,
- style=wx.aui.AUI_NB_TOP|wx.aui.AUI_NB_TAB_SPLIT|wx.aui.AUI_NB_TAB_MOVE|
- wx.aui.AUI_NB_SCROLL_BUTTONS|wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
+ style=wx.aui.AUI_NB_TOP | wx.aui.AUI_NB_TAB_SPLIT | wx.aui.AUI_NB_TAB_MOVE | + wx.aui.AUI_NB_SCROLL_BUTTONS | wx.aui.AUI_NB_TAB_EXTERNAL_MOVE) self.BottomNoteBook.Bind(wx.aui.EVT_AUINOTEBOOK_ALLOW_DND,
self.AUIManager.AddPane(self.BottomNoteBook,
@@ -529,8 +529,8 @@
BestSize(wx.Size(800, 300)).CloseButton(False))
self.RightNoteBook = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORRIGHTNOTEBOOK,
- style=wx.aui.AUI_NB_TOP|wx.aui.AUI_NB_TAB_SPLIT|wx.aui.AUI_NB_TAB_MOVE|
- wx.aui.AUI_NB_SCROLL_BUTTONS|wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
+ style=wx.aui.AUI_NB_TOP | wx.aui.AUI_NB_TAB_SPLIT | wx.aui.AUI_NB_TAB_MOVE | + wx.aui.AUI_NB_SCROLL_BUTTONS | wx.aui.AUI_NB_TAB_EXTERNAL_MOVE) self.RightNoteBook.Bind(wx.aui.EVT_AUINOTEBOOK_ALLOW_DND,
self.AUIManager.AddPane(self.RightNoteBook,
@@ -539,7 +539,7 @@
BestSize(wx.Size(250, 400)).CloseButton(False))
self.TabsOpened = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORTABSOPENED,
- style=wx.aui.AUI_NB_DEFAULT_STYLE|wx.aui.AUI_NB_WINDOWLIST_BUTTON)
+ style=wx.aui.AUI_NB_DEFAULT_STYLE | wx.aui.AUI_NB_WINDOWLIST_BUTTON) self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGING,
self.OnPouSelectedChanging)
self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED,
--- a/PLCOpenEditor.py Tue Aug 15 16:01:18 2017 +0300
+++ b/PLCOpenEditor.py Tue Aug 15 16:48:49 2017 +0300
@@ -106,7 +106,7 @@
def _init_coll_FileMenu_Items(self, parent):
AppendMenu(parent, help='', id=wx.ID_NEW,
- kind=wx.ITEM_NORMAL, text=_(u'New') +'\tCTRL+N')
+ kind=wx.ITEM_NORMAL, text=_(u'New') + '\tCTRL+N') AppendMenu(parent, help='', id=wx.ID_OPEN,
kind=wx.ITEM_NORMAL, text=_(u'Open') + '\tCTRL+O')
AppendMenu(parent, help='', id=wx.ID_CLOSE,
@@ -162,7 +162,7 @@
#AppendMenu(parent, help='', id=wx.ID_HELP_CONTEXT,
# kind=wx.ITEM_NORMAL, text=u'IEC 61131-3\tF3')
- handler=lambda event: {
+ handler = lambda event: { wx.MessageBox(version.GetCommunityHelpMsg(), _(u'Community support'), wx.OK | wx.ICON_INFORMATION)
--- a/ProjectController.py Tue Aug 15 16:01:18 2017 +0300
+++ b/ProjectController.py Tue Aug 15 16:48:49 2017 +0300
@@ -101,7 +101,7 @@
self.ieclib_c_path = self.findLibCPath()
def findObject(self, paths, test):
@@ -109,20 +109,20 @@
- cmd="iec2c"+(".exe" if wx.Platform == '__WXMSW__' else "")
+ cmd = "iec2c"+(".exe" if wx.Platform == '__WXMSW__' else "") os.path.join(base_folder, "matiec")
path = self.findObject(paths, lambda p: os.path.isfile(os.path.join(p, cmd)))
# otherwise use iec2c from PATH
- cmd=os.path.join(path, cmd)
+ cmd = os.path.join(path, cmd)
os.path.join(base_folder, "matiec", "lib"),
@@ -130,8 +130,8 @@
os.path.join(self.ieclib_path, "C"),
path = self.findObject(paths, lambda p: os.path.isfile(os.path.join(p, "iec_types.h")))
@@ -139,7 +139,7 @@
def findSupportedOptions(self):
buildcmd = "\"%s\" -h" % (self.getCmd())
- options =["-f", "-l", "-p"]
+ options = ["-f", "-l", "-p"] @@ -204,12 +204,12 @@
<xsd:element name="Libraries" minOccurs="0">
- """+"\n".join(['<xsd:attribute name='+
- '"Enable_'+ libname + '_Library" '+
+ """+"\n".join(['<xsd:attribute name=' + + '"Enable_' + libname + '_Library" ' + 'type="xsd:boolean" use="optional" default="true"/>'
for libname, lib in features.libraries])+"""
- </xsd:element>""") if len(features.libraries)>0 else '') + """
+ </xsd:element>""") if len(features.libraries) > 0 else '') + """ <xsd:attribute name="URI_location" type="xsd:string" use="optional" default=""/>
<xsd:attribute name="Disable_Extensions" type="xsd:boolean" use="optional" default="false"/>
@@ -234,7 +234,7 @@
self.IECdebug_lock = Lock()
self.ResetIECProgramsAndVariables()
# In both new or load scenario, no need to save
@@ -261,7 +261,7 @@
for libname, clsname in features.libraries:
if self.BeremizRoot.Libraries is None or getattr(self.BeremizRoot.Libraries, "Enable_"+libname+"_Library"):
Lib = GetClassImporter(clsname)()(self, libname, TypeStack)
@@ -568,16 +568,16 @@
return "\n".join([ lib.GetSTCode() for lib in self.Libraries ])
def GetLibrariesCCode(self, buildpath):
- if len(self.Libraries)==0:
+ if len(self.Libraries) == 0: self.GetIECProgramsAndVariables()
LibIECCflags = '"-I%s" -Wno-unused-function' % os.path.abspath(self.GetIECLibPath())
- LocatedCCodeAndFlags=[]
+ LocatedCCodeAndFlags = [] for lib in self.Libraries:
- res=lib.Generate_C(buildpath, self._VariablesList, LibIECCflags)
+ res = lib.Generate_C(buildpath, self._VariablesList, LibIECCflags) LocatedCCodeAndFlags.append(res[:2])
return map(list, zip(*LocatedCCodeAndFlags))+[tuple(Extras)]
@@ -788,7 +788,7 @@
# Now extract C files of stdout
- C_files = [ fname for fname in result.splitlines() if fname[-2:]==".c" or fname[-2:]==".C" ]
+ C_files = [ fname for fname in result.splitlines() if fname[-2:] == ".c" or fname[-2:] == ".C" ] # remove those that are not to be compiled because included by others
@@ -798,7 +798,7 @@
C_files = map(lambda filename: os.path.join(buildpath, filename), C_files)
# prepend beremiz include to configuration header
- H_files = [ fname for fname in result.splitlines() if fname[-2:]==".h" or fname[-2:]==".H" ]
+ H_files = [ fname for fname in result.splitlines() if fname[-2:] == ".h" or fname[-2:] == ".H" ] H_files.remove("LOCATED_VARIABLES.h")
H_files = map(lambda filename: os.path.join(buildpath, filename), H_files)
@@ -829,13 +829,13 @@
- builder=self.GetBuilder()
+ builder = self.GetBuilder() builder.ResetBinaryCodeMD5()
self.EnableMethod("_Transfer", False)
def GetLastBuildMD5(self):
- builder=self.GetBuilder()
+ builder = self.GetBuilder() return builder.GetBinaryCodeMD5()
@@ -933,12 +933,12 @@
# Push this dictionnary into result.
self._DbgVariablesList.append(attrs)
# Fill in IEC<->C translation dicts
- IEC_path=attrs["IEC_path"]
- self._IECPathToIdx[IEC_path]=(Idx, attrs["type"])
+ IEC_path = attrs["IEC_path"] + self._IECPathToIdx[IEC_path] = (Idx, attrs["type"]) # Ignores numbers given in CSV file
# Count variables only, ignore FBs
self._VariablesList.append(attrs)
# third section contains ticktime
@@ -965,7 +965,7 @@
for v in self._DbgVariablesList:
sz = DebugTypesSize.get(v["type"], 0)
- "{&(%(C_path)s), " % v+
+ "{&(%(C_path)s), " % v + "EXT": "%(type)s_P_ENUM",
@@ -988,7 +988,7 @@
"VAR": "extern __IEC_%(type)s_t %(C_path)s;",
"FB": "extern %(type)s %(C_path)s;"
- for v in self._VariablesList if v["C_path"].find('.')<0]),
+ for v in self._VariablesList if v["C_path"].find('.') < 0]), "variable_decl_array": ",\n".join(variable_decl_array)
@@ -1008,21 +1008,21 @@
if not self.BeremizRoot.getDisable_Extensions():
plc_main_code = targets.GetCode("plc_main_head.c") % {
"calls_prototypes": "\n".join([(
- "int __init_%(s)s(int argc,char **argv);\n"+
- "void __cleanup_%(s)s(void);\n"+
- "void __retrieve_%(s)s(void);\n"+
+ "int __init_%(s)s(int argc,char **argv);\n" + + "void __cleanup_%(s)s(void);\n" + + "void __retrieve_%(s)s(void);\n" + "void __publish_%(s)s(void);") % {'s': locstr} for locstr in locstrs]),
"retrieve_calls": "\n ".join([
"__retrieve_%s();" % locstr for locstr in locstrs]),
"publish_calls": "\n ".join([ # Call publish in reverse order
"__publish_%s();" % locstrs[i-1] for i in xrange(len(locstrs), 0, -1)]),
"init_calls": "\n ".join([
- "init_level=%d; " % (i+1)+
+ "init_level=%d; " % (i+1) + "if((res = __init_%s(argc,argv))){" % locstr +
#"printf(\"%s\"); "%locstr + #for debug
"return res;}" for i, locstr in enumerate(locstrs)]),
"cleanup_calls": "\n ".join([
- "if(init_level >= %d) " % i+
+ "if(init_level >= %d) " % i + "__cleanup_%s();" % locstrs[i-1] for i in xrange(len(locstrs), 0, -1)])
@@ -1395,7 +1395,7 @@
def RegisterDebugVarToConnector(self):
@@ -1446,7 +1446,7 @@
# 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
@@ -1477,7 +1477,7 @@
IECdebug_data[4] |= buffer_list
- IECdebug_data[0][callableobj]=buffer_list
+ IECdebug_data[0][callableobj] = buffer_list self.IECdebug_lock.release()
@@ -1908,19 +1908,19 @@
def EnableMethod(self, method, value):
for d in self.StatusMethods:
- if d["method"]==method:
+ if d["method"] == method: def ShowMethod(self, method, value):
for d in self.StatusMethods:
- if d["method"]==method:
+ if d["method"] == method: def CallMethod(self, method):
for d in self.StatusMethods:
- if d["method"]==method and d.get("enabled", True) and d.get("shown", True):
+ if d["method"] == method and d.get("enabled", True) and d.get("shown", True): --- a/canfestival/canfestival.py Tue Aug 15 16:01:18 2017 +0300
+++ b/canfestival/canfestival.py Tue Aug 15 16:48:49 2017 +0300
@@ -551,32 +551,32 @@
"static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){}\n" % (nodename))
format_dict["slavebootups"] += (
- "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){\n" % (nodename)+
- " check_and_start_node(d, nodeId);\n"+
+ "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){\n" % (nodename) + + " check_and_start_node(d, nodeId);\n" + # register previously declared func as post_SlaveBootup callback for that node
format_dict["slavebootup_register"] += (
"%s_Data.post_SlaveBootup = %s_post_SlaveBootup;\n" % (nodename, nodename))
format_dict["pre_op"] += (
- "static void %s_preOperational(CO_Data* d){\n " % (nodename)+
- "".join([" masterSendNMTstateChange(d, %d, NMT_Reset_Comunication);\n" % NdId for NdId in SlaveIDs])+
+ "static void %s_preOperational(CO_Data* d){\n " % (nodename) + + "".join([" masterSendNMTstateChange(d, %d, NMT_Reset_Comunication);\n" % NdId for NdId in SlaveIDs]) + format_dict["pre_op_register"] += (
"%s_Data.preOperational = %s_preOperational;\n" % (nodename, nodename))
align = child_data.getSync_Align()
- align_ratio=child_data.getSync_Align_Ratio()
+ align_ratio = child_data.getSync_Align_Ratio() format_dict["post_sync"] += (
- "static int %s_CalCount = 0;\n" % (nodename)+
- "static void %s_post_sync(CO_Data* d){\n" % (nodename)+
- " if(%s_CalCount < %d){\n" % (nodename, align)+
- " %s_CalCount++;\n" % (nodename)+
- " align_tick(%d);\n" % (align_ratio)+
+ "static int %s_CalCount = 0;\n" % (nodename) + + "static void %s_post_sync(CO_Data* d){\n" % (nodename) + + " if(%s_CalCount < %d){\n" % (nodename, align) + + " %s_CalCount++;\n" % (nodename) + + " align_tick(%d);\n" % (align_ratio) + format_dict["post_sync_register"] += (
"%s_Data.post_sync = %s_post_sync;\n" % (nodename, nodename))
--- a/editors/DataTypeEditor.py Tue Aug 15 16:01:18 2017 +0300
+++ b/editors/DataTypeEditor.py Tue Aug 15 16:48:49 2017 +0300
@@ -261,8 +261,8 @@
enumerated_panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.EnumeratedValues = CustomEditableListBox(self.EnumeratedPanel,
- label=_("Values:"), style=wx.gizmos.EL_ALLOW_NEW|
- wx.gizmos.EL_ALLOW_EDIT|
+ label=_("Values:"), style=wx.gizmos.EL_ALLOW_NEW | + wx.gizmos.EL_ALLOW_EDIT | wx.gizmos.EL_ALLOW_DELETE)
setattr(self.EnumeratedValues, "_OnLabelEndEdit", self.OnEnumeratedValueEndEdit)
for func in ["_OnAddButton", "_OnDelButton", "_OnUpButton", "_OnDownButton"]:
@@ -323,8 +323,8 @@
self.ArrayDimensions = CustomEditableListBox(self.ArrayPanel,
- label=_("Dimensions:"), style=wx.gizmos.EL_ALLOW_NEW|
- wx.gizmos.EL_ALLOW_EDIT|
+ label=_("Dimensions:"), style=wx.gizmos.EL_ALLOW_NEW | + wx.gizmos.EL_ALLOW_EDIT | wx.gizmos.EL_ALLOW_DELETE)
for func in ["_OnLabelEndEdit", "_OnAddButton", "_OnDelButton",
"_OnUpButton", "_OnDownButton"]:
--- a/py_ext/PythonFileCTNMixin.py Tue Aug 15 16:01:18 2017 +0300
+++ b/py_ext/PythonFileCTNMixin.py Tue Aug 15 16:48:49 2017 +0300
@@ -102,7 +102,7 @@
varinfos = map(lambda variable: {
"name": variable.getname(),
"desc": repr(variable.getdesc()),
- "onchangecode": '"'+variable.getonchange()+\
+ "onchangecode": '"'+variable.getonchange() + \ "('"+variable.getname()+"')\"" \
if variable.getonchange() else '""',
"onchange": repr(variable.getonchange()) \
@@ -236,7 +236,7 @@
__SET_VAR(__%(name)s_notifier->,CODE,,__STRING_LITERAL(%(onchangelen)d,%(onchangecode)s));
vardec = "\n".join([(vardecfmt + vardeconchangefmt
- if varinfo["onchange"] else vardecfmt)% varinfo
+ if varinfo["onchange"] else vardecfmt) % varinfo for varinfo in varinfos])
varret = "\n".join([varretfmt % varinfo for varinfo in varinfos])
varpub = "\n".join([(varpubonchangefmt if varinfo["onchange"] else
--- a/runtime/PLCObject.py Tue Aug 15 16:01:18 2017 +0300
+++ b/runtime/PLCObject.py Tue Aug 15 16:48:49 2017 +0300
@@ -46,7 +46,7 @@
@@ -83,14 +83,14 @@
# Get the last transfered PLC if connector must be restart
- self.CurrentPLCFilename=open(
+ self.CurrentPLCFilename = open( "r").read().strip() + lib_ext
self.PLCStatus = "Stopped"
- self.CurrentPLCFilename=None
+ self.CurrentPLCFilename = None if self.statuschange is not None:
@@ -112,7 +112,7 @@
def GetLogCount(self, level):
if self._GetLogCount is not None:
return int(self._GetLogCount(level))
- elif self._loading_error is not None and level==0:
+ elif self._loading_error is not None and level == 0: def GetLogMessage(self, level, msgid):
@@ -129,7 +129,7 @@
self._log_read_buffer[sz] = '\x00'
return self._log_read_buffer.value, tick.value, tv_sec.value, tv_nsec.value
- elif self._loading_error is not None and level==0:
+ elif self._loading_error is not None and level == 0: return self._loading_error, 0, 0, 0
@@ -329,7 +329,7 @@
def PythonThreadProc(self):
res, cmd, blkid = "None", "None", ctypes.c_void_p()
# print "_PythonIterator(", res, ")",
cmd = self._PythonIterator(res, blkid)
@@ -338,19 +338,19 @@
- self.python_runtime_vars["FBID"]=FBID
- ccmd, AST =compile_cache.get(FBID, (None, None))
- if ccmd is None or ccmd!=cmd:
+ self.python_runtime_vars["FBID"] = FBID + ccmd, AST = compile_cache.get(FBID, (None, None)) + if ccmd is None or ccmd != cmd: AST = compile(cmd, '<plc>', 'eval')
- compile_cache[FBID]=(cmd, AST)
+ compile_cache[FBID] = (cmd, AST) result, exp = self.evaluator(eval, AST, self.python_runtime_vars)
res = "#EXCEPTION : "+str(exp[1])
self.LogMessage(1, ('PyEval@0x%x(Code="%s") Exception "%s"') % (FBID, cmd,
'\n'.join(traceback.format_exception(*exp))))
- self.python_runtime_vars["FBID"]=None
+ self.python_runtime_vars["FBID"] = None res = "#EXCEPTION : "+str(e)
self.LogMessage(1, ('PyEval@0x%x(Code="%s") Exception "%s"') % (FBID, cmd, str(e)))
@@ -364,7 +364,7 @@
self.PLCStatus = "Started"
self.PythonRuntimeCall("start")
- self.StartSem=Semaphore(0)
+ self.StartSem = Semaphore(0) self.PythonThread = Thread(target=self.PythonThreadProc)
self.PythonThread.start()
@@ -477,7 +477,7 @@
# keep a copy of requested idx
self._ResetDebugVariables()
for idx, iectype, force in idxs:
c_type, unpack_func, pack_func = \
TypeTranslator.get(iectype,
--- a/svgui/pyjs/jsonrpc/jsonrpc.py Tue Aug 15 16:01:18 2017 +0300
+++ b/svgui/pyjs/jsonrpc/jsonrpc.py Tue Aug 15 16:48:49 2017 +0300
@@ -6,7 +6,7 @@
class JSONRPCServiceBase:
def response(self, id, result):
return simplejson.dumps({'version': '1.1', 'id': id,
@@ -28,14 +28,14 @@
id, method, params = data["id"], data["method"], data["params"]
if method in self.methods:
- result =self.methods[method](*params)
+ result = self.methods[method](*params) return self.response(id, result)
etype, eval, etb = sys.exc_info()
- return self.error(id, 100, '%s: %s' %(etype.__name__, eval))
+ return self.error(id, 100, '%s: %s' % (etype.__name__, eval)) etype, eval, etb = sys.exc_info()
- return self.error(id, 100, 'Exception %s: %s' %(etype, eval))
+ return self.error(id, 100, 'Exception %s: %s' % (etype, eval)) return self.error(id, 100, 'method "%s" does not exist' % method)
--- a/svgui/pyjs/pyjs.py Tue Aug 15 16:01:18 2017 +0300
+++ b/svgui/pyjs/pyjs.py Tue Aug 15 16:48:49 2017 +0300
@@ -52,43 +52,43 @@
-PYJSLIB_BUILTIN_FUNCTIONS=("cmp",
+PYJSLIB_BUILTIN_FUNCTIONS = ("cmp", -PYJSLIB_BUILTIN_CLASSES=("BaseException",
+PYJSLIB_BUILTIN_CLASSES = ("BaseException", def pyjs_builtin_remap(name):
@@ -106,7 +106,7 @@
# XXX: this is a hack: these should be dealt with another way
# however, console is currently the only global name which is causing
-PYJS_GLOBAL_VARS=("console")
+PYJS_GLOBAL_VARS = ("console") # This is taken from the django project.
# Escape every ASCII character with a value less than 32.
@@ -404,7 +404,7 @@
default_name = arg_names[default_pos]
print >>self.output, " if (typeof %s == 'undefined')" % (default_name)
- print >>self.output, " %s=__kwargs.%s;"% (default_name, default_name)
+ print >>self.output, " %s=__kwargs.%s;" % (default_name, default_name) #self._default_args_handler(node, arg_names, current_klass)
@@ -714,7 +714,7 @@
if isinstance(v.expr, ast.Getattr):
call_name = self._getattr2(v.expr, current_klass, v.attrname + "." + attr_name)
elif isinstance(v.expr, ast.Name) and v.expr.name in self.module_imports():
- call_name = UU+v.expr.name + '.__' +v.attrname+".prototype.__class__."+attr_name
+ call_name = UU+v.expr.name + '.__' + v.attrname+".prototype.__class__."+attr_name obj = self.expr(v.expr, current_klass)
call_name = obj + "." + v.attrname + "." + attr_name
@@ -1747,7 +1747,7 @@
print >> sys.stderr, usage % sys.argv[0]
file_name = os.path.abspath(sys.argv[1])
--- a/svgui/svgui.py Tue Aug 15 16:01:18 2017 +0300
+++ b/svgui/svgui.py Tue Aug 15 16:48:49 2017 +0300
@@ -90,7 +90,7 @@
- svgfile=self._getSVGpath()
+ svgfile = self._getSVGpath() if os.path.exists(svgfile):
res += (("gui.svg", file(svgfile, "rb")),)
@@ -100,7 +100,7 @@
svguilibpath = os.path.join(self._getBuildPath(), "svguilib.js")
svguilibfile = open(svguilibpath, 'w')
- fpath=paths.AbsDir(__file__)
+ fpath = paths.AbsDir(__file__) svguilibfile.write(translate(os.path.join(fpath, "pyjs", "lib", "sys.py"), "sys"))
svguilibfile.write(open(os.path.join(fpath, "pyjs", "lib", "_pyjs.js"), 'r').read())
svguilibfile.write(translate(os.path.join(fpath, "pyjs", "lib", "pyjslib.py"), "pyjslib"))
--- a/wxglade_hmi/wxglade_hmi.py Tue Aug 15 16:01:18 2017 +0300
+++ b/wxglade_hmi/wxglade_hmi.py Tue Aug 15 16:48:49 2017 +0300
@@ -65,7 +65,7 @@
- defLibDir="/usr/share/wxglade"
+ defLibDir = "/usr/share/wxglade" if os.path.isdir(defLibDir):
@@ -89,7 +89,7 @@
- wxgfile_path=self._getWXGLADEpath()
+ wxgfile_path = self._getWXGLADEpath() if os.path.exists(wxgfile_path):
wxgfile = open(wxgfile_path, 'r')
wxgtree = minidom.parse(wxgfile)
@@ -104,7 +104,7 @@
hnode.firstChild.data for hnode in
node.getElementsByTagName("handler")]})
- hmipyfile_path=os.path.join(self._getBuildPath(), "hmi.py")
+ hmipyfile_path = os.path.join(self._getBuildPath(), "hmi.py") if wx.Platform == '__WXMSW__':
wxgfile_path = "\"%s\"" % wxgfile_path
wxghmipyfile_path = "\"%s\"" % hmipyfile_path
@@ -120,7 +120,7 @@
declare_hmi = "\n".join(["%(name)s = None\n" % x +
- "\n".join(["%(class)s.%(h)s = %(h)s"%
+ "\n".join(["%(class)s.%(h)s = %(h)s" % dict(x, h=h) for h in x['handlers']])
global_hmi = ("global %s\n" % ",".join(