Adding support using plcopeneditor bitmap library for icon request
authorlaurent
Mon, 25 Jun 2012 20:05:29 +0200
changeset 781 cdc6393705ce
parent 780 70632f4612a1
child 782 6f0e10085df9
Adding support using plcopeneditor bitmap library for icon request
Beremiz.py
ConfTreeNodeEditor.py
ConfigTreeNode.py
ProjectController.py
c_ext/c_ext.py
canfestival/canfestival.py
py_ext/py_ext.py
util/misc.py
--- a/Beremiz.py	Mon Jun 25 12:13:58 2012 +0200
+++ b/Beremiz.py	Mon Jun 25 20:05:29 2012 +0200
@@ -85,7 +85,7 @@
     wx.InitAllImageHandlers()
     
     # popup splash
-    bmp = wx.Image(Bpath("images","splash.png")).ConvertToBitmap()
+    bmp = wx.Image(Bpath("images", "splash.png")).ConvertToBitmap()
     #splash=AdvancedSplash(None, bitmap=bmp, style=wx.SPLASH_CENTRE_ON_SCREEN, timeout=4000)
     splash=AdvancedSplash(None, bitmap=bmp)
     wx.Yield()
@@ -145,10 +145,15 @@
 sys.path.append(base_folder)
 sys.path.append(os.path.join(base_folder, "plcopeneditor"))
 
+from utils.BitmapLibrary import AddBitmapFolder, GetBitmap
+AddBitmapFolder(os.path.join(CWD, "images"))
+
 if __name__ == '__main__':
     # Load extensions
     for extfilename in extensions:
-        sys.path.append(os.path.split(os.path.realpath(extfilename))[0])
+        extension_folder = os.path.split(os.path.realpath(extfilename))[0]
+        sys.path.append(extension_folder)
+        AddBitmapFolder(os.path.join(extension_folder, "images"))
         execfile(extfilename, locals())
 
 import wx.lib.buttons, wx.lib.statbmp
@@ -175,12 +180,8 @@
                  style = 0,
                  name = "genstatbmp"):
         
-        bitmappath = Bpath( "images", bitmapname)
-        if os.path.isfile(bitmappath):
-            bitmap = wx.Bitmap(bitmappath)
-        else:
-            bitmap = None
-        wx.lib.statbmp.GenStaticBitmap.__init__(self, parent, ID, bitmap,
+        wx.lib.statbmp.GenStaticBitmap.__init__(self, parent, ID, 
+                 GetBitmap(bitmapname),
                  pos, size,
                  style,
                  name)
@@ -335,11 +336,11 @@
         self.Bind(wx.EVT_MENU, self.OnPrintMenu, id=wx.ID_PRINT)
         self.Bind(wx.EVT_MENU, self.OnQuitMenu, id=wx.ID_EXIT)
     
-        self.AddToMenuToolBar([(wx.ID_NEW, "new.png", _(u'New'), None),
-                               (wx.ID_OPEN, "open.png", _(u'Open'), None),
-                               (wx.ID_SAVE, "save.png", _(u'Save'), None),
-                               (wx.ID_SAVEAS, "saveas.png", _(u'Save As...'), None),
-                               (wx.ID_PRINT, "print.png", _(u'Print'), None)])
+        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_AddMenu_Items(self, parent):
         IDEFrame._init_coll_AddMenu_Items(self, parent, False)
@@ -424,15 +425,15 @@
             ("VAR_INPUT",     LOCATION_VAR_INPUT),
             ("VAR_OUTPUT",    LOCATION_VAR_OUTPUT),
             ("VAR_LOCAL",     LOCATION_VAR_MEMORY)]:
-            self.LocationImageDict[itemtype]=self.LocationImageList.Add(wx.Bitmap(os.path.join(base_folder, "plcopeneditor", 'Images', '%s.png'%imgname)))
+            self.LocationImageDict[itemtype] = self.LocationImageList.Add(GetBitmap(imgname))
         
         # Icons for other items
         for imgname, itemtype in [
             ("Extension", ITEM_CONFNODE)]:
