Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
authorEdouard Tisserant
Wed, 25 Feb 2015 13:59:01 +0100
changeset 1451 94e620cbd9de
parent 1450 44bf0ba866e9
child 1452 7a2b344de8cf
Added Ronan Bignaux (genesis) patch to use wxversion. Fixed side effects with sys.path. Other cosmetic fixes about path included.
Beremiz.py
Beremiz_service.py
PLCOpenEditor.py
ProjectController.py
editors/ConfTreeNodeEditor.py
--- a/Beremiz.py	Tue Feb 24 11:50:54 2015 +0100
+++ b/Beremiz.py	Wed Feb 25 13:59:01 2015 +0100
@@ -25,20 +25,23 @@
 
 updateinfo_url = None
 
-import os, sys, getopt, wx
+import os, sys, getopt
 import __builtin__
-from wx.lib.agw.advancedsplash import AdvancedSplash
 import tempfile
 import shutil
 import random
 import time
 from types import ListType
 
-CWD = os.path.split(os.path.realpath(__file__))[0]
-
+beremiz_dir = os.path.dirname(os.path.realpath(__file__))
+
+import wxversion
+wxversion.select('2.8')
+import wx
+from wx.lib.agw.advancedsplash import AdvancedSplash
 
 def Bpath(*args):
-    return os.path.join(CWD,*args)
+    return os.path.join(beremiz_dir,*args)
 
 if __name__ == '__main__':
     def usage():
@@ -112,7 +115,7 @@
         wx.Yield()
 
     from util.misc import InstallLocalRessources
-    InstallLocalRessources(CWD)
+    InstallLocalRessources(beremiz_dir)
 
     # Load extensions
     for extfilename in extensions:
--- a/Beremiz_service.py	Tue Feb 24 11:50:54 2015 +0100
+++ b/Beremiz_service.py	Wed Feb 25 13:59:01 2015 +0100
@@ -96,7 +96,7 @@
         usage()
         sys.exit()
 
-CWD = os.path.split(os.path.realpath(__file__))[0]
+beremiz_dir = os.path.dirname(os.path.realpath(__file__))
 
 if len(argv) > 1:
     usage()
@@ -114,25 +114,28 @@
 
 if enablewx:
     try:
-        import wx, re
-        from threading import Thread, currentThread
-        from types import *
+        import wxversion
+        wxversion.select('2.8')
+        import wx
         havewx = True
     except:
         print "Wx unavailable !"
         havewx = False
 
     if havewx:
+        import re
+        from threading import Thread, currentThread
+        from types import *
         app=wx.App(redirect=False)
 
         # Import module for internationalization
         import gettext
 
         def Bpath(*args):
-            return os.path.join(CWD,*args)
+            return os.path.join(beremiz_dir,*args)
 
         # Get folder containing translation files
-        localedir = os.path.join(CWD,"locale")
+        localedir = os.path.join(beremiz_dir,"locale")
         # Get the default language
         langid = wx.LANGUAGE_DEFAULT
         # Define translation domain (name of translation files)
--- a/PLCOpenEditor.py	Tue Feb 24 11:50:54 2015 +0100
+++ b/PLCOpenEditor.py	Wed Feb 25 13:59:01 2015 +0100
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 #This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
-#based on the plcopen standard. 
+#based on the plcopen standard.
 #
 #Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
 #
@@ -25,12 +25,12 @@
 import wx
 import os, sys, platform, time, traceback, getopt
 
-CWD = os.path.split(os.path.realpath(__file__))[0]
+beremiz_dir = os.path.dirname(os.path.realpath(__file__))
 
 __version__ = "$Revision: 1.130 $"
 
 if __name__ == '__main__':
-    # Usage message displayed when help request or when error detected in 
+    # Usage message displayed when help request or when error detected in
     # command line
     def usage():
         print "\nUsage of PLCOpenEditor.py :"
@@ -43,13 +43,13 @@
         # print help information and exit:
         usage()
         sys.exit(2)
-    
+
     # Extract if help has been requested
     for o, a in opts:
         if o in ("-h", "--help"):
             usage()
             sys.exit()
-    
+
     # Extract the optional filename to open
     fileOpen = None
     if len(args) > 1:
@@ -57,13 +57,13 @@
         sys.exit()
     elif len(args) == 1:
         fileOpen = args[0]
-    
+
     # Create wxApp (Need to create App before internationalization because of
-    # Windows) 
+    # Windows)
     app = wx.PySimpleApp()
 
     from util.misc import InstallLocalRessources
-    InstallLocalRessources(CWD)
+    InstallLocalRessources(beremiz_dir)
 
 from docutil import *
 from IDEFrame import IDEFrame, AppendMenu
@@ -78,7 +78,7 @@
 #-------------------------------------------------------------------------------
 
 # Define PLCOpenEditor FileMenu extra items id
