LPCBeremiz.py
changeset 717 1c23952dbde1
parent 715 135566ab0807
child 718 5d4dc150b956
--- a/LPCBeremiz.py	Thu May 03 19:02:34 2012 +0200
+++ b/LPCBeremiz.py	Mon May 07 18:47:29 2012 +0200
@@ -59,25 +59,25 @@
     __builtin__.__dict__['_'] = wx.GetTranslation#unicode_translation
 
 from Beremiz import *
-from plugger import PluginsRoot, PlugTemplate, opjimg, connectors
+from ConfigTree import ConfigTreeRoot, ConfigTreeNode, opjimg, connectors
 from plcopen.structures import LOCATIONDATATYPES
-from PLCControler import LOCATION_PLUGIN, LOCATION_MODULE, LOCATION_GROUP,\
+from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP,\
                          LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
 from PLCOpenEditor import IDEFrame, ProjectDialog
 
 havecanfestival = False
 try:
-    from plugins.canfestival import RootClass as CanOpenRootClass
-    from plugins.canfestival.canfestival import _SlavePlug, _NodeListPlug, NodeManager
+    from confnodes.canfestival import RootClass as CanOpenRootClass
+    from confnodes.canfestival.canfestival import _SlavePlug, _NodeListPlug, NodeManager
     havecanfestival = True
 except:
     havecanfestival = False
     
 
 #-------------------------------------------------------------------------------
-#                          CANFESTIVAL PLUGIN HACK
+#                          CANFESTIVAL CONFNODE HACK
 #-------------------------------------------------------------------------------
-# from plugins.canfestival import canfestival
+# from confnodes.canfestival import canfestival
 # class LPC_canfestival_config:
 #     def getCFLAGS(self, *args):
 #         return ""
@@ -148,9 +148,9 @@
             if group["type"] == LOCATION_GROUP and child in group["children"]:
                 group["children"].remove(child)
 
-BUS_TEXT = """/* Code generated by LPCBus plugin */
-
-/* LPCBus plugin includes */
+BUS_TEXT = """/* Code generated by LPCBus confnode */
+
+/* LPCBus confnode includes */
 #include "app_glue.h"
 #ifdef _WINDOWS_H
   #include "iec_types.h"
@@ -160,10 +160,10 @@
 
 %(declare_code)s
 
-/* LPCBus plugin user variables definition */
+/* LPCBus confnode user variables definition */
 %(var_decl)s
 