-            self.TreeImageDict[itemtype]=self.TreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'images', '%s.png'%imgname)))
+            self.TreeImageDict[itemtype] = self.TreeImageList.Add(GetBitmap(imgname))
         
         # Add beremiz's icon in top left corner of the frame
-        self.SetIcon(wx.Icon(Bpath( "images", "brz.ico"), wx.BITMAP_TYPE_ICO))
+        self.SetIcon(wx.Icon(Bpath("images", "brz.ico"), wx.BITMAP_TYPE_ICO))
         
         if ctr is None and projectOpen is None and self.Config.HasEntry("currenteditedproject"):
             projectOpen = str(self.Config.Read("currenteditedproject"))
@@ -444,7 +445,7 @@
             self.Controler = self.CTR
             result = self.CTR.LoadProject(projectOpen, buildpath)
             if not result:
-                self.LibraryPanel.SetControler(self.Controler)
+                self.LibraryPanel.SetController(self.Controler)
                 self.ProjectTree.Enable(True)
                 self.PouInstanceVariablesPanel.SetController(self.Controler)
                 self.RefreshConfigRecentProjects(os.path.abspath(projectOpen))
@@ -456,7 +457,7 @@
             self.CTR = ctr
             self.Controler = ctr
             if ctr is not None:
-                self.LibraryPanel.SetControler(self.Controler)
+                self.LibraryPanel.SetController(self.Controler)
                 self.ProjectTree.Enable(True)
                 self.PouInstanceVariablesPanel.SetController(self.Controler)
                 self._Refresh(PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
@@ -697,7 +698,7 @@
                 if "method" in confnode_method and confnode_method.get("shown",True):
                     id = wx.NewId()
                     StatusToolBar.AddSimpleTool(id, 
-                        wx.Bitmap(Bpath("images", "%s.png"%confnode_method.get("bitmap", "Unknown"))), 
+                        GetBitmap(confnode_method.get("bitmap", "Unknown")), 
                         confnode_method["tooltip"])
                     self.Bind(wx.EVT_MENU, self.GetMenuCallBackFunction(confnode_method["method"]), id=id)
             
@@ -721,10 +722,11 @@
             if panel != self.LastPanelSelected:
                 for i in xrange(self.EditMenuSize, self.EditMenu.GetMenuItemCount()):
                     item = self.EditMenu.FindItemByPosition(self.EditMenuSize)
-                    if item.IsSeparator():
-                        self.EditMenu.RemoveItem(item)
-                    else:
-                        self.EditMenu.Delete(item.GetId())
+                    if item is not None:
+                        if item.IsSeparator():
+                            self.EditMenu.RemoveItem(item)
+                        else:
+                            self.EditMenu.Delete(item.GetId())
                 self.LastPanelSelected = panel
                 if panel is not None:
                     items = panel.GetConfNodeMenuItems()
@@ -738,7 +740,11 @@
         else:
             for i in xrange(self.EditMenuSize, self.EditMenu.GetMenuItemCount()):
                 item = self.EditMenu.FindItemByPosition(i)
-                self.EditMenu.Delete(item.GetId())
+                if item is not None:
+                    if item.IsSeparator():
+                        self.EditMenu.RemoveItem(item)
+                    else:
+                        self.EditMenu.Delete(item.GetId())
             self.LastPanelSelected = None
         self.MenuBar.UpdateMenus()
     
@@ -807,7 +813,7 @@
             if not result:
                 self.CTR = ctr
                 self.Controler = self.CTR
-                self.LibraryPanel.SetControler(self.Controler)
+                self.LibraryPanel.SetController(self.Controler)
                 self.ProjectTree.Enable(True)
                 self.PouInstanceVariablesPanel.SetController(self.Controler)
                 self.RefreshConfigRecentProjects(projectpath)
@@ -844,7 +850,7 @@
             self.Controler = self.CTR
             result = self.CTR.LoadProject(projectpath)
             if not result:
-                self.LibraryPanel.SetControler(self.Controler)
+                self.LibraryPanel.SetController(self.Controler)
                 self.ProjectTree.Enable(True)
                 self.PouInstanceVariablesPanel.SetController(self.Controler)
                 self.RefreshConfigRecentProjects(projectpath)
@@ -872,11 +878,13 @@
     def OnSaveProjectMenu(self, event):
         if self.CTR is not None:
             self.CTR.SaveProject()
+            self.RefreshAll()
             self._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES)
     
     def OnSaveProjectAsMenu(self, event):
         if self.CTR is not None:
             self.CTR.SaveProjectAs()
