chiark / gitweb /
fix ugliness of radio/checkbuttons in simple mode for wxpython 2.8
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Fri, 11 Sep 2015 20:41:08 +0000 (16:41 -0400)
committerYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Fri, 11 Sep 2015 20:45:13 +0000 (16:45 -0400)
On wxpython 2.8, the radio/check buttons have 13 pixels in height
which makes them glued together and very ugly, adding a border to the
panel fixes it but it becomes ugly on wxpython 3.0 which uses 25 pixels
height widgets.

Cura/gui/simpleMode.py

index 9c52727147d9dda598213b60a077eecdcc5a8327..8f2ffa1a5d9d42df650881e58ae0641e0b90fe58 100644 (file)
@@ -118,7 +118,13 @@ class simpleModePanel(wx.Panel):
                        boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
                        boxsizer.SetMinSize((80, 20))
                        for button in self._print_material_options:
-                               boxsizer.Add(button)
+                               # wxpython 2.8 gives a 13 pixel high radio/checkbutton but wxpython 3.0
+                               # gives it a 25 pixels height, so we add a border to compensate for the ugliness
+                               if button.GetBestSize()[1] < 20:
+                                       border = 5
+                               else:
+                                       border = 0
+                               boxsizer.Add(button, border=border, flag=wx.ALL)
                        self.printMaterialPanel.SetSizer(wx.BoxSizer(wx.VERTICAL))
                        self.printMaterialPanel.GetSizer().Add(boxsizer, flag=wx.EXPAND)
                        self.materialCombo = None
@@ -277,7 +283,13 @@ class simpleModePanel(wx.Panel):
 
                # Add profiles to the UI
                for button in self._print_profile_options:
-                       boxsizer.Add(button)
+                       # wxpython 2.8 gives a 13 pixel high radio/checkbutton but wxpython 3.0
+                       # gives it a 25 pixels height, so we add a border to compensate for the ugliness
+                       if button.GetBestSize()[1] < 20:
+                               border = 5
+                       else:
+                               border = 0
+                       boxsizer.Add(button, border=border, flag=wx.ALL)
                        button.Bind(wx.EVT_RADIOBUTTON, self._update)
 
                # Save current selected options
@@ -312,7 +324,13 @@ class simpleModePanel(wx.Panel):
 
                # Add profiles to the UI
                for button in self._print_other_options:
-                       boxsizer.Add(button)
+                       # wxpython 2.8 gives a 13 pixel high radio/checkbutton but wxpython 3.0
+                       # gives it a 25 pixels height, so we add a border to compensate for the ugliness
+                       if button.GetBestSize()[1] < 20:
+                               border = 5
+                       else:
+                               border = 0
+                       boxsizer.Add(button, border=border, flag=wx.ALL)
                        button.Bind(wx.EVT_CHECKBOX, self._update)
                self.Layout()
                self.GetParent().Fit()