-/* LPCBus plugin functions */
+/* LPCBus confnode functions */
 int __init_%(location_str)s(int argc,char **argv)
 {
 %(init_code)s
@@ -240,7 +240,7 @@
     
     def GetVariableLocationTree(self):
         return {"name": self.BaseParams.getName(),
-                "type": LOCATION_PLUGIN,
+                "type": LOCATION_CONFNODE,
                 "location": self.GetFullIEC_Channel(),
                 "icon": self.Icon, 
                 "children": [self._GetVariableLocationTree(self.GetCurrentLocation(), child) 
@@ -291,7 +291,7 @@
     def PlugGenerate_C(self, buildpath, locations):
         """
         Generate C code
-        @param current_location: Tupple containing plugin IEC location : %I0.0.4.5 => (0,0,4,5)
+        @param current_location: Tupple containing confnode IEC location : %I0.0.4.5 => (0,0,4,5)
         @param locations: List of complete variables locations \
             [{"IEC_TYPE" : the IEC type (i.e. "INT", "STRING", ...)
             "NAME" : name of the variable (generally "__IW0_1_2" style)
@@ -367,7 +367,7 @@
         return [(Gen_Module_path, matiec_flags)],"",True
 
 #-------------------------------------------------------------------------------
-#                          LPC CanFestival Plugin Class
+#                          LPC CanFestival ConfNode Class
 #-------------------------------------------------------------------------------
 
 if havecanfestival:
@@ -444,7 +444,7 @@
             return ""
         
         def LoadChilds(self):
-            PlugTemplate.LoadChilds(self)
+            ConfigTreeNode.LoadChilds(self)
             
             if self.GetChildByName("Master") is None:
                 master = self.PlugAddChild("Master", "CanOpenNode", 0)
@@ -456,7 +456,7 @@
     
 
 #-------------------------------------------------------------------------------
-#                              LPCPluginsRoot Class
+#                              LPCConfigTreeRoot Class
 #-------------------------------------------------------------------------------
 
 def mycopytree(src, dst):
@@ -479,9 +479,9 @@
 
 [SIMULATION_MODE, TRANSFER_MODE] = range(2)
 
-class LPCPluginsRoot(PluginsRoot):
-
-    PluginMethods = [
+class LPCConfigTreeRoot(ConfigTreeRoot):
+
+    ConfNodeMethods = [
         {"bitmap" : opjimg("Debug"),
          "name" : _("Simulate"),
          "tooltip" : _("Simulate PLC"),
@@ -510,7 +510,7 @@
     def __init__(self, frame, logger, buildpath):
         self.OrigBuildPath = buildpath
         
-        PluginsRoot.__init__(self, frame, logger)
+        ConfigTreeRoot.__init__(self, frame, logger)
         
         if havecanfestival:
             self.PlugChildsTypes += [("LPCBus", LPCBus, "LPC bus"), ("CanOpen", LPCCanOpen, "CanOpen bus")]
@@ -528,23 +528,23 @@
         
         self.AbortTransferTimer = None
     
-    def PluginLibraryFilePath(self):
+    def ConfNodeLibraryFilePath(self):
         if self.OrigBuildPath is not None:
             return os.path.join(self.OrigBuildPath, "pous.xml")
         else:
-            return PluginsRoot.PluginLibraryFilePath(self)
+            return ConfigTreeRoot.ConfNodeLibraryFilePath(self)
     
     def GetProjectName(self):
         return self.Project.getname()
 
     def GetDefaultTargetName(self):
         if self.CurrentMode == SIMULATION_MODE:
-            return PluginsRoot.GetDefaultTargetName(self)
+            return ConfigTreeRoot.GetDefaultTargetName(self)
         else:
             return "LPC"
 
     def GetTarget(self):
-        target = PluginsRoot.GetTarget(self)
+        target = ConfigTreeRoot.GetTarget(self)
         if self.CurrentMode != SIMULATION_MODE:
             target.getcontent()["value"].setBuildPath(self.BuildPath)
         return target
@@ -555,7 +555,7 @@
                 self.SimulationBuildPath = os.path.join(tempfile.mkdtemp(), os.path.basename(self.ProjectPath), "build")
             return self.SimulationBuildPath
         else:
-            return PluginsRoot._getBuildPath(self)
+            return ConfigTreeRoot._getBuildPath(self)
 
     def _Build(self):
         save = self.ProjectTestModified()
@@ -564,7 +564,7 @@
             self.AppFrame._Refresh(TITLE, FILEMENU)
         if self.BuildPath is not None:
             mycopytree(self.OrigBuildPath, self.BuildPath)
-        PluginsRoot._Build(self)
+        ConfigTreeRoot._Build(self)
         if save:
             wx.CallAfter(self.AppFrame.RefreshAll)
     
@@ -678,7 +678,7 @@
         self._AddParamsMembers()
         self.PluggedChilds = {}
         
-        # Keep track of the root plugin (i.e. project path)
+        # Keep track of the root confnode (i.e. project path)
         self.ProjectPath = ProjectPath
         
         self.BuildPath = self._getBuildPath()
@@ -686,8 +686,8 @@
             mycopytree(self.OrigBuildPath, self.BuildPath)
         
         # If dir have already be made, and file exist
-        if os.path.isdir(self.PlugPath()) and os.path.isfile(self.PluginXmlFilePath()):
-            #Load the plugin.xml file into parameters members
+        if os.path.isdir(self.PlugPath()) and os.path.isfile(self.ConfNodeXmlFilePath()):
+            #Load the confnode.xml file into parameters members
             result = self.LoadXMLParams()
             if result:
                 return result
@@ -703,9 +703,9 @@
             self.SaveProject()
         
         if wx.GetApp() is None:
-            self.RefreshPluginsBlockLists()
+            self.RefreshConfNodesBlockLists()
         else:
-            wx.CallAfter(self.RefreshPluginsBlockLists)
+            wx.CallAfter(self.RefreshConfNodesBlockLists)
 
         return None
 
@@ -889,7 +889,7 @@
         else:
             self.LocationCFilesAndCFLAGS = []
 
-        # plugin asks for some LDFLAGS
+        # confnode asks for some LDFLAGS
         if PlugLDFLAGS:
             # LDFLAGS can be either string
             if type(PlugLDFLAGS)==type(str()):
@@ -901,7 +901,7 @@
             self.LDFLAGS=[]
         
         # Template based part of C code generation
-        # files are stacked at the beginning, as files of plugin tree root
+        # files are stacked at the beginning, as files of confnode tree root
         for generator, filename, name in [
            # debugger code
            (self.Generate_plc_debugger, "plc_debugger.c", "Debugger"),
@@ -918,7 +918,7 @@
                      raise
                 code_path = os.path.join(buildpath,filename)
                 open(code_path, "w").write(code)
-                # Insert this file as first file to be compiled at root plugin
+                # Insert this file as first file to be compiled at root confnode
                 self.LocationCFilesAndCFLAGS[0][1].insert(0,(code_path, self.plcCFLAGS))
             except Exception, exc:
                 self.logger.write_error(name+_(" generation failed !\n"))
@@ -970,7 +970,7 @@
         self.ApplyOnlineMode()
     
     def _Stop(self):
-        PluginsRoot._Stop(self)
+        ConfigTreeRoot._Stop(self)
         
         if self.CurrentMode == SIMULATION_MODE:
             self.StopSimulation()
@@ -1001,7 +1001,7 @@
         if self.CurrentMode is None and self.OnlineMode != "OFF":
             self.CurrentMode = TRANSFER_MODE
             
-            if PluginsRoot._Build(self):
+            if ConfigTreeRoot._Build(self):
             
                 ID_ABORTTRANSFERTIMER = wx.NewId()
                 self.AbortTransferTimer = wx.Timer(self.AppFrame, ID_ABORTTRANSFERTIMER)
@@ -1023,7 +1023,7 @@
         self.logger.write(_("Start PLC transfer\n"))
         
         self.AbortTransferTimer.Stop()
-        PluginsRoot._Transfer(self)
+        ConfigTreeRoot._Transfer(self)
         self.AbortTransferTimer.Start(milliseconds=5000, oneShot=True)
     
     def AbortTransfer(self, event):
@@ -1113,11 +1113,11 @@
             
             frame.Hide()
             
-            self.PluginRoot.ResetAppFrame(lpcberemiz_cmd.Log)
-            if self.PluginRoot.OnlineMode == 0:
-                self.PluginRoot._connector = None
-            
-            self.PluginRoot.KillDebugThread()
+            self.CTR.ResetAppFrame(lpcberemiz_cmd.Log)
+            if self.CTR.OnlineMode == 0:
+                self.CTR._connector = None
+            
+            self.CTR.KillDebugThread()
             self.KillLocalRuntime()
             
             self.SaveLastState()
@@ -1141,7 +1141,7 @@
 
     def RefreshFileMenu(self):
         MenuToolBar = self.Panes["MenuToolBar"]
-        if self.PluginRoot is not None:
+        if self.CTR is not None:
             selected = self.TabsOpened.GetSelection()
             if selected >= 0:
                 graphic_viewer = isinstance(self.TabsOpened.GetPage(selected), Viewer)
@@ -1163,7 +1163,7 @@
                 self.FileMenu.Enable(wx.ID_PRINT, False)
                 MenuToolBar.EnableTool(wx.ID_PRINT, False)
             self.FileMenu.Enable(wx.ID_PAGE_SETUP, True)
-            project_modified = self.PluginRoot.ProjectTestModified()
+            project_modified = self.CTR.ProjectTestModified()
             self.FileMenu.Enable(wx.ID_SAVE, project_modified)
             MenuToolBar.EnableTool(wx.ID_SAVE, project_modified)
             self.FileMenu.Enable(wx.ID_PROPERTIES, True)
@@ -1181,15 +1181,15 @@
         self.Freeze()
         self.ClearSizer(self.PLCParamsSizer)
         
-        if self.PluginRoot is not None:    
+        if self.CTR is not None:    
             plcwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1))
-            if self.PluginRoot.PlugTestModified():
+            if self.CTR.PlugTestModified():
                 bkgdclr = CHANGED_TITLE_COLOUR
             else:
                 bkgdclr = TITLE_COLOUR
                 
-            if self.PluginRoot not in self.PluginInfos:
-                self.PluginInfos[self.PluginRoot] = {"right_visible" : False}
+            if self.CTR not in self.ConfNodeInfos:
+                self.ConfNodeInfos[self.CTR] = {"right_visible" : False}
             
             plcwindow.SetBackgroundColour(TITLE_COLOUR)
             plcwindow.Bind(wx.EVT_LEFT_DOWN, self.OnPanelLeftDown)
@@ -1200,7 +1200,7 @@
             
             st = wx.StaticText(plcwindow, -1)
             st.SetFont(wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"]))
-            st.SetLabel(self.PluginRoot.GetProjectName())
+            st.SetLabel(self.CTR.GetProjectName())
             plcwindowsizer.AddWindow(st, 0, border=5, flag=wx.ALL|wx.ALIGN_CENTER)
             
             plcwindowmainsizer = wx.BoxSizer(wx.VERTICAL)
@@ -1209,38 +1209,38 @@
             plcwindowbuttonsizer = wx.BoxSizer(wx.HORIZONTAL)
             plcwindowmainsizer.AddSizer(plcwindowbuttonsizer, 0, border=0, flag=wx.ALIGN_CENTER)
             
-            msizer = self.GenerateMethodButtonSizer(self.PluginRoot, plcwindow, not self.PluginInfos[self.PluginRoot]["right_visible"])
+            msizer = self.GenerateMethodButtonSizer(self.CTR, plcwindow, not self.ConfNodeInfos[self.CTR]["right_visible"])
             plcwindowbuttonsizer.AddSizer(msizer, 0, border=0, flag=wx.GROW)
             
         self.PLCConfigMainSizer.Layout()
         self.RefreshScrollBars()
         self.Thaw()
 
-    def GenerateTreeBranch(self, plugin):
+    def GenerateTreeBranch(self, confnode):
         leftwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1))
-        if plugin.PlugTestModified():
+        if confnode.PlugTestModified():
             bkgdclr=CHANGED_WINDOW_COLOUR
         else:
             bkgdclr=WINDOW_COLOUR
 
         leftwindow.SetBackgroundColour(bkgdclr)
         
-        if plugin not in self.PluginInfos:
-            self.PluginInfos[plugin] = {"expanded" : False, "left_visible" : False, "right_visible" : False}
-            
-        self.PluginInfos[plugin]["children"] = plugin.IECSortedChilds()
-        plugin_infos = plugin.GetVariableLocationTree()
-        plugin_locations = []
-        if len(self.PluginInfos[plugin]["children"]) == 0:
-            plugin_locations = plugin_infos["children"]
-            if not self.PluginInfos[plugin].has_key("locations_infos"):
-                self.PluginInfos[plugin]["locations_infos"] = {"root": {"expanded" : False}}
-            
-            self.PluginInfos[plugin]["locations_infos"]["root"]["left"] = None
-            self.PluginInfos[plugin]["locations_infos"]["root"]["right"] = None
-            self.PluginInfos[plugin]["locations_infos"]["root"]["children"] = []
-        
-        self.PluginTreeSizer.AddWindow(leftwindow, 0, border=0, flag=wx.GROW)
+        if confnode not in self.ConfNodeInfos:
+            self.ConfNodeInfos[confnode] = {"expanded" : False, "left_visible" : False, "right_visible" : False}
+            
+        self.ConfNodeInfos[confnode]["children"] = confnode.IECSortedChilds()
+        confnode_infos = confnode.GetVariableLocationTree()
+        confnode_locations = []
+        if len(self.ConfNodeInfos[confnode]["children"]) == 0:
+            confnode_locations = confnode_infos["children"]
+            if not self.ConfNodeInfos[confnode].has_key("locations_infos"):
+                self.ConfNodeInfos[confnode]["locations_infos"] = {"root": {"expanded" : False}}
+            
+            self.ConfNodeInfos[confnode]["locations_infos"]["root"]["left"] = None
+            self.ConfNodeInfos[confnode]["locations_infos"]["root"]["right"] = None
+            self.ConfNodeInfos[confnode]["locations_infos"]["root"]["children"] = []
+        
+        self.ConfNodeTreeSizer.AddWindow(leftwindow, 0, border=0, flag=wx.GROW)
         
         leftwindowvsizer = wx.BoxSizer(wx.VERTICAL)
         leftwindow.SetSizer(leftwindowvsizer)
@@ -1248,11 +1248,11 @@
         leftwindowsizer = wx.BoxSizer(wx.HORIZONTAL)
         leftwindowvsizer.AddSizer(leftwindowsizer, 0, border=0, flag=0)
         
-        self.GenerateEnableButton(leftwindow, leftwindowsizer, plugin)
+        self.GenerateEnableButton(leftwindow, leftwindowsizer, confnode)
         
         st = wx.StaticText(leftwindow, -1)
         st.SetFont(wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"]))
-        st.SetLabel(plugin.GetFullIEC_Channel())
+        st.SetLabel(confnode.GetFullIEC_Channel())
         leftwindowsizer.AddWindow(st, 0, border=5, flag=wx.RIGHT)
         
         expandbutton_id = wx.NewId()
@@ -1264,27 +1264,27 @@
         expandbutton.SetUseFocusIndicator(False)
         expandbutton.SetBitmapSelected(wx.Bitmap(Bpath( 'images', 'minus.png')))
             
-        if len(self.PluginInfos[plugin]["children"]) > 0:
-            expandbutton.SetToggle(self.PluginInfos[plugin]["expanded"])
+        if len(self.ConfNodeInfos[confnode]["children"]) > 0:
+            expandbutton.SetToggle(self.ConfNodeInfos[confnode]["expanded"])
             def togglebutton(event):
                 if expandbutton.GetToggle():
-                    self.ExpandPlugin(plugin)
+                    self.ExpandConfNode(confnode)
                 else:
-                    self.CollapsePlugin(plugin)
-                self.PluginInfos[plugin]["expanded"] = expandbutton.GetToggle()
+                    self.CollapseConfNode(confnode)
+                self.ConfNodeInfos[confnode]["expanded"] = expandbutton.GetToggle()
                 self.PLCConfigMainSizer.Layout()
                 self.RefreshScrollBars()
                 event.Skip()
             expandbutton.Bind(wx.EVT_BUTTON, togglebutton, id=expandbutton_id)
-        elif len(plugin_locations) > 0:
-            locations_infos = self.PluginInfos[plugin]["locations_infos"]
+        elif len(confnode_locations) > 0:
+            locations_infos = self.ConfNodeInfos[confnode]["locations_infos"]
             expandbutton.SetToggle(locations_infos["root"]["expanded"])
             def togglebutton(event):
                 if expandbutton.GetToggle():
                     self.ExpandLocation(locations_infos, "root")
                 else:
                     self.CollapseLocation(locations_infos, "root")
-                self.PluginInfos[plugin]["expanded"] = expandbutton.GetToggle()
+                self.ConfNodeInfos[confnode]["expanded"] = expandbutton.GetToggle()
                 locations_infos["root"]["expanded"] = expandbutton.GetToggle()
                 self.PLCConfigMainSizer.Layout()
                 self.RefreshScrollBars()
@@ -1295,9 +1295,9 @@
         leftwindowsizer.AddWindow(expandbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL)
         
         sb = wx.StaticBitmap(leftwindow, -1)
-        icon = plugin_infos.get("icon", None)
+        icon = confnode_infos.get("icon", None)
         if icon is None:
-            icon_bitmap = self.LocationImageList.GetBitmap(self.LocationImageDict[plugin_infos["type"]])
+            icon_bitmap = self.LocationImageList.GetBitmap(self.LocationImageDict[confnode_infos["type"]])
         else: 
             icon_bitmap = wx.Bitmap(icon)
         sb.SetBitmap(icon_bitmap)
@@ -1306,21 +1306,21 @@
         st_id = wx.NewId()
         st = wx.StaticText(leftwindow, st_id, size=wx.DefaultSize, style=wx.NO_BORDER)
         st.SetFont(wx.Font(faces["size"] * 0.75, wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"]))
-        st.SetLabel(plugin.MandatoryParams[1].getName())
+        st.SetLabel(confnode.MandatoryParams[1].getName())
         leftwindowsizer.AddWindow(st, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL)
         
-        rightwindow = self.GenerateParamsPanel(plugin, bkgdclr)
-        self.PluginTreeSizer.AddWindow(rightwindow, 0, border=0, flag=wx.GROW)
-
-        self.PluginInfos[plugin]["left"] = leftwindow
-        self.PluginInfos[plugin]["right"] = rightwindow
-        for child in self.PluginInfos[plugin]["children"]:
+        rightwindow = self.GenerateParamsPanel(confnode, bkgdclr)
+        self.ConfNodeTreeSizer.AddWindow(rightwindow, 0, border=0, flag=wx.GROW)
+
+        self.ConfNodeInfos[confnode]["left"] = leftwindow
+        self.ConfNodeInfos[confnode]["right"] = rightwindow
+        for child in self.ConfNodeInfos[confnode]["children"]:
             self.GenerateTreeBranch(child)
-            if not self.PluginInfos[child]["expanded"]:
-                self.CollapsePlugin(child)
-        
-        if len(plugin_locations) > 0:
-            locations_infos = self.PluginInfos[plugin]["locations_infos"]
+            if not self.ConfNodeInfos[child]["expanded"]:
+                self.CollapseConfNode(child)
+        
+        if len(confnode_locations) > 0:
+            locations_infos = self.ConfNodeInfos[confnode]["locations_infos"]
             treectrl = wx.TreeCtrl(self.PLCConfig, -1, size=wx.DefaultSize, 
                                    style=wx.TR_HAS_BUTTONS|wx.TR_SINGLE|wx.NO_BORDER|wx.TR_HIDE_ROOT|wx.TR_NO_LINES|wx.TR_LINES_AT_ROOT)
             treectrl.SetImageList(self.LocationImageList)
@@ -1329,15 +1329,15 @@
             treectrl.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.GenerateLocationExpandCollapseFunction(locations_infos, False))
             
             treectrl.AddRoot("")
-            self.PluginTreeSizer.AddWindow(treectrl, 0, border=0, flag=0)
+            self.ConfNodeTreeSizer.AddWindow(treectrl, 0, border=0, flag=0)
             
             rightwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1))
             rightwindow.SetBackgroundColour(wx.WHITE)
-            self.PluginTreeSizer.AddWindow(rightwindow, 0, border=0, flag=wx.GROW)
+            self.ConfNodeTreeSizer.AddWindow(rightwindow, 0, border=0, flag=wx.GROW)
             
             locations_infos["root"]["left"] = treectrl
             locations_infos["root"]["right"] = rightwindow
-            for location in plugin_locations:
+            for location in confnode_locations:
                 locations_infos["root"]["children"].append("root.%s" % location["name"])
                 self.GenerateLocationTreeBranch(treectrl, treectrl.GetRootItem(), locations_infos, "root", location)
             if locations_infos["root"]["expanded"]:
@@ -1416,11 +1416,11 @@
         prompt = ""
         RefreshTimer = None
         
-        def __init__(self, PluginRoot, Log):
+        def __init__(self, CTR, Log):
             cmd.Cmd.__init__(self, stdin=Log, stdout=Log)
             self.use_rawinput = False
             self.Log = Log
-            self.PluginRoot = PluginRoot
+            self.CTR = CTR
             
         def RestartTimer(self):
             if self.RefreshTimer is not None:
@@ -1440,7 +1440,7 @@
         def Show(self):
             global frame
             if frame is not None:
-                self.PluginRoot.SetAppFrame(frame, frame.Log)
+                self.CTR.SetAppFrame(frame, frame.Log)
                 frame.Show()
                 frame.Raise()
         
@@ -1454,77 +1454,77 @@
         def Close(self):
             global frame
             
-            self.PluginRoot.ResetAppFrame(self.Log)
+            self.CTR.ResetAppFrame(self.Log)
             if frame is not None:
                 frame.Hide()
         
         def Compile(self):
-            self.PluginRoot._Build()
+            self.CTR._Build()
         
         def SetProjectProperties(self, projectname, productname, productversion, companyname):
-            properties = self.PluginRoot.GetProjectProperties()
+            properties = self.CTR.GetProjectProperties()
             new_properties = properties.copy()
             new_properties["projectName"] = projectname
             new_properties["productName"] = productname
             new_properties["productVersion"] = productversion
             new_properties["companyName"] = companyname
             if new_properties != properties:
-                self.PluginRoot.SetProjectProperties(properties=new_properties, buffer=False)
+                self.CTR.SetProjectProperties(properties=new_properties, buffer=False)
                 self.RestartTimer()
         
         def SetOnlineMode(self, mode, path=None):
-            self.PluginRoot.SetOnlineMode(mode, path)
+            self.CTR.SetOnlineMode(mode, path)
             self.RestartTimer()
         
         def AddBus(self, iec_channel, name, icon=None):
-            for child in self.PluginRoot.IterChilds():
+            for child in self.CTR.IterChilds():
                 if child.BaseParams.getName() == name:
                     return "Error: A bus named %s already exists\n" % name
                 elif child.BaseParams.getIEC_Channel() == iec_channel:
                     return "Error: A bus with IEC_channel %d already exists\n" % iec_channel
-            bus = self.PluginRoot.PlugAddChild(name, "LPCBus", iec_channel)
+            bus = self.CTR.PlugAddChild(name, "LPCBus", iec_channel)
             if bus is None:
                 return "Error: Unable to create bus\n"
             bus.SetIcon(icon)
             self.RestartTimer()
         
         def RenameBus(self, iec_channel, name):
-            bus = self.PluginRoot.GetChildByIECLocation((iec_channel,))
+            bus = self.CTR.GetChildByIECLocation((iec_channel,))
             if bus is None:
                 return "Error: No bus found\n"
-            for child in self.PluginRoot.IterChilds():
+            for child in self.CTR.IterChilds():
                 if child != bus and child.BaseParams.getName() == name:
                     return "Error: A bus named %s already exists\n" % name
             bus.BaseParams.setName(name)
             self.RestartTimer()
         
         def ChangeBusIECChannel(self, old_iec_channel, new_iec_channel):
-            bus = self.PluginRoot.GetChildByIECLocation((old_iec_channel,))
+            bus = self.CTR.GetChildByIECLocation((old_iec_channel,))
             if bus is None:
                 return "Error: No bus found\n"
-            for child in self.PluginRoot.IterChilds():
+            for child in self.CTR.IterChilds():
                 if child != bus and child.BaseParams.getIEC_Channel() == new_iec_channel:
                     return "Error: A bus with IEC_channel %d already exists\n" % new_iec_channel
             if wx.GetApp() is None:
-                self.PluginRoot.UpdateProjectVariableLocation(str(old_iec_channel), 
+                self.CTR.UpdateProjectVariableLocation(str(old_iec_channel), 
                                                               str(new_iec_channel))
             else:
-                self.PluginRoot.UpdateProjectVariableLocation(
+                self.CTR.UpdateProjectVariableLocation(
                              str(old_iec_channel), 
                              str(new_iec_channel))
             bus.BaseParams.setIEC_Channel(new_iec_channel)
             self.RestartTimer()
         
         def RemoveBus(self, iec_channel):
-            bus = self.PluginRoot.GetChildByIECLocation((iec_channel,))
+            bus = self.CTR.GetChildByIECLocation((iec_channel,))
             if bus is None:
                 return "Error: No bus found\n"
-            self.PluginRoot.RemoveProjectVariableByFilter(str(iec_channel))
-            self.PluginRoot.PluggedChilds["LPCBus"].remove(bus)
+            self.CTR.RemoveProjectVariableByFilter(str(iec_channel))
+            self.CTR.PluggedChilds["LPCBus"].remove(bus)
             self.RestartTimer()
     
         def AddModule(self, parent, iec_channel, name, icode, icon=None):
-            module = self.PluginRoot.GetChildByIECLocation(parent)
+            module = self.CTR.GetChildByIECLocation(parent)
             if module is None:
                 return "Error: No parent found\n"
             for child in _GetModuleChildren(module):
@@ -1541,11 +1541,11 @@
             self.RestartTimer()
     
         def RenameModule(self, iec_location, name):
-            module = self.PluginRoot.GetChildByIECLocation(iec_location)
+            module = self.CTR.GetChildByIECLocation(iec_location)
             if module is None:
                 return "Error: No module found\n"
-            parent = self.PluginRoot.GetChildByIECLocation(iec_location[:-1])
-            if parent is self.PluginRoot:
+            parent = self.CTR.GetChildByIECLocation(iec_location[:-1])
+            if parent is self.CTR:
                 return "Error: No module found\n"
             if module["name"] != name:
                 for child in _GetModuleChildren(parent):
@@ -1555,39 +1555,39 @@
             self.RestartTimer()
     
         def ChangeModuleIECChannel(self, old_iec_location, new_iec_channel):
-            module = self.PluginRoot.GetChildByIECLocation(old_iec_location)
+            module = self.CTR.GetChildByIECLocation(old_iec_location)
             if module is None:
                 return "Error: No module found\n"
-            parent = self.PluginRoot.GetChildByIECLocation(old_iec_location[:-1])
-            if parent is self.PluginRoot:
+            parent = self.CTR.GetChildByIECLocation(old_iec_location[:-1])
+            if parent is self.CTR:
                 return "Error: No module found\n"
             if module["IEC_Channel"] != new_iec_channel:
                 for child in _GetModuleChildren(parent):
                     if child["IEC_Channel"] == new_iec_channel:
                         return "Error: A module with IEC_channel %d already exists\n" % new_iec_channel
-            self.PluginRoot.UpdateProjectVariableLocation(".".join(map(str, old_iec_location)), ".".join(map(str, old_iec_location[:1] + (new_iec_channel,))))
+            self.CTR.UpdateProjectVariableLocation(".".join(map(str, old_iec_location)), ".".join(map(str, old_iec_location[:1] + (new_iec_channel,))))
             module["IEC_Channel"] = new_iec_channel
             self.RestartTimer()
         
         def ChangeModuleInitCode(self, iec_location, icode):
-            module = self.PluginRoot.GetChildByIECLocation(iec_location)
+            module = self.CTR.GetChildByIECLocation(iec_location)
             if module is None:
                 return "Error: No module found\n"
             module["init"] = icode
         
         def RemoveModule(self, parent, iec_channel):
-            module = self.PluginRoot.GetChildByIECLocation(parent)
+            module = self.CTR.GetChildByIECLocation(parent)
             if module is None:
                 return "Error: No parent found\n"
             child = _GetModuleBySomething(module, "IEC_Channel", (iec_channel,))
             if child is None:
                 return "Error: No module found\n"
-            self.PluginRoot.RemoveProjectVariableByFilter(".".join(map(str, parent + (iec_channel,))))
+            self.CTR.RemoveProjectVariableByFilter(".".join(map(str, parent + (iec_channel,))))
             _RemoveModuleChild(module, child)
             self.RestartTimer()
         
         def StartGroup(self, parent, name, icon=None):
-            module = self.PluginRoot.GetChildByIECLocation(parent)
+            module = self.CTR.GetChildByIECLocation(parent)
             if module is None:
                 return "Error: No parent found\n"
             for child in module["children"]:
@@ -1600,7 +1600,7 @@
             self.RestartTimer()
     
         def AddVariable(self, parent, location, name, direction, type, rcode, pcode, description=""):
-            module = self.PluginRoot.GetChildByIECLocation(parent)
+            module = self.CTR.GetChildByIECLocation(parent)
             if module is None:
                 return "Error: No parent found\n"
             for child in _GetModuleChildren(module):
@@ -1618,7 +1618,7 @@
             self.RestartTimer()
 
         def ChangeVariableParams(self, parent, location, new_name, new_direction, new_type, new_rcode, new_pcode, new_description=None):
-            module = self.PluginRoot.GetChildByIECLocation(parent)
+            module = self.CTR.GetChildByIECLocation(parent)
             if module is None:
                 return "Error: No parent found\n"
             variable = None
@@ -1630,7 +1630,7 @@
             if variable is None:
                 return "Error: No variable found\n"
             if variable["name"] != new_name:
-                self.PluginRoot.UpdateProjectVariableName(variable["name"], new_name)
+                self.CTR.UpdateProjectVariableName(variable["name"], new_name)
                 variable["name"] = new_name
             variable["type"] = LOCATION_TYPES[new_direction]
             variable["IEC_type"] = new_type
@@ -1641,15 +1641,15 @@
             self.RestartTimer()
     
         def RemoveVariable(self, parent, location, direction):
-            module = self.PluginRoot.GetChildByIECLocation(parent)
+            module = self.CTR.GetChildByIECLocation(parent)
             if module is None:
                 return "Error: No parent found\n"
             child = _GetModuleVariable(module, location, direction)
             if child is None:
                 return "Error: No variable found\n"
-            size = LOCATION_SIZES[self.PluginRoot.GetBaseType(child["IEC_type"])]
+            size = LOCATION_SIZES[self.CTR.GetBaseType(child["IEC_type"])]
             address = "%" + LOCATION_DIRS[child["type"]] + size + ".".join(map(str, parent + location))
-            self.PluginRoot.RemoveProjectVariableByAddress(address)
+            self.CTR.RemoveProjectVariableByAddress(address)
             _RemoveModuleChild(module, child)
             self.RestartTimer()
         
@@ -1714,7 +1714,7 @@
                 return res
         return CmdFunction
 
-    def CmdThreadProc(PluginRoot, Log):
+    def CmdThreadProc(CTR, Log):
         global lpcberemiz_cmd
         for function, (arg_types, opt) in {"Exit": ([], 0),
                                            "Show": ([], 0),
@@ -1738,26 +1738,26 @@
                                            "RemoveVariable": ([location, location], 0)}.iteritems():
             
             setattr(LPCBeremiz_Cmd, "do_%s" % function, GetCmdFunction(function, arg_types, opt))
-        lpcberemiz_cmd = LPCBeremiz_Cmd(PluginRoot, Log)
+        lpcberemiz_cmd = LPCBeremiz_Cmd(CTR, Log)
         lpcberemiz_cmd.cmdloop()
 
     Log = StdoutPseudoFile(port)
 
-    PluginRoot = LPCPluginsRoot(None, Log, buildpath)
+    CTR = LPCConfigTreeRoot(None, Log, buildpath)
     if projectOpen is not None and os.path.isdir(projectOpen):
-        result = PluginRoot.LoadProject(projectOpen)
+        result = CTR.LoadProject(projectOpen)
         if result:
             Log.write("Error: Invalid project directory", result)
     else:
         Log.write("Error: No such file or directory")
     
-    cmd_thread=Thread(target=CmdThreadProc, args=[PluginRoot, Log])
+    cmd_thread=Thread(target=CmdThreadProc, args=[CTR, Log])
     cmd_thread.start()
 
     # Install a exception handle for bug reports
     AddExceptHook(os.getcwd(),__version__)
     
-    frame = LPCBeremiz(None, plugin_root=PluginRoot, debug=True)
+    frame = LPCBeremiz(None, ctr=CTR, debug=True)
     
     app.MainLoop()