+            self.RefreshAll()
             self._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES)
         event.Skip()
     
--- a/ConfTreeNodeEditor.py	Mon Jun 25 12:13:58 2012 +0200
+++ b/ConfTreeNodeEditor.py	Mon Jun 25 20:05:29 2012 +0200
@@ -9,9 +9,9 @@
 
 from PLCOpenEditor import TITLE, FILEMENU, PROJECTTREE, PAGETITLES
 
-from util.misc import opjimg
 from util.TextCtrlAutoComplete import TextCtrlAutoComplete
 from util.BrowseValuesLibraryDialog import BrowseValuesLibraryDialog
+from utils.BitmapLibrary import GetBitmap
 
 if wx.Platform == '__WXMSW__':
     faces = { 'times': 'Times New Roman',
@@ -124,12 +124,8 @@
                  style = 0,
                  name = "genstatbmp"):
         
-        bitmappath = Bpath( "images", bitmapname)
-        if os.path.isfile(bitmappath):
-            bitmap = wx.Bitmap(bitmappath)
-        else:
-            bitmap = None
-        wx.lib.statbmp.GenStaticBitmap.__init__(self, parent, ID, bitmap,
+        wx.lib.statbmp.GenStaticBitmap.__init__(self, parent, ID, 
+                 GetBitmap(bitmapname),
                  pos, size,
                  style,
                  name)
@@ -151,15 +147,15 @@
     def _init_ConfNodeEditor(self, prnt):
         self.ConfNodeEditor = None
     
-    def _init_Editor(self, prnt):
-        self.Editor = wx.SplitterWindow(id=self.ID, name='EditorSplitter', parent=prnt,
-              size=wx.Size(0, 0), style=wx.SUNKEN_BORDER|wx.SP_3D)
+    def _init_Editor(self, parent):
+        self.Editor = wx.SplitterWindow(parent,
+              style=wx.SUNKEN_BORDER|wx.SP_3D)
         self.SetNeedUpdating(True)
         self.SetMinimumPaneSize(1)
         
         if self.SHOW_PARAMS:
-            self.ParamsEditor = wx.ScrolledWindow(self.Editor, -1, size=wx.Size(-1, -1),
-                            style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER|wx.HSCROLL|wx.VSCROLL)
+            self.ParamsEditor = wx.ScrolledWindow(self.Editor, 
+                  style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER|wx.HSCROLL|wx.VSCROLL)
             self.ParamsEditor.SetBackgroundColour(WINDOW_COLOUR)
             self.ParamsEditor.Bind(wx.EVT_SIZE, self.OnWindowResize)
             self.ParamsEditor.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
@@ -175,51 +171,45 @@
                 self.ParamsEditor.SetSizer(self.ParamsEditorSizer)
                 
                 baseparamseditor_sizer = wx.BoxSizer(wx.HORIZONTAL)
-                self.ParamsEditorSizer.AddSizer(baseparamseditor_sizer, 0, border=5, 
-                                                flag=wx.GROW|wx.LEFT|wx.RIGHT|wx.TOP)
+                self.ParamsEditorSizer.AddSizer(baseparamseditor_sizer, border=5, 
+                      flag=wx.GROW|wx.LEFT|wx.RIGHT|wx.TOP)
                 
                 self.FullIECChannel = wx.StaticText(self.ParamsEditor, -1)
                 self.FullIECChannel.SetFont(
                     wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, 
                             wx.BOLD, faceName = faces["helv"]))