-[ID_PLCOPENEDITORFILEMENUGENERATE, 
+[ID_PLCOPENEDITORFILEMENUGENERATE,
 ] = [wx.NewId() for _init_coll_FileMenu_Items in range(1)]
 
 class PLCOpenEditor(IDEFrame):
@@ -120,7 +120,7 @@
         parent.AppendSeparator()
         AppendMenu(parent, help='', id=wx.ID_EXIT,
               kind=wx.ITEM_NORMAL, text=_(u'Quit') + '\tCTRL+Q')
-        
+
         self.Bind(wx.EVT_MENU, self.OnNewProjectMenu, id=wx.ID_NEW)
         self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu, id=wx.ID_OPEN)
         self.Bind(wx.EVT_MENU, self.OnCloseTabMenu, id=wx.ID_CLOSE)
@@ -134,15 +134,15 @@
         self.Bind(wx.EVT_MENU, self.OnPrintMenu, id=wx.ID_PRINT)
         self.Bind(wx.EVT_MENU, self.OnPropertiesMenu, id=wx.ID_PROPERTIES)
         self.Bind(wx.EVT_MENU, self.OnQuitMenu, id=wx.ID_EXIT)
-        
+
         self.AddToMenuToolBar([(wx.ID_NEW, "new", _(u'New'), None),
                                (wx.ID_OPEN, "open", _(u'Open'), None),
                                (wx.ID_SAVE, "save", _(u'Save'), None),
                                (wx.ID_SAVEAS, "saveas", _(u'Save As...'), None),
                                (wx.ID_PRINT, "print", _(u'Print'), None)])
-            
+
     def _init_coll_HelpMenu_Items(self, parent):
