Bug with wx 2.8 fixed
authorlbessard
Tue, 13 Nov 2007 17:33:53 +0100
changeset 68 bd25fb3d4315
parent 67 862da764c5b5
child 69 6a331a809986
Bug with wx 2.8 fixed
Beremiz.py
--- a/Beremiz.py	Tue Oct 30 16:49:35 2007 +0100
+++ b/Beremiz.py	Tue Nov 13 17:33:53 2007 +0100
@@ -297,16 +297,27 @@
               name='PluginChilds', parent=self.LeftPanel, pos=wx.Point(0, 0),
               size=wx.Size(-1, -1), style=0)
         
-        self.AddButton = wx.lib.buttons.GenBitmapButton(ID=ID_BEREMIZADDBUTTON, bitmap=wx.Bitmap(os.path.join('images', 'Add.png')),
-              name='AddBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0),
-              size=wx.Size(32, 32), style=wx.NO_BORDER)
+        if wx.VERSION < (2, 8, 0):
+            self.AddButton = wx.lib.buttons.GenBitmapButton(ID=ID_BEREMIZADDBUTTON, bitmap=wx.Bitmap(os.path.join('images', 'Add.png')),
+                  name='AddBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0),
+                  size=wx.Size(32, 32), style=wx.NO_BORDER)
+        else:
+            self.AddButton = wx.lib.buttons.GenBitmapButton(id=ID_BEREMIZADDBUTTON, bitmap=wx.Bitmap(os.path.join('images', 'Add.png')),
+                  name='AddBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0),
+                  size=wx.Size(32, 32), style=wx.NO_BORDER)
+
         self.AddButton.SetToolTipString("Add a plugin of the type selected")
         self.AddButton.Bind(wx.EVT_BUTTON, self.OnAddButton,
               id=ID_BEREMIZADDBUTTON)
         
-        self.DeleteButton = wx.lib.buttons.GenBitmapButton(ID=ID_BEREMIZDELETEBUTTON, bitmap=wx.Bitmap(os.path.join('images', 'Delete.png')),
-              name='DeleteBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0),
-              size=wx.Size(32, 32), style=wx.NO_BORDER)
+        if wx.VERSION < (2, 8, 0):
+            self.DeleteButton = wx.lib.buttons.GenBitmapButton(ID=ID_BEREMIZDELETEBUTTON, bitmap=wx.Bitmap(os.path.join('images', 'Delete.png')),
+                  name='DeleteBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0),
+                  size=wx.Size(32, 32), style=wx.NO_BORDER)
+        else:
+            self.DeleteButton = wx.lib.buttons.GenBitmapButton(id=ID_BEREMIZDELETEBUTTON, bitmap=wx.Bitmap(os.path.join('images', 'Delete.png')),
+                  name='DeleteBusButton', parent=self.LeftPanel, pos=wx.Point(0, 0),
+                  size=wx.Size(32, 32), style=wx.NO_BORDER)
         self.DeleteButton.SetToolTipString("Delete the current selected plugin")
         self.DeleteButton.Bind(wx.EVT_BUTTON, self.OnDeleteButton,
               id=ID_BEREMIZDELETEBUTTON)
@@ -505,9 +516,15 @@
                     if "method" in plugin_infos:
                         id = wx.NewId()
                         if "bitmap" in plugin_infos:
-                            button = wx.lib.buttons.GenBitmapTextButton(ID=id, parent=self.RightPanel,
-                                bitmap=wx.Bitmap(plugin_infos["bitmap"]), label=plugin_infos["name"],
-                                name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER)
+                            if wx.VERSION < (2, 8, 0):
+                                button = wx.lib.buttons.GenBitmapTextButton(ID=id, parent=self.RightPanel,
+                                    bitmap=wx.Bitmap(plugin_infos["bitmap"]), label=plugin_infos["name"],
+                                    name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER)
+                            else:
+                                button = wx.lib.buttons.GenBitmapTextButton(id=id, parent=self.RightPanel,
+                                    bitmap=wx.Bitmap(plugin_infos["bitmap"]), label=plugin_infos["name"],
+                                    name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER)
+                            
                         else:
                             button = wx.Button(id=id, label=plugin_infos["name"], 
                                 name=plugin_infos["name"], parent=self.RightPanel, 
@@ -524,9 +541,14 @@
                     if "method" in plugin_infos:
                         id = wx.NewId()
                         if "bitmap" in plugin_infos:
-                            button = wx.lib.buttons.GenBitmapTextButton(ID=id, parent=self.RightPanel, 
-                                bitmap=wx.Bitmap(plugin_infos["bitmap"]), label=plugin_infos["name"], 
-                                name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER)
+                            if wx.VERSION < (2, 8, 0):
+                                button = wx.lib.buttons.GenBitmapTextButton(ID=id, parent=self.RightPanel, 
+                                    bitmap=wx.Bitmap(plugin_infos["bitmap"]), label=plugin_infos["name"], 
+                                    name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER)
+                            else:
+                                button = wx.lib.buttons.GenBitmapTextButton(id=id, parent=self.RightPanel, 
+                                    bitmap=wx.Bitmap(plugin_infos["bitmap"]), label=plugin_infos["name"], 
+                                    name=plugin_infos["name"], pos=wx.Point(0, 0), style=wx.BU_EXACTFIT|wx.NO_BORDER)
                         else:
                             button = wx.Button(id=id, label=plugin_infos["name"], 
                                 name=plugin_infos["name"], parent=self.RightPanel,