-                baseparamseditor_sizer.AddWindow(self.FullIECChannel, 0, border=0, flag=wx.ALIGN_CENTER_VERTICAL)
+                baseparamseditor_sizer.AddWindow(self.FullIECChannel, 
+                      flag=wx.ALIGN_CENTER_VERTICAL)
                 
                 updownsizer = wx.BoxSizer(wx.VERTICAL)
-                baseparamseditor_sizer.AddSizer(updownsizer, 0, border=5, 
-                                            flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL)
-                
-                ieccupbutton_id = wx.NewId()
-                self.IECCUpButton = wx.lib.buttons.GenBitmapTextButton(
-                      id=ieccupbutton_id, bitmap=wx.Bitmap(opjimg('IECCDown')),
-                      name='IECUpButton', parent=self.ParamsEditor, pos=wx.Point(0, 0),
-                      size=wx.Size(16, 16), style=wx.NO_BORDER)
+                baseparamseditor_sizer.AddSizer(updownsizer, border=5, 
+                      flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL)
+                
+                self.IECCUpButton = wx.lib.buttons.GenBitmapTextButton(self.ParamsEditor, 
+                      bitmap=GetBitmap('IECCDown'), size=wx.Size(16, 16), style=wx.NO_BORDER)
                 self.IECCUpButton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(1), 
-                                      id=ieccupbutton_id)
-                updownsizer.AddWindow(self.IECCUpButton, 0, border=0, flag=wx.ALIGN_LEFT)
-                
-                ieccdownbutton_id = wx.NewId()
-                self.IECCDownButton = wx.lib.buttons.GenBitmapButton(
-                      id=ieccdownbutton_id, bitmap=wx.Bitmap(opjimg('IECCUp')),
-                      name='IECDownButton', parent=self.ParamsEditor, pos=wx.Point(0, 0),
-                      size=wx.Size(16, 16), style=wx.NO_BORDER)
+                      self.IECCUpButton)
+                updownsizer.AddWindow(self.IECCUpButton, flag=wx.ALIGN_LEFT)
+                
+                self.IECCDownButton = wx.lib.buttons.GenBitmapButton(self.ParamsEditor, 
+                      bitmap=GetBitmap('IECCUp'), size=wx.Size(16, 16), style=wx.NO_BORDER)
                 self.IECCDownButton.Bind(wx.EVT_BUTTON, self.GetItemChannelChangedFunction(-1), 
-                                        id=ieccdownbutton_id)
-                updownsizer.AddWindow(self.IECCDownButton, 0, border=0, flag=wx.ALIGN_LEFT)
-                
-                confnodename_id = wx.NewId()
-                self.ConfNodeName = wx.TextCtrl(
-                      self.ParamsEditor, confnodename_id, 
+                      self.IECCDownButton)
+                updownsizer.AddWindow(self.IECCDownButton, flag=wx.ALIGN_LEFT)
+                
+                self.ConfNodeName = wx.TextCtrl(self.ParamsEditor, 
                       size=wx.Size(150, 25), style=wx.NO_BORDER)
                 self.ConfNodeName.SetFont(
                     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), 
-                    id=confnodename_id)
-                baseparamseditor_sizer.AddWindow(self.ConfNodeName, 0, border=5, flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL)
+                      self.GetTextCtrlCallBackFunction(self.ConfNodeName, "BaseParams.Name", True), 
+                      self.ConfNodeName)
+                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, 0, border=0, flag=wx.ALIGN_CENTER)
+                baseparamseditor_sizer.AddSizer(buttons_sizer, flag=wx.ALIGN_CENTER)
             
             else:
                 self.ParamsEditorSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=1, vgap=5)
@@ -227,8 +217,8 @@
                 self.ParamsEditorSizer.AddGrowableRow(0)
             
             self.ConfNodeParamsSizer = wx.BoxSizer(wx.VERTICAL)