-        AppendMenu(parent, help='', id=wx.ID_HELP, 
+        AppendMenu(parent, help='', id=wx.ID_HELP,
             kind=wx.ITEM_NORMAL, text=_(u'PLCOpenEditor') + '\tF1')
         #AppendMenu(parent, help='', id=wx.ID_HELP_CONTENTS,
         #      kind=wx.ITEM_NORMAL, text=u'PLCOpen\tF2')
@@ -161,9 +161,9 @@
     #  @param debug The filepath to open if no controler defined (default: False).
     def __init__(self, parent, fileOpen = None):
         IDEFrame.__init__(self, parent)
-        
+
         result = None
-        
+
         # Open the filepath if defined
         if fileOpen is not None:
             fileOpen = DecodeFileSystemPath(fileOpen, False)
@@ -176,14 +176,14 @@
                 self.ProjectTree.Enable(True)
                 self.PouInstanceVariablesPanel.SetController(controler)
                 self._Refresh(PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
-        
+
         # Define PLCOpenEditor icon
-        self.SetIcon(wx.Icon(os.path.join(CWD, "images", "poe.ico"),wx.BITMAP_TYPE_ICO))
+        self.SetIcon(wx.Icon(os.path.join(beremiz_dir, "images", "poe.ico"),wx.BITMAP_TYPE_ICO))
 
         self.Bind(wx.EVT_CLOSE, self.OnCloseFrame)
-        
+
         self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU)
-        
+
         if result is not None:
             self.ShowErrorMessage(
                 _("PLC syntax error at line %d:\n%s") % result)
@@ -191,9 +191,9 @@
     def OnCloseFrame(self, event):
         if self.Controler is None or self.CheckSaveBeforeClosing(_("Close Application")):
             self.AUIManager.UnInit()
-            
+
             self.SaveLastState()
-            
+
             event.Skip()
         else:
             event.Veto()
@@ -266,7 +266,7 @@
             self.Controler.CreateNewProject(properties)
             self.LibraryPanel.SetController(self.Controler)
             self.ProjectTree.Enable(True)
-            self._Refresh(TITLE, FILEMENU, EDITMENU, PROJECTTREE, POUINSTANCEVARIABLESPANEL, 
+            self._Refresh(TITLE, FILEMENU, EDITMENU, PROJECTTREE, POUINSTANCEVARIABLESPANEL,
                           LIBRARYTREE)
 
     def OnOpenProjectMenu(self, event):
@@ -279,9 +279,9 @@
             directory = os.path.dirname(filepath)
         else:
             directory = os.getcwd()
-        
+
         result = None
-        
+
         dialog = wx.FileDialog(self, _("Choose a file"), directory, "",  _("PLCOpen files (*.xml)|*.xml|All files|*.*"), wx.OPEN)
         if dialog.ShowModal() == wx.ID_OK:
             filepath = dialog.GetPath()
@@ -296,11 +296,11 @@
                 self._Refresh(PROJECTTREE, LIBRARYTREE)
             self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU)
         dialog.Destroy()
-        
+
         if result is not None:
             self.ShowErrorMessage(
                 _("PLC syntax error at line %d:\n%s") % result)
-    
+
     def OnCloseProjectMenu(self, event):
         if not self.CheckSaveBeforeClosing():
             return
@@ -338,12 +338,12 @@
 
     def OnPLCOpenEditorMenu(self, event):
         wx.MessageBox(_("No documentation available.\nComing soon."))
-        
+
     def OnPLCOpenMenu(self, event):
-        open_pdf(os.path.join(CWD, "plcopen", "TC6_XML_V101.pdf"))
-    
+        open_pdf(os.path.join(beremiz_dir, "plcopen", "TC6_XML_V101.pdf"))
+
     def OnAboutMenu(self, event):
-        OpenHtmlFrame(self,_("About PLCOpenEditor"), os.path.join(CWD, "doc", "plcopen_about.html"), wx.Size(350, 350))
+        OpenHtmlFrame(self,_("About PLCOpenEditor"), os.path.join(beremiz_dir, "doc", "plcopen_about.html"), wx.Size(350, 350))
 
     def SaveProject(self):
         result = self.Controler.SaveXMLFile()
@@ -351,7 +351,7 @@
             self.SaveProjectAs()
         else:
             self._Refresh(TITLE, FILEMENU, PAGETITLES)
-        
+
     def SaveProjectAs(self):
         filepath = self.Controler.GetFilePath()
         if filepath != "":
@@ -386,13 +386,13 @@
             trcbck += _("file : ") + str(line[0][len(os.getcwd()):]) + _(",   ")
         trcbck += _("line : ") + str(line[1]) + _(",   ") + _("function : ") + str(line[2])
         trcbck_lst.append(trcbck)
-        
+
     # Allow clicking....
     cap = wx.Window_GetCapture()
     if cap:
         cap.ReleaseMouse()
 
-    dlg = wx.SingleChoiceDialog(None, 
+    dlg = wx.SingleChoiceDialog(None,
         _("""
 An error has occurred.
 
@@ -403,7 +403,7 @@
 
 Error:
 """) +
-        str(e_type) + _(" : ") + str(e_value), 
+        str(e_type) + _(" : ") + str(e_value),
         _("Error"),
         trcbck_lst)
     try:
@@ -431,7 +431,7 @@
 ignored_exceptions = [] # a problem with a line in a module is only reported once per session
 
 def AddExceptHook(path, app_version='[No version]'):#, ignored_exceptions=[]):
-    
+
     def handle_exception(e_type, e_value, e_traceback):
         traceback.print_exception(e_type, e_value, e_traceback) # this is very helpful when there's an exception in the rest of this func
         last_tb = get_last_traceback(e_traceback)
@@ -461,7 +461,7 @@
                     info['locals'] = format_namespace(exception_locals)
                     if 'self' in exception_locals:
                         info['self'] = format_namespace(exception_locals['self'].__dict__)
-                
+
                 output = open(path+os.sep+"bug_report_"+info['date'].replace(':','-').replace(' ','_')+".txt",'w')
                 lst = info.keys()
                 lst.sort()
@@ -473,12 +473,12 @@
 
 if __name__ == '__main__':
     wx.InitAllImageHandlers()
-    
+
     # Install a exception handle for bug reports
     AddExceptHook(os.getcwd(),__version__)
-    
+
     frame = PLCOpenEditor(None, fileOpen=fileOpen)
 
     frame.Show()
     app.MainLoop()
-    
+
--- a/ProjectController.py	Tue Feb 24 11:50:54 2015 +0100
+++ b/ProjectController.py	Wed Feb 25 13:59:01 2015 +0100
@@ -32,7 +32,7 @@
 from targets.typemapping import UnpackDebugBuffer
 from ConfigTreeNode import ConfigTreeNode, XSDSchemaErrorMessage
 
-base_folder = os.path.split(sys.path[0])[0]
+base_folder = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
 
 MATIEC_ERROR_MODEL = re.compile(".*\.st:(\d+)-(\d+)\.\.(\d+)-(\d+): (?:error)|(?:warning) : (.*)$")
 
@@ -608,17 +608,21 @@
     def _Compile_ST_to_SoftPLC(self):
         self.logger.write(_("Compiling IEC Program into C code...\n"))
         buildpath = self._getBuildPath()
-
-        # Now compile IEC code into many C files
-        # files are listed to stdout, and errors to stderr.
-        status, result, err_result = ProcessLogger(
-               self.logger,
-               "\"%s\" -f -l -p -I \"%s\" -T \"%s\" \"%s\""%(
+        buildcmd = "\"%s\" -f -l -p -I \"%s\" -T \"%s\" \"%s\""%(
                          self.iec2c_path,
                          self.ieclib_path,
                          buildpath,
-                         self._getIECcodepath()),
-               no_stdout=True, no_stderr=True).spin()
+                         self._getIECcodepath())
+
+        try:
+            # Invoke compiler. Output files are listed to stdout, errors to stderr
+            status, result, err_result = ProcessLogger(self.logger, buildcmd,
+                no_stdout=True, no_stderr=True).spin()
+        except Exception,e:
+            self.logger.write_error(buildcmd + "\n")
+            self.logger.write_error(repr(e) + "\n")
+            return False
+
         if status:
             # Failed !
 
--- a/editors/ConfTreeNodeEditor.py	Tue Feb 24 11:50:54 2015 +0100
+++ b/editors/ConfTreeNodeEditor.py	Wed Feb 25 13:59:01 2015 +0100
@@ -29,11 +29,6 @@
 
 SCROLLBAR_UNIT = 10
 
-CWD = os.path.split(os.path.realpath(__file__))[0]
-
-def Bpath(*args):
-    return os.path.join(CWD,*args)
-
 class GenBitmapTextButton(wx.lib.buttons.GenBitmapTextButton):
     def _GetLabelSize(self):
         """ used internally """
@@ -88,82 +83,82 @@
 
 
 class GenStaticBitmap(wx.StaticBitmap):
-    """ Customized GenStaticBitmap, fix transparency redraw bug on wx2.8/win32, 
+    """ 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"):
-        
+
         bitmap = GetBitmap(bitmapname)
         if bitmap is None:
             bitmap = wx.EmptyBitmap(0, 0)
-        
-        wx.StaticBitmap.__init__(self, parent, ID, 
+
+        wx.StaticBitmap.__init__(self, parent, ID,
                  bitmap,
                  pos, size,
                  style,
                  name)
 
 class ConfTreeNodeEditor(EditorPanel):
-    
+
     SHOW_BASE_PARAMS = True
     SHOW_PARAMS = True
     CONFNODEEDITOR_TABS = []
-    
+
     def _init_Editor(self, parent):
         tabs_num = len(self.CONFNODEEDITOR_TABS)
         if self.SHOW_PARAMS and len(self.Controler.GetParamsAttributes()) > 0:
             tabs_num += 1
-            
+
         if tabs_num > 1 or self.SHOW_BASE_PARAMS:
-            self.Editor = wx.Panel(parent, 
+            self.Editor = wx.Panel(parent,
                 style=wx.SUNKEN_BORDER|wx.SP_3D)
-            
+
             self.MainSizer = wx.BoxSizer(wx.VERTICAL)
-            
+
             if self.SHOW_BASE_PARAMS:
                 baseparamseditor_sizer = wx.BoxSizer(wx.HORIZONTAL)
-                self.MainSizer.AddSizer(baseparamseditor_sizer, border=5, 
+                self.MainSizer.AddSizer(baseparamseditor_sizer, border=5,
                       flag=wx.GROW|wx.ALL)
-                
+
                 self.FullIECChannel = wx.StaticText(self.Editor, -1)
                 self.FullIECChannel.SetFont(
-                    wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, 
+                    wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL,
                             wx.BOLD, faceName = faces["helv"]))
-                baseparamseditor_sizer.AddWindow(self.FullIECChannel, 
+                baseparamseditor_sizer.AddWindow(self.FullIECChannel,
                       flag=wx.ALIGN_CENTER_VERTICAL)
-                
+
                 updownsizer = wx.BoxSizer(wx.VERTICAL)
-                baseparamseditor_sizer.AddSizer(updownsizer, border=5, 
+                baseparamseditor_sizer.AddSizer(updownsizer, border=5,
                       flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL)
-                
-                self.IECCUpButton = wx.lib.buttons.GenBitmapTextButton(self.Editor, 
+
+                self.IECCUpButton = wx.lib.buttons.GenBitmapTextButton(self.Editor,
                       bitmap=GetBitmap('IECCDown'), size=wx.Size(16, 16), style=wx.NO_BORDER)
-                self.IECCUpButton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(1), 
+                self.IECCUpButton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(1),
                       self.IECCUpButton)
                 updownsizer.AddWindow(self.IECCUpButton, flag=wx.ALIGN_LEFT)
-                
-                self.IECCDownButton = wx.lib.buttons.GenBitmapButton(self.Editor, 
+
+                self.IECCDownButton = wx.lib.buttons.GenBitmapButton(self.Editor,
                       bitmap=GetBitmap('IECCUp'), size=wx.Size(16, 16), style=wx.NO_BORDER)
-                self.IECCDownButton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(-1), 
+                self.IECCDownButton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(-1),
                       self.IECCDownButton)
                 updownsizer.AddWindow(self.IECCDownButton, flag=wx.ALIGN_LEFT)
-                
-                self.ConfNodeName = wx.TextCtrl(self.Editor, 
+
+                self.ConfNodeName = wx.TextCtrl(self.Editor,
                       size=wx.Size(150, 25))
                 self.ConfNodeName.SetFont(
-                    wx.Font(faces["size"] * 0.75, wx.DEFAULT, wx.NORMAL, 
+                    wx.Font(faces["size"] * 0.75, wx.DEFAULT, wx.NORMAL,
                             wx.BOLD, faceName = faces["helv"]))
-                self.ConfNodeName.Bind(wx.EVT_TEXT, 
-                      self.GetTextCtrlCallBackFunction(self.ConfNodeName, "BaseParams.Name", True), 
+                self.ConfNodeName.Bind(wx.EVT_TEXT,
+                      self.GetTextCtrlCallBackFunction(self.ConfNodeName, "BaseParams.Name", True),
                       self.ConfNodeName)
-                baseparamseditor_sizer.AddWindow(self.ConfNodeName, border=5, 
+                baseparamseditor_sizer.AddWindow(self.ConfNodeName, border=5,
                       flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL)
-                
+
                 buttons_sizer = self.GenerateMethodButtonSizer()
                 baseparamseditor_sizer.AddSizer(buttons_sizer, flag=wx.ALIGN_CENTER)
-            
+
             if tabs_num > 1:
                 self.ConfNodeNoteBook = wx.Notebook(self.Editor)
                 parent = self.ConfNodeNoteBook
@@ -171,12 +166,12 @@
             else:
                 parent = self.Editor
                 self.ConfNodeNoteBook = None
-            
+
             self.Editor.SetSizer(self.MainSizer)
         else:
             self.ConfNodeNoteBook = None
             self.Editor = None
-        
+
         for title, create_func_name in self.CONFNODEEDITOR_TABS:
             editor = getattr(self, create_func_name)(parent)
             if self.ConfNodeNoteBook is not None:
@@ -185,28 +180,28 @@
                 self.MainSizer.AddWindow(editor, 1, flag=wx.GROW)
             else:
                 self.Editor = editor
-        
+
         if self.SHOW_PARAMS and len(self.Controler.GetParamsAttributes()) > 0:
-            
+
             panel_style = wx.TAB_TRAVERSAL|wx.HSCROLL|wx.VSCROLL
             if self.ConfNodeNoteBook is None and parent != self.Editor:
                 panel_style |= wx.SUNKEN_BORDER
-            self.ParamsEditor = wx.ScrolledWindow(parent, 
+            self.ParamsEditor = wx.ScrolledWindow(parent,
                   style=panel_style)
             self.ParamsEditor.Bind(wx.EVT_SIZE, self.OnParamsEditorResize)
             self.ParamsEditor.Bind(wx.EVT_SCROLLWIN, self.OnParamsEditorScroll)
-            
+
             self.ParamsEditorSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=1, vgap=5)
             self.ParamsEditorSizer.AddGrowableCol(0)
             self.ParamsEditorSizer.AddGrowableRow(0)
             self.ParamsEditor.SetSizer(self.ParamsEditorSizer)
-            
+
             self.ConfNodeParamsSizer = wx.BoxSizer(wx.VERTICAL)
-            self.ParamsEditorSizer.AddSizer(self.ConfNodeParamsSizer, border=5, 
+            self.ParamsEditorSizer.AddSizer(self.ConfNodeParamsSizer, border=5,
                   flag=wx.LEFT|wx.RIGHT|wx.BOTTOM)
-            
+
             self.RefreshConfNodeParamsSizer()
-        
+
             if self.ConfNodeNoteBook is not None:
                 self.ConfNodeNoteBook.AddPage(self.ParamsEditor, _("Config"))
             elif self.SHOW_BASE_PARAMS:
@@ -215,40 +210,40 @@
                 self.Editor = self.ParamsEditor
         else:
             self.ParamsEditor = None
-    
+
     def __init__(self, parent, controler, window, tagname=""):
         EditorPanel.__init__(self, parent, tagname, window, controler)
-        
+
         icon_name = self.Controler.GetIconName()
         if icon_name is not None:
             self.SetIcon(GetBitmap(icon_name))
         else:
             self.SetIcon(GetBitmap("Extension"))
-        
+
     def __del__(self):
         self.Controler.OnCloseEditor(self)
-    
+
     def GetTagName(self):
         return self.Controler.CTNFullName()
-    
+
     def GetTitle(self):
         fullname = self.Controler.CTNFullName()
         if self.Controler.CTNTestModified():
             return "~%s~" % fullname
         return fullname
-    
+
     def HasNoModel(self):
         return False
-    
+
     def GetBufferState(self):
         return False, False
-    
+
     def Undo(self):
         pass
-    
+
     def Redo(self):
         pass
-    
+
     def RefreshView(self):
         EditorPanel.RefreshView(self)
         if self.SHOW_BASE_PARAMS:
@@ -257,33 +252,33 @@
         if self.ParamsEditor is not None:
             self.RefreshConfNodeParamsSizer()
             self.RefreshScrollbars()
-    
+
     def RefreshIECChannelControlsState(self):
         self.FullIECChannel.SetLabel(self.Controler.GetFullIEC_Channel())
         self.IECCDownButton.Enable(self.Controler.BaseParams.getIEC_Channel() > 0)
         self.MainSizer.Layout()
-    
+
     def RefreshConfNodeParamsSizer(self):
         self.Freeze()
         self.ConfNodeParamsSizer.Clear(True)
-        
+
         confnode_infos = self.Controler.GetParamsAttributes()
         if len(confnode_infos) > 0:
             self.GenerateSizerElements(self.ConfNodeParamsSizer, confnode_infos, None, False)
-        
+
         self.ParamsEditorSizer.Layout()
         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, underline=True, faceName = faces["helv"])
-        
+
         msizer = wx.BoxSizer(wx.HORIZONTAL)
-        
+
         for confnode_method in self.Controler.ConfNodeMethods:
             if "method" in confnode_method and confnode_method.get("shown",True):
                 button = GenBitmapTextButton(self.Editor,
-                    bitmap=GetBitmap(confnode_method.get("bitmap", "Unknown")), 
+                    bitmap=GetBitmap(confnode_method.get("bitmap", "Unknown")),
                     label=confnode_method["name"], style=wx.NO_BORDER)
                 button.SetFont(normal_bt_font)
                 button.SetToolTipString(confnode_method["tooltip"])
@@ -305,7 +300,7 @@
                     button.Disable()
                 msizer.AddWindow(button, flag=wx.ALIGN_CENTER)
         return msizer
-    
+
     def GenerateSizerElements(self, sizer, elements, path, clean = True):
         if clean:
             sizer.Clear(True)
@@ -321,44 +316,44 @@
                 label = _(name)
                 if value is not None:
                     label += " - %s" % _(value)
-                staticbox = wx.StaticBox(self.ParamsEditor, 
+                staticbox = wx.StaticBox(self.ParamsEditor,
                       label=_(label), size=wx.Size(10, 0))
                 staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL)
                 if first:
-                    sizer.AddSizer(staticboxsizer, border=5, 
+                    sizer.AddSizer(staticboxsizer, border=5,
                           flag=wx.GROW|wx.TOP|wx.BOTTOM)
                 else:
-                    sizer.AddSizer(staticboxsizer, border=5, 
+                    sizer.AddSizer(staticboxsizer, border=5,
                           flag=wx.GROW|wx.BOTTOM)
-                self.GenerateSizerElements(staticboxsizer, 
-                                           element_infos["children"], 
+                self.GenerateSizerElements(staticboxsizer,
+                                           element_infos["children"],
                                            element_path)
             else:
                 boxsizer = wx.FlexGridSizer(cols=3, rows=1)
                 boxsizer.AddGrowableCol(1)
                 if first:
-                    sizer.AddSizer(boxsizer, border=5, 
+                    sizer.AddSizer(boxsizer, border=5,
                           flag=wx.GROW|wx.ALL)
                 else:
-                    sizer.AddSizer(boxsizer, border=5, 
+                    sizer.AddSizer(boxsizer, border=5,
                           flag=wx.GROW|wx.LEFT|wx.RIGHT|wx.BOTTOM)
-                
+
                 staticbitmap = GenStaticBitmap(ID=-1, bitmapname=element_infos["name"],
                     name="%s_bitmap"%element_infos["name"], parent=self.ParamsEditor,
                     pos=wx.Point(0, 0), size=wx.Size(24, 24), style=0)
                 boxsizer.AddWindow(staticbitmap, border=5, flag=wx.RIGHT)
-                
-                statictext = wx.StaticText(self.ParamsEditor, 
+
+                statictext = wx.StaticText(self.ParamsEditor,
                       label="%s:"%_(element_infos["name"]))
-                boxsizer.AddWindow(statictext, border=5, 
+                boxsizer.AddWindow(statictext, border=5,
                       flag=wx.ALIGN_CENTER_VERTICAL|wx.RIGHT)
-                
+
                 if isinstance(element_infos["type"], types.ListType):
                     if isinstance(element_infos["value"], types.TupleType):
                         browse_boxsizer = wx.BoxSizer(wx.HORIZONTAL)
                         boxsizer.AddSizer(browse_boxsizer)
-                        
-                        textctrl = wx.TextCtrl(self.ParamsEditor, 
+
+                        textctrl = wx.TextCtrl(self.ParamsEditor,
                               size=wx.Size(275, -1), style=wx.TE_READONLY)
                         if element_infos["value"] is not None:
                             textctrl.SetValue(element_infos["value"][0])
@@ -366,19 +361,19 @@
                         else:
                             value_infos = None
                         browse_boxsizer.AddWindow(textctrl)
-                        
-                        button = wx.Button(self.ParamsEditor, 
+
+                        button = wx.Button(self.ParamsEditor,
                               label="...", size=wx.Size(25, 25))
                         browse_boxsizer.AddWindow(button)
-                        button.Bind(wx.EVT_BUTTON, 
-                                    self.GetBrowseCallBackFunction(element_infos["name"], textctrl, element_infos["type"], 
-                                                                   value_infos, element_path), 
+                        button.Bind(wx.EVT_BUTTON,
+                                    self.GetBrowseCallBackFunction(element_infos["name"], textctrl, element_infos["type"],
+                                                                   value_infos, element_path),
                                     button)
                     else:
-                        combobox = wx.ComboBox(self.ParamsEditor, 
+                        combobox = wx.ComboBox(self.ParamsEditor,
                               size=wx.Size(300, -1), style=wx.CB_READONLY)
                         boxsizer.AddWindow(combobox)
-                        
+
                         if element_infos["use"] == "optional":
                             combobox.Append("")
                         if len(element_infos["type"]) > 0 and isinstance(element_infos["type"][0], types.TupleType):
@@ -386,8 +381,8 @@
                                 combobox.Append(choice)
                             name = element_infos["name"]
                             value = element_infos["value"]
-                        
-                            staticbox = wx.StaticBox(self.ParamsEditor, 
+
+                            staticbox = wx.StaticBox(self.ParamsEditor,
                                   label="%s - %s"%(_(name), _(value)), size=wx.Size(10, 0))
                             staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL)
                             sizer.AddSizer(staticboxsizer, border=5, flag=wx.GROW|wx.BOTTOM)
@@ -402,7 +397,7 @@
                         else:
                             combobox.SetStringSelection(element_infos["value"])
                         combobox.Bind(wx.EVT_COMBOBOX, callback, combobox)
-                
+
                 elif isinstance(element_infos["type"], types.DictType):
                     scmin = -(2**31)
                     scmax = 2**31-1
@@ -410,50 +405,50 @@
                         scmin = element_infos["type"]["min"]
                     if "max" in element_infos["type"]:
                         scmax = element_infos["type"]["max"]
-                    spinctrl = wx.SpinCtrl(self.ParamsEditor, 
+                    spinctrl = wx.SpinCtrl(self.ParamsEditor,
                           size=wx.Size(300, -1), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT)
                     spinctrl.SetRange(scmin, scmax)
                     boxsizer.AddWindow(spinctrl)
                     if element_infos["value"] is not None:
                         spinctrl.SetValue(element_infos["value"])
-                    spinctrl.Bind(wx.EVT_SPINCTRL, 
+                    spinctrl.Bind(wx.EVT_SPINCTRL,
                                   self.GetTextCtrlCallBackFunction(spinctrl, element_path),
                                   spinctrl)
-                
+
                 else:
                     if element_infos["type"] == "boolean":
                         checkbox = wx.CheckBox(self.ParamsEditor, size=wx.Size(17, 25))
                         boxsizer.AddWindow(checkbox)
                         if element_infos["value"] is not None:
                             checkbox.SetValue(element_infos["value"])
-                        checkbox.Bind(wx.EVT_CHECKBOX, 
-                                      self.GetCheckBoxCallBackFunction(checkbox, element_path), 
+                        checkbox.Bind(wx.EVT_CHECKBOX,
+                                      self.GetCheckBoxCallBackFunction(checkbox, element_path),
                                       checkbox)
-                    
+
                     elif element_infos["type"] in ["unsignedLong", "long","integer"]:
                         if element_infos["type"].startswith("unsigned"):
                             scmin = 0
                         else:
                             scmin = -(2**31)
                         scmax = 2**31-1
-                        spinctrl = wx.SpinCtrl(self.ParamsEditor, 
+                        spinctrl = wx.SpinCtrl(self.ParamsEditor,
                               size=wx.Size(300, -1), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT)
                         spinctrl.SetRange(scmin, scmax)
                         boxsizer.AddWindow(spinctrl)
                         if element_infos["value"] is not None:
                             spinctrl.SetValue(element_infos["value"])
-                        spinctrl.Bind(wx.EVT_SPINCTRL, 
-                                      self.GetTextCtrlCallBackFunction(spinctrl, element_path), 
+                        spinctrl.Bind(wx.EVT_SPINCTRL,
+                                      self.GetTextCtrlCallBackFunction(spinctrl, element_path),
                                       spinctrl)
-                    
+
                     else:
                         choices = self.ParentWindow.GetConfigEntry(element_path, [""])
-                        textctrl = TextCtrlAutoComplete(name=element_infos["name"], 
-                                                        parent=self.ParamsEditor, 
-                                                        choices=choices, 
+                        textctrl = TextCtrlAutoComplete(name=element_infos["name"],
+                                                        parent=self.ParamsEditor,
+                                                        choices=choices,
                                                         element_path=element_path,
                                                         size=wx.Size(300, -1))
-                        
+
                         boxsizer.AddWindow(textctrl)
                         if element_infos["value"] is not None:
                             textctrl.ChangeValue(str(element_infos["value"]))
@@ -461,8 +456,8 @@
                         textctrl.Bind(wx.EVT_TEXT_ENTER, callback)
                         textctrl.Bind(wx.EVT_KILL_FOCUS, callback)
             first = False
-    
-    
+
+
     def GetItemChannelChangedFunction(self, dir):
         def OnConfNodeTreeItemChannelChanged(event):
             confnode_IECChannel = self.Controler.BaseParams.getIEC_Channel()
@@ -471,28 +466,28 @@
             wx.CallAfter(self.ParentWindow._Refresh, TITLE, FILEMENU, PROJECTTREE)
             event.Skip()
         return OnConfNodeTreeItemChannelChanged
-    
+
     def SetConfNodeParamsAttribute(self, *args, **kwargs):
         res, StructChanged = self.Controler.SetParamsAttribute(*args, **kwargs)
         if StructChanged and self.ParamsEditor is not None:
             wx.CallAfter(self.RefreshConfNodeParamsSizer)
         wx.CallAfter(self.ParentWindow._Refresh, TITLE, FILEMENU)
         return res
-    
+
     def GetButtonCallBackFunction(self, method, push=False):
         """ Generate the callbackfunc for a given confnode method"""
         def OnButtonClick(event):
-            # Disable button to prevent re-entrant call 
+            # Disable button to prevent re-entrant call
             event.GetEventObject().Disable()
             # Call
             getattr(self.Controler,method)()
-            # Re-enable button 
+            # Re-enable button
             event.GetEventObject().Enable()
-            
+
             if not push:
                 event.Skip()
         return OnButtonClick
-    
+
     def GetChoiceCallBackFunction(self, choicectrl, path):
         def OnChoiceChanged(event):
             res = self.SetConfNodeParamsAttribute(path, choicectrl.GetStringSelection())
@@ -501,14 +496,14 @@
             choicectrl.SetStringSelection(res)
             event.Skip()
         return OnChoiceChanged
-    
+
     def GetChoiceContentCallBackFunction(self, choicectrl, staticboxsizer, path):
         def OnChoiceContentChanged(event):
             res = self.SetConfNodeParamsAttribute(path, choicectrl.GetStringSelection())
             wx.CallAfter(self.RefreshConfNodeParamsSizer)
             event.Skip()
         return OnChoiceContentChanged
-    
+
     def GetTextCtrlCallBackFunction(self, textctrl, path, refresh=False):
         def OnTextCtrlChanged(event):
             res = self.SetConfNodeParamsAttribute(path, textctrl.GetValue())
@@ -522,14 +517,14 @@
                 wx.CallAfter(self.ParentWindow.SelectProjectTreeItem, self.GetTagName())
             event.Skip()
         return OnTextCtrlChanged
-    
+
     def GetCheckBoxCallBackFunction(self, chkbx, path):
         def OnCheckBoxChanged(event):
             res = self.SetConfNodeParamsAttribute(path, chkbx.IsChecked())
             chkbx.SetValue(res)
             event.Skip()
         return OnCheckBoxChanged
-    
+
     def GetBrowseCallBackFunction(self, name, textctrl, library, value_infos, path):
         infos = [value_infos]
         def OnBrowseButton(event):
@@ -541,7 +536,7 @@
             dialog.Destroy()
             event.Skip()
         return OnBrowseButton
-    
+
     def RefreshScrollbars(self):
         self.ParamsEditor.GetBestSize()
         xstart, ystart = self.ParamsEditor.GetViewStart()
@@ -550,17 +545,17 @@
         posx = max(0, min(xstart, (maxx - window_size[0]) / SCROLLBAR_UNIT))
         posy = max(0, min(ystart, (maxy - window_size[1]) / SCROLLBAR_UNIT))
         self.ParamsEditor.Scroll(posx, posy)
-        self.ParamsEditor.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT, 
+        self.ParamsEditor.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT,
                 maxx / SCROLLBAR_UNIT, maxy / SCROLLBAR_UNIT, posx, posy)
-    
+
     def OnParamsEditorResize(self, event):
         self.RefreshScrollbars()
         event.Skip()
-    
+
     def OnParamsEditorScroll(self, event):
         control = self.ParamsEditor.FindFocus()
         if isinstance(control, TextCtrlAutoComplete):
             control.DismissListBox()
             self.Refresh()
         event.Skip()
-    
+