SearchResultPanel.py
changeset 714 131ea7f237b9
parent 581 c2d96ea9c14a
child 753 8a70e85f7e12
--- a/SearchResultPanel.py	Fri Jun 15 18:03:25 2012 +0200
+++ b/SearchResultPanel.py	Mon Jun 25 20:03:53 2012 +0200
@@ -25,11 +25,11 @@
 from types import TupleType
 
 import wx
+import wx.lib.buttons
 import wx.lib.agw.customtreectrl as CT
 
 from PLCControler import *
-
-CWD = os.path.split(os.path.realpath(__file__))[0]
+from utils.BitmapLibrary import GetBitmap
 
 def GenerateName(infos):
     if infos[0] in ["input", "output", "value"]:
@@ -100,17 +100,17 @@
         self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnSearchResultsTreeItemActivated,
               id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE)
         
-        self.ResetButton = wx.Button(id=ID_SEARCHRESULTPANELRESETBUTTON, label=_('Reset'),
-              name='ResetButton', parent=self, pos=wx.Point(0, 0),
-              size=wx.DefaultSize, style=0)
-        self.Bind(wx.EVT_BUTTON, self.OnResetButton, 
-              id=ID_SEARCHRESULTPANELRESETBUTTON)
+        self.ResetButton = wx.lib.buttons.GenBitmapButton(self,
+              bitmap=GetBitmap("reset"), size=wx.Size(28, 28), style=wx.NO_BORDER)
+        self.ResetButton.SetToolTipString(_("Reset search result"))
+        self.Bind(wx.EVT_BUTTON, self.OnResetButton, self.ResetButton)
         
         self._init_sizers()
 
     def __init__(self, parent, window):
+        self.ParentWindow = window
+        
         self._init_ctrls(parent)
-        self.ParentWindow = window
         
         # Define Tree item icon list
         self.TreeImageList = wx.ImageList(16, 16)
@@ -128,7 +128,7 @@
             ("ACTION",         "action_block"),
             ("IL",             "IL"),
             ("ST",             "ST")]:
-            self.TreeImageDict[itemtype]=self.TreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%imgname)))
+            self.TreeImageDict[itemtype] = self.TreeImageList.Add(GetBitmap(imgname))
         
         for itemtype in ["function", "functionBlock", "program",
                          "comment", "block", "io_variable",
@@ -136,7 +136,7 @@
                          "step", "transition", "jump", 
                          "var_local", "var_input", 
                          "var_inout", "var_output"]:
-            self.TreeImageDict[itemtype]=self.TreeImageList.Add(wx.Bitmap(os.path.join(CWD, 'Images', '%s.png'%itemtype.upper())))
+            self.TreeImageDict[itemtype] = self.TreeImageList.Add(GetBitmap(itemtype.upper()))
         
         # Assign icon list to TreeCtrl
         self.SearchResultsTree.SetImageList(self.TreeImageList)