-            self.ParamsEditorSizer.AddSizer(self.ConfNodeParamsSizer, 0, border=5, 
-                                            flag=wx.LEFT|wx.RIGHT|wx.BOTTOM)
+            self.ParamsEditorSizer.AddSizer(self.ConfNodeParamsSizer, border=5, 
+                  flag=wx.LEFT|wx.RIGHT|wx.BOTTOM)
             
             self.RefreshConfNodeParamsSizer()
         else:
@@ -250,11 +240,12 @@
     def __init__(self, parent, controler, window, tagname=""):
         EditorPanel.__init__(self, parent, tagname, window, controler)
         
-        icon_path = self.Controler.GetIconPath()
-        if icon_path is None:
-            icon_path = opjimg("Extension")
-        self.SetIcon(wx.Bitmap(icon_path, wx.BITMAP_TYPE_PNG))
-    
+        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)
     
@@ -313,20 +304,15 @@
         
         for confnode_method in self.Controler.ConfNodeMethods:
             if "method" in confnode_method and confnode_method.get("shown",True):
-                id = wx.NewId()
-                label = confnode_method["name"]
-                bitmap_path = confnode_method.get("bitmap", "Unknown")
-                if os.path.splitext(bitmap_path)[1] == "":
-                    bitmap_path = Bpath("images", "%s.png" % bitmap_path)
-                button = GenBitmapTextButton(id=id, parent=self.ParamsEditor,
-                    bitmap=wx.Bitmap(bitmap_path), label=label, 
-                    name=label, pos=wx.DefaultPosition, style=wx.NO_BORDER)
+                button = GenBitmapTextButton(self.ParamsEditor,
+                    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"])
                 if confnode_method.get("push", False):
                     button.Bind(wx.EVT_LEFT_DOWN, self.GetButtonCallBackFunction(confnode_method["method"], True))
                 else:
-                    button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(confnode_method["method"]), id=id)
+                    button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(confnode_method["method"]), button)
                 # a fancy underline on mouseover
                 def setFontStyle(b, s):
                     def fn(event):
@@ -339,7 +325,7 @@
                 #hack to force size to mini
                 if not confnode_method.get("enabled",True):
                     button.Disable()
-                msizer.AddWindow(button, 0, border=0, flag=wx.ALIGN_CENTER)
+                msizer.AddWindow(button, flag=wx.ALIGN_CENTER)
         return msizer
     
     def GenerateSizerElements(self, sizer, elements, path, clean = True):
@@ -353,57 +339,64 @@
                 element_path = element_infos["name"]
             if element_infos["type"] == "element":
                 label = element_infos["name"]
-                staticbox = wx.StaticBox(id=-1, label=_(label), 
-                    name='%s_staticbox'%element_infos["name"], parent=self.ParamsEditor,
-                    pos=wx.Point(0, 0), size=wx.Size(10, 0), style=0)
+                staticbox = wx.StaticBox(self.ParamsEditor, 
+                      label=_(label), size=wx.Size(10, 0))
                 staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL)
                 if first:
-                    sizer.AddSizer(staticboxsizer, 0, border=5, flag=wx.GROW|wx.TOP|wx.BOTTOM)
+                    sizer.AddSizer(staticboxsizer, border=5, 
+                          flag=wx.GROW|wx.TOP|wx.BOTTOM)
                 else:
-                    sizer.AddSizer(staticboxsizer, 0, border=5, flag=wx.GROW|wx.BOTTOM)
-                self.GenerateSizerElements(staticboxsizer, element_infos["children"], element_path)
+                    sizer.AddSizer(staticboxsizer, border=5, 
+                          flag=wx.GROW|wx.BOTTOM)
+                self.GenerateSizerElements(staticboxsizer, 
+                                           element_infos["children"], 
+                                           element_path)
             else:
                 boxsizer = wx.FlexGridSizer(cols=3, rows=1)
                 boxsizer.AddGrowableCol(1)
                 if first:
