chiark / gitweb /
UI update to support MacOS
authorsmorloc <smorloc@gmail.com>
Sat, 26 Jan 2013 05:20:28 +0000 (00:20 -0500)
committersmorloc <smorloc@gmail.com>
Sat, 26 Jan 2013 05:20:28 +0000 (00:20 -0500)
Cura/gui/configBase.py
Cura/gui/mainWindow.py

index caedc4e14e3cea69f5ddd0b19558bb7f76762b5c..6388822e7c63514c3ece61bd8ff791e454b4c33c 100644 (file)
@@ -1,5 +1,6 @@
 from __future__ import absolute_import
 
+import platform
 import wx, wx.lib.stattext, types
 
 from Cura.util import validators
@@ -69,6 +70,9 @@ class configPanelBase(wx.Panel):
                leftConfigPanel.main = self
                rightConfigPanel.main = self
 
+               configPanel.leftPanel = leftConfigPanel
+               configPanel.rightPanel = rightConfigPanel
+
                nb.AddPage(configPanel, name)
 
                return leftConfigPanel, rightConfigPanel, configPanel
@@ -107,15 +111,6 @@ class configPanelBase(wx.Panel):
                                setting.SetValue(profile.getPreference(setting.configName))
                self.Update()
 
-       def XXXgetLabelColumnWidth(self):
-               maxWidth = 0
-               for setting in self.settingControlList:
-                       maxWidth = max(maxWidth, setting.label.GetWidth())
-
-       def XXXsetLabelColumnWidth(self, newWidth):
-               for setting in self.settingControlList:
-                       setting.label.SetWidth(newWidth)                        
-
        def getLabelColumnWidth(self, panel):
                maxWidth = 0
                for child in panel.GetChildren():
@@ -128,10 +123,7 @@ class configPanelBase(wx.Panel):
                        if isinstance(child, wx.lib.stattext.GenStaticText):
                                size = child.GetSize()
                                size[0] = width
-                               #child.SetSize(size)
                                child.SetBestSize(size)
-                               #child.GetContainingSizer().Layout()
-                               #child.SetBackgroundColour('Green')
        
 class TitleRow():
        def __init__(self, panel, name):
@@ -186,7 +178,12 @@ class SettingRow():
 
                # Set the minimum size of control to something other than the humungous default
                minSize = self.ctrl.GetMinSize()
-               minSize[0] = 50
+               
+               if platform.system() == "Darwin":               
+                       # Under MacOS, it appears that the minSize is used for the actual size...
+                       minSize[0] = 150
+               else:
+                       minSize[0] = 50
                self.ctrl.SetMinSize(minSize)
                
                sizer.Add(self.label, (x,y), flag=wx.ALIGN_CENTER_VERTICAL|wx.LEFT,border=10)
index 37b45a3faecfa99798ca301e3a39cd5f8746c65d..9cbbc5ee2995a1db45e76fd94b48e091438e0aab 100644 (file)
@@ -692,10 +692,10 @@ class normalSettingsPanel(configBase.configPanelBase):
                #         switch to horizontal
                #
                                
-               col1 = configPanel.Children[0]
+               col1 = configPanel.leftPanel
                colSize1 = col1.GetSize()
                colBestSize1 = col1.GetBestSize()
-               col2 = configPanel.Children[1]
+               col2 = configPanel.rightPanel
                colSize2 = col2.GetSize()
                colBestSize2 = col2.GetBestSize()
 
@@ -705,8 +705,8 @@ class normalSettingsPanel(configBase.configPanelBase):
                        if (colSize1[0] <= colBestSize1[0]) or (colSize2[0] <= colBestSize2[0]):
                                configPanel.Freeze()
                                sizer = wx.BoxSizer(wx.VERTICAL)
-                               sizer.Add(configPanel.Children[0], flag=wx.EXPAND)
-                               sizer.Add(configPanel.Children[1], flag=wx.EXPAND)
+                               sizer.Add(configPanel.leftPanel, flag=wx.EXPAND)
+                               sizer.Add(configPanel.rightPanel, flag=wx.EXPAND)
                                configPanel.SetSizer(sizer)
                                #sizer.Layout()
                                configPanel.Layout()
@@ -716,8 +716,8 @@ class normalSettingsPanel(configBase.configPanelBase):
                        if colSize1[0] > (colBestSize1[0] + colBestSize2[0]):
                                configPanel.Freeze()
                                sizer = wx.BoxSizer(wx.HORIZONTAL)
-                               sizer.Add(configPanel.Children[0], proportion=1, border=35, flag=wx.EXPAND)
-                               sizer.Add(configPanel.Children[1], proportion=1, flag=wx.EXPAND)
+                               sizer.Add(configPanel.leftPanel, proportion=1, border=35, flag=wx.EXPAND)
+                               sizer.Add(configPanel.rightPanel, proportion=1, flag=wx.EXPAND)
                                configPanel.SetSizer(sizer)
                                #sizer.Layout()
                                configPanel.Layout()