--- a/Beremiz.py Tue May 08 22:27:49 2012 +0200
+++ b/Beremiz.py Wed May 09 00:00:50 2012 +0200
@@ -147,7 +147,8 @@
from util.BrowseValuesLibraryDialog import BrowseValuesLibraryDialog
import types, time, re, platform, time, traceback, commands
-from ConfigTree import ConfigTreeRoot, MiniTextControler, MATIEC_ERROR_MODEL
+from ProjectController import ProjectController, MATIEC_ERROR_MODEL +from util import MiniTextControler from ProcessLogger import ProcessLogger
@@ -556,7 +557,7 @@
if projectOpen is not None and os.path.isdir(projectOpen):
- self.CTR = ConfigTreeRoot(self, self.Log)
+ self.CTR = ProjectController(self, self.Log) self.Controler = self.CTR
result = self.CTR.LoadProject(projectOpen, buildpath)
@@ -1677,7 +1678,7 @@
self.Config.Write("lastopenedfolder", os.path.dirname(projectpath))
- ctr = ConfigTreeRoot(self, self.Log)
+ ctr = ProjectController(self, self.Log) result = ctr.NewProject(projectpath)
@@ -1713,7 +1714,7 @@
self.Config.Write("lastopenedfolder", os.path.dirname(projectpath))
- self.CTR = ConfigTreeRoot(self, self.Log)
+ self.CTR = ProjectController(self, self.Log) self.Controler = self.CTR
result = self.CTR.LoadProject(projectpath)
--- a/LPCBeremiz.py Tue May 08 22:27:49 2012 +0200
+++ b/LPCBeremiz.py Wed May 09 00:00:50 2012 +0200
@@ -59,7 +59,10 @@
__builtin__.__dict__['_'] = wx.GetTranslation#unicode_translation
-from ConfigTree import ConfigTreeRoot, ConfigTreeNode, opjimg, connectors
+from ProjectController import ProjectController +from ConfigTreeNode import ConfigTreeNode from plcopen.structures import LOCATIONDATATYPES
from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP,\
LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
@@ -456,7 +459,7 @@
#-------------------------------------------------------------------------------
-# LPCConfigTreeRoot Class
+# LPCProjectController Class #-------------------------------------------------------------------------------
def mycopytree(src, dst):
@@ -479,7 +482,7 @@
[SIMULATION_MODE, TRANSFER_MODE] = range(2)
-class LPCConfigTreeRoot(ConfigTreeRoot):
+class LPCProjectController(ProjectController): {"bitmap" : opjimg("Debug"),
@@ -510,7 +513,7 @@
def __init__(self, frame, logger, buildpath):
self.OrigBuildPath = buildpath
- ConfigTreeRoot.__init__(self, frame, logger)
+ ProjectController.__init__(self, frame, logger) self.CTNChildrenTypes += [("LPCBus", LPCBus, "LPC bus"), ("CanOpen", LPCCanOpen, "CanOpen bus")]
@@ -532,19 +535,19 @@
if self.OrigBuildPath is not None:
return os.path.join(self.OrigBuildPath, "pous.xml")
- return ConfigTreeRoot.ConfNodeLibraryFilePath(self)
+ return ProjectController.ConfNodeLibraryFilePath(self) def GetProjectName(self):
return self.Project.getname()
def GetDefaultTargetName(self):
if self.CurrentMode == SIMULATION_MODE:
- return ConfigTreeRoot.GetDefaultTargetName(self)
+ return ProjectController.GetDefaultTargetName(self) - target = ConfigTreeRoot.GetTarget(self)
+ target = ProjectController.GetTarget(self) if self.CurrentMode != SIMULATION_MODE:
target.getcontent()["value"].setBuildPath(self.BuildPath)
@@ -555,7 +558,7 @@
self.SimulationBuildPath = os.path.join(tempfile.mkdtemp(), os.path.basename(self.ProjectPath), "build")
return self.SimulationBuildPath
- return ConfigTreeRoot._getBuildPath(self)
+ return ProjectController._getBuildPath(self) save = self.ProjectTestModified()
@@ -564,7 +567,7 @@
self.AppFrame._Refresh(TITLE, FILEMENU)
if self.BuildPath is not None:
mycopytree(self.OrigBuildPath, self.BuildPath)
- ConfigTreeRoot._Build(self)
+ ProjectController._Build(self) wx.CallAfter(self.AppFrame.RefreshAll)
@@ -970,7 +973,7 @@
- ConfigTreeRoot._Stop(self)
+ ProjectController._Stop(self) if self.CurrentMode == SIMULATION_MODE:
@@ -1001,7 +1004,7 @@
if self.CurrentMode is None and self.OnlineMode != "OFF":
self.CurrentMode = TRANSFER_MODE
- if ConfigTreeRoot._Build(self):
+ if ProjectController._Build(self): ID_ABORTTRANSFERTIMER = wx.NewId()
self.AbortTransferTimer = wx.Timer(self.AppFrame, ID_ABORTTRANSFERTIMER)
@@ -1023,7 +1026,7 @@
self.logger.write(_("Start PLC transfer\n"))
self.AbortTransferTimer.Stop()
- ConfigTreeRoot._Transfer(self)
+ ProjectController._Transfer(self) self.AbortTransferTimer.Start(milliseconds=5000, oneShot=True)
def AbortTransfer(self, event):
@@ -1743,7 +1746,7 @@
Log = StdoutPseudoFile(port)
- CTR = LPCConfigTreeRoot(None, Log, buildpath)
+ CTR = LPCProjectController(None, Log, buildpath) if projectOpen is not None and os.path.isdir(projectOpen):
result = CTR.LoadProject(projectOpen)
--- a/c_ext/c_ext.py Tue May 08 22:27:49 2012 +0200
+++ b/c_ext/c_ext.py Wed May 09 00:00:50 2012 +0200
@@ -5,7 +5,7 @@
-from ConfigTree import ConfigTreeNode, opjimg
+from ConfigTreeNode import ConfigTreeNode, opjimg from CFileEditor import CFileEditor
from PLCControler import PLCControler, UndoBuffer, LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
--- a/canfestival/canfestival.py Tue May 08 22:27:49 2012 +0200
+++ b/canfestival/canfestival.py Wed May 09 00:00:50 2012 +0200
@@ -9,7 +9,7 @@
from networkedit import networkedit
from objdictedit import objdictedit
import canfestival_config as local_canfestival_config
-from ConfigTree import ConfigTreeNode
+from ConfigTreeNode import ConfigTreeNode from commondialogs import CreateNodeDialog
--- a/py_ext/modules/wxglade_hmi/wxglade_hmi.py Tue May 08 22:27:49 2012 +0200
+++ b/py_ext/modules/wxglade_hmi/wxglade_hmi.py Wed May 09 00:00:50 2012 +0200
@@ -2,7 +2,7 @@
from xml.dom import minidom
-from ConfigTree import opjimg
+from ConfigTreeNode import opjimg from py_ext import PythonCodeTemplate
class RootClass(PythonCodeTemplate):
--- a/targets/LPC/__init__.py Tue May 08 22:27:49 2012 +0200
+++ b/targets/LPC/__init__.py Wed May 09 00:00:50 2012 +0200
@@ -6,9 +6,9 @@
class LPC_target(toolchain_makefile):
- def __init__(self, ConfigTreeRootInstance):
+ def __init__(self, CTRInstance): - toolchain_makefile.__init__(self, ConfigTreeRootInstance)
+ toolchain_makefile.__init__(self, CTRInstance) def _GetBinMD5FileName(self):
return os.path.join(self.buildpath, "lastbuildPLCbin.md5")
@@ -64,7 +64,7 @@
- self.ConfigTreeRootInstance.logger.write(
+ self.CTRInstance.logger.write( _("Binary is %s bytes long\n")%
os.path.join(self.buildpath, "ArmPLC_rom.bin"))))
--- a/targets/Xenomai/__init__.py Tue May 08 22:27:49 2012 +0200
+++ b/targets/Xenomai/__init__.py Wed May 09 00:00:50 2012 +0200
@@ -4,14 +4,14 @@
def getXenoConfig(self, flagsname):
""" Get xeno-config from target parameters """
- xeno_config=self.ConfigTreeRootInstance.GetTarget().getcontent()["value"].getXenoConfig()
+ xeno_config=self.CTRInstance.GetTarget().getcontent()["value"].getXenoConfig() from ProcessLogger import ProcessLogger
- status, result, err_result = ProcessLogger(self.ConfigTreeRootInstance.logger,
+ status, result, err_result = ProcessLogger(self.CTRInstance.logger, xeno_config + " --skin=native --"+flagsname,
- self.ConfigTreeRootInstance.logger.write_error(_("Unable to get Xenomai's %s \n")%flagsname)
+ self.CTRInstance.logger.write_error(_("Unable to get Xenomai's %s \n")%flagsname) --- a/targets/toolchain_gcc.py Tue May 08 22:27:49 2012 +0200
+++ b/targets/toolchain_gcc.py Wed May 09 00:00:50 2012 +0200
@@ -10,23 +10,23 @@
It cannot be used as this and should be inherited in a target specific
class such as target_linux or target_win32
- def __init__(self, ConfigTreeRootInstance):
- self.ConfigTreeRootInstance = ConfigTreeRootInstance
+ def __init__(self, CTRInstance): + self.CTRInstance = CTRInstance - self.SetBuildPath(self.ConfigTreeRootInstance._getBuildPath())
+ self.SetBuildPath(self.CTRInstance._getBuildPath()) def getBuilderCFLAGS(self):
Returns list of builder specific CFLAGS
- return [self.ConfigTreeRootInstance.GetTarget().getcontent()["value"].getCFLAGS()]
+ return [self.CTRInstance.GetTarget().getcontent()["value"].getCFLAGS()] def getBuilderLDFLAGS(self):
Returns list of builder specific LDFLAGS
- return self.ConfigTreeRootInstance.LDFLAGS + \
- [self.ConfigTreeRootInstance.GetTarget().getcontent()["value"].getLDFLAGS()]
+ return self.CTRInstance.LDFLAGS + \ + [self.CTRInstance.GetTarget().getcontent()["value"].getLDFLAGS()] @@ -56,7 +56,7 @@
def SetBuildPath(self, buildpath):
if self.buildpath != buildpath:
self.buildpath = buildpath
- self.exe = self.ConfigTreeRootInstance.GetProjectName() + self.extension
+ self.exe = self.CTRInstance.GetProjectName() + self.extension self.exe_path = os.path.join(self.buildpath, self.exe)
@@ -89,7 +89,7 @@
# Retrieve toolchain user parameters
- toolchain_params = self.ConfigTreeRootInstance.GetTarget().getcontent()["value"]
+ toolchain_params = self.CTRInstance.GetTarget().getcontent()["value"] self.compiler = toolchain_params.getCompiler()
self.linker = toolchain_params.getLinker()
@@ -99,11 +99,11 @@
- for Location, CFilesAndCFLAGS, DoCalls in self.ConfigTreeRootInstance.LocationCFilesAndCFLAGS:
+ for Location, CFilesAndCFLAGS, DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS: - self.ConfigTreeRootInstance.logger.write(_("ConfNode : ") + self.ConfigTreeRootInstance.GetChildByIECLocation(Location).GetCurrentName() + " " + str(Location)+"\n")
+ self.CTRInstance.logger.write(_("ConfNode : ") + self.CTRInstance.GetChildByIECLocation(Location).GetCurrentName() + " " + str(Location)+"\n") - self.ConfigTreeRootInstance.logger.write(_("PLC :\n"))
+ self.CTRInstance.logger.write(_("PLC :\n")) for CFile, CFLAGS in CFilesAndCFLAGS:
@@ -114,21 +114,21 @@
match = self.check_and_update_hash_and_deps(bn)
- self.ConfigTreeRootInstance.logger.write(" [pass] "+bn+" -> "+obn+"\n")
+ self.CTRInstance.logger.write(" [pass] "+bn+" -> "+obn+"\n") - self.ConfigTreeRootInstance.logger.write(" [CC] "+bn+" -> "+obn+"\n")
+ self.CTRInstance.logger.write(" [CC] "+bn+" -> "+obn+"\n") status, result, err_result = ProcessLogger(
- self.ConfigTreeRootInstance.logger,
+ self.CTRInstance.logger, "\"%s\" -c \"%s\" -o \"%s\" %s %s"%
(self.compiler, CFile, objectfilename, Builder_CFLAGS, CFLAGS)
- self.ConfigTreeRootInstance.logger.write_error(_("C compilation of %s failed.\n")%bn)
+ self.CTRInstance.logger.write_error(_("C compilation of %s failed.\n")%bn) objs.append(objectfilename)
@@ -138,7 +138,7 @@
######### GENERATE library FILE ########################################
# Link all the object files into one binary file
- self.ConfigTreeRootInstance.logger.write(_("Linking :\n"))
+ self.CTRInstance.logger.write(_("Linking :\n")) @@ -147,10 +147,10 @@
ALLldflags = ' '.join(self.getBuilderLDFLAGS())
- self.ConfigTreeRootInstance.logger.write(" [CC] " + ' '.join(obns)+" -> " + self.exe + "\n")
+ self.CTRInstance.logger.write(" [CC] " + ' '.join(obns)+" -> " + self.exe + "\n") status, result, err_result = ProcessLogger(
- self.ConfigTreeRootInstance.logger,
+ self.CTRInstance.logger, "\"%s\" %s -o \"%s\" %s"%
@@ -162,7 +162,7 @@
- self.ConfigTreeRootInstance.logger.write(" [pass] " + ' '.join(obns)+" -> " + self.exe + "\n")
+ self.CTRInstance.logger.write(" [pass] " + ' '.join(obns)+" -> " + self.exe + "\n") # Calculate md5 key and get data for the new created PLC
data=self.GetBinaryCode()
--- a/targets/toolchain_makefile.py Tue May 08 22:27:49 2012 +0200
+++ b/targets/toolchain_makefile.py Wed May 09 00:00:50 2012 +0200
@@ -7,11 +7,11 @@
includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*')
class toolchain_makefile():
- def __init__(self, ConfigTreeRootInstance):
- self.ConfigTreeRootInstance = ConfigTreeRootInstance
+ def __init__(self, CTRInstance): + self.CTRInstance = CTRInstance - self.SetBuildPath(self.ConfigTreeRootInstance._getBuildPath())
+ self.SetBuildPath(self.CTRInstance._getBuildPath()) def SetBuildPath(self, buildpath):
if self.buildpath != buildpath:
@@ -60,7 +60,7 @@
- for Location, CFilesAndCFLAGS, DoCalls in self.ConfigTreeRootInstance.LocationCFilesAndCFLAGS:
+ for Location, CFilesAndCFLAGS, DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS: # Get CFiles list to give it to makefile
for CFile, CFLAGS in CFilesAndCFLAGS:
CFileName = os.path.basename(CFile)
@@ -72,7 +72,7 @@
self.md5key = hashlib.md5(wholesrcdata).hexdigest()
- props = self.ConfigTreeRootInstance.GetProjectProperties()
+ props = self.CTRInstance.GetProjectProperties() self.md5key += '#'.join([props[key] for key in ['companyName',
@@ -88,21 +88,21 @@
"md5": '"'+self.md5key+'"'
- target = self.ConfigTreeRootInstance.GetTarget().getcontent()["value"]
+ target = self.CTRInstance.GetTarget().getcontent()["value"] command = target.getCommand().split(' ') +\
[target.getBuildPath()] +\
[arg % beremizcommand for arg in target.getArguments().split(' ')] +\
target.getRule().split(' ')
# Call Makefile to build PLC code and link it with target specific code
- status, result, err_result = ProcessLogger(self.ConfigTreeRootInstance.logger,
+ status, result, err_result = ProcessLogger(self.CTRInstance.logger, - self.ConfigTreeRootInstance.logger.write_error(_("C compilation failed.\n"))
+ self.CTRInstance.logger.write_error(_("C compilation failed.\n")) - self.ConfigTreeRootInstance.logger.write(_("Source didn't change, no build.\n"))
+ self.CTRInstance.logger.write(_("Source didn't change, no build.\n"))