-                    sizer.AddSizer(boxsizer, 0, border=5, flag=wx.GROW|wx.ALL)
+                    sizer.AddSizer(boxsizer, border=5, 
+                          flag=wx.GROW|wx.ALL)
                 else:
-                    sizer.AddSizer(boxsizer, 0, border=5, flag=wx.GROW|wx.LEFT|wx.RIGHT|wx.BOTTOM)
-                staticbitmap = GenStaticBitmap(ID=-1, bitmapname="%s.png"%element_infos["name"],
+                    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, 0, border=5, flag=wx.RIGHT)
-                label = element_infos["name"]
-                statictext = wx.StaticText(id=-1, label="%s:"%_(label), 
-                    name="%s_label"%element_infos["name"], parent=self.ParamsEditor, 
-                    pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
-                boxsizer.AddWindow(statictext, 0, border=5, flag=wx.ALIGN_CENTER_VERTICAL|wx.RIGHT)
-                id = wx.NewId()
+                boxsizer.AddWindow(staticbitmap, border=5, flag=wx.RIGHT)
+                
+                statictext = wx.StaticText(self.ParamsEditor, 
+                      label="%s:"%_(element_infos["name"]))
+                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, 0, border=0, flag=0)
+                        boxsizer.AddSizer(browse_boxsizer)
                         
-                        textctrl = wx.TextCtrl(id=id, name=element_infos["name"], parent=self.ParamsEditor, 
-                            pos=wx.Point(0, 0), size=wx.Size(275, 25), style=wx.TE_READONLY)
+                        textctrl = wx.TextCtrl(self.ParamsEditor, 
+                              size=wx.Size(275, 25), style=wx.TE_READONLY)
                         if element_infos["value"] is not None:
                             textctrl.SetValue(element_infos["value"][0])
                             value_infos = element_infos["value"][1]
                         else:
                             value_infos = None
-                        browse_boxsizer.AddWindow(textctrl, 0, border=0, flag=0)
-                        button_id = wx.NewId()
-                        button = wx.Button(id=button_id, name="browse_%s" % element_infos["name"], parent=self.ParamsEditor, 
-                            label="...", pos=wx.Point(0, 0), size=wx.Size(25, 25))
-                        browse_boxsizer.AddWindow(button, 0, border=0, flag=0)
+                        browse_boxsizer.AddWindow(textctrl)
+                        
+                        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), 
-                                    id=button_id)
+                                    button)
                     else:
-                        combobox = wx.ComboBox(id=id, name=element_infos["name"], parent=self.ParamsEditor, 
-                            pos=wx.Point(0, 0), size=wx.Size(300, 28), style=wx.CB_READONLY)
-                        boxsizer.AddWindow(combobox, 0, border=0, flag=0)
+                        combobox = wx.ComboBox(self.ParamsEditor, 
+                              size=wx.Size(300, 28), 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):
@@ -411,11 +404,11 @@
                                 combobox.Append(choice)
                             name = element_infos["name"]
                             value = element_infos["value"]
-                            staticbox = wx.StaticBox(id=-1, label="%s - %s"%(_(name), _(value)), 
-                                name='%s_staticbox'%element_infos["name"], parent=self.ParamsEditor,
-                                pos=wx.Point(0, 0), size=wx.Size(10, 0), style=0)
+                        
+                            staticbox = wx.StaticBox(self.ParamsEditor, 
+                                  label="%s - %s"%(_(name), _(value)), size=wx.Size(10, 0))
                             staticboxsizer = wx.StaticBoxSizer(staticbox, wx.VERTICAL)
-                            sizer.AddSizer(staticboxsizer, 0, border=5, flag=wx.GROW|wx.BOTTOM)
+                            sizer.AddSizer(staticboxsizer, border=5, flag=wx.GROW|wx.BOTTOM)
                             self.GenerateSizerElements(staticboxsizer, element_infos["children"], element_path)
                             callback = self.GetChoiceContentCallBackFunction(combobox, staticboxsizer, element_path)
                         else:
@@ -426,7 +419,8 @@
                             combobox.SetStringSelection("")
                         else:
                             combobox.SetStringSelection(element_infos["value"])
-                        combobox.Bind(wx.EVT_COMBOBOX, callback, id=id)
+                        combobox.Bind(wx.EVT_COMBOBOX, callback, combobox)
+                
                 elif isinstance(element_infos["type"], types.DictType):
                     scmin = -(2**31)
                     scmax = 2**31-1
@@ -434,47 +428,52 @@
                         scmin = element_infos["type"]["min"]
                     if "max" in element_infos["type"]:
                         scmax = element_infos["type"]["max"]
-                    spinctrl = wx.SpinCtrl(id=id, name=element_infos["name"], parent=self.ParamsEditor, 
-                        pos=wx.Point(0, 0), size=wx.Size(300, 25), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT)
-                    spinctrl.SetRange(scmin,scmax)
-                    boxsizer.AddWindow(spinctrl, 0, border=0, flag=0)
+                    spinctrl = wx.SpinCtrl(self.ParamsEditor, 
+                          size=wx.Size(300, 25), 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), id=id)
+                    spinctrl.Bind(wx.EVT_SPINCTRL, 
+                                  self.GetTextCtrlCallBackFunction(spinctrl, element_path),
+                                  spinctrl)
+                
                 else:
                     if element_infos["type"] == "boolean":
-                        checkbox = wx.CheckBox(id=id, name=element_infos["name"], parent=self.ParamsEditor, 
-                            pos=wx.Point(0, 0), size=wx.Size(17, 25), style=0)
-                        boxsizer.AddWindow(checkbox, 0, border=0, flag=0)
+                        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), id=id)
+                        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(id=id, name=element_infos["name"], parent=self.ParamsEditor, 
-                            pos=wx.Point(0, 0), size=wx.Size(300, 25), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT)
+                        spinctrl = wx.SpinCtrl(self.ParamsEditor, 
+                              size=wx.Size(300, 25), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT)
                         spinctrl.SetRange(scmin, scmax)
-                        boxsizer.AddWindow(spinctrl, 0, border=0, flag=0)
+                        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), id=id)
+                        spinctrl.Bind(wx.EVT_SPINCTRL, 
+                                      self.GetTextCtrlCallBackFunction(spinctrl, element_path), 
+                                      spinctrl)
+                    
                     else:
                         choices = self.ParentWindow.GetConfigEntry(element_path, [""])
-                        textctrl = TextCtrlAutoComplete(id=id, 
-                                                                     name=element_infos["name"], 
-                                                                     parent=self.ParamsEditor, 
-                                                                     appframe=self, 
-                                                                     choices=choices, 
-                                                                     element_path=element_path,
-                                                                     pos=wx.Point(0, 0), 
-                                                                     size=wx.Size(300, 25), 
-                                                                     style=0)
+                        textctrl = TextCtrlAutoComplete(name=element_infos["name"], 
+                                                        parent=self.ParamsEditor, 
+                                                        appframe=self, 
+                                                        choices=choices, 
+                                                        element_path=element_path,
+                                                        size=wx.Size(300, 25))
                         
-                        boxsizer.AddWindow(textctrl, 0, border=0, flag=0)
+                        boxsizer.AddWindow(textctrl)
                         if element_infos["value"] is not None:
                             textctrl.ChangeValue(str(element_infos["value"]))
                         textctrl.Bind(wx.EVT_TEXT, self.GetTextCtrlCallBackFunction(textctrl, element_path))
--- a/ConfigTreeNode.py	Mon Jun 25 12:13:58 2012 +0200
+++ b/ConfigTreeNode.py	Mon Jun 25 20:05:29 2012 +0200
@@ -91,7 +91,7 @@
             return parent + "." + self.CTNName()
         return self.BaseParams.getName()
     
-    def GetIconPath(self):
+    def GetIconName(self):
         return None
     
     def CTNTestModified(self):
--- a/ProjectController.py	Mon Jun 25 12:13:58 2012 +0200
+++ b/ProjectController.py	Mon Jun 25 20:05:29 2012 +0200
@@ -14,11 +14,10 @@
 
 import targets
 import connectors
-from util.misc import opjimg, CheckPathPerm, GetClassImporter
+from util.misc import CheckPathPerm, GetClassImporter
 from util.MiniTextControler import MiniTextControler
 from util.ProcessLogger import ProcessLogger
 from PLCControler import PLCControler
-from PLCOpenEditor import CWD
 from TextViewer import TextViewer
 from plcopen.structures import IEC_KEYWORDS
 from targets.typemapping import DebugTypesSize
@@ -182,8 +181,8 @@
     def GetProjectName(self):
         return os.path.split(self.ProjectPath)[1]
     
-    def GetIconPath(self):
-        return os.path.join(CWD, "Images", "PROJECT.png")
+    def GetIconName(self):
+        return "PROJECT"
     
     def GetDefaultTargetName(self):
         if wx.Platform == '__WXMSW__':
@@ -315,7 +314,7 @@
                                      CTNChild.CTNName()), 
                  "type": ITEM_CONFNODE, 
                  "confnode": CTNChild,
-                 "icon": CTNChild.GetIconPath(),
+                 "icon": CTNChild.GetIconName(),
                  "values": self.RecursiveConfNodeInfos(CTNChild)})
         return values
     
--- a/c_ext/c_ext.py	Mon Jun 25 12:13:58 2012 +0200
+++ b/c_ext/c_ext.py	Mon Jun 25 20:05:29 2012 +0200
@@ -4,7 +4,6 @@
 
 from xmlclass import *
 
-from util.misc import opjimg
 from CFileEditor import CFileEditor
 from PLCControler import UndoBuffer, LOCATION_CONFNODE, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT 
 
@@ -44,8 +43,8 @@
             self.CreateCFileBuffer(False)
             self.OnCTNSave()
 
-    def GetIconPath(self):
-        return opjimg("Cfile")
+    def GetIconName(self):
+        return "Cfile"
 
     def CFileName(self):
         return os.path.join(self.CTNPath(), "cfile.xml")
--- a/canfestival/canfestival.py	Mon Jun 25 12:13:58 2012 +0200
+++ b/canfestival/canfestival.py	Mon Jun 25 20:05:29 2012 +0200
@@ -197,7 +197,7 @@
         self.Parent = parent
         self.Fullname = fullname
     
-    def GetIconPath(self):
+    def GetIconName(self):
         return None
     
     def OnCloseEditor(self, view):
--- a/py_ext/py_ext.py	Mon Jun 25 12:13:58 2012 +0200
+++ b/py_ext/py_ext.py	Mon Jun 25 20:05:29 2012 +0200
@@ -1,7 +1,6 @@
 import os
 from POULibrary import POULibrary
 from PythonFileCTNMixin import PythonFileCTNMixin
-from util.misc import opjimg
 
 class PythonLibrary(POULibrary):
     def GetLibraryPath(self):
@@ -31,8 +30,8 @@
 
 class PythonFile(PythonFileCTNMixin):
     
-    def GetIconPath(self):
-        return opjimg("Pyfile")
+    def GetIconName(self):
+        return "Pyfile"
     
     def CTNGenerate_C(self, buildpath, locations):
         current_location = self.GetCurrentLocation()
--- a/util/misc.py	Mon Jun 25 12:13:58 2012 +0200
+++ b/util/misc.py	Mon Jun 25 20:05:29 2012 +0200
@@ -3,10 +3,6 @@
 """
 
 import os,sys
-
-# helper func to get path to images
-def opjimg(imgname):
-    return os.path.join(sys.path[0], "images", imgname+".png")
     
 # helper func to check path write permission
 def CheckPathPerm(path):