X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0bdcd2f50750d235bff2766f3d03d7228aa88dff..0a5bb138a71dfc1c706fc0858fb2801500e2c2e8:/wxPython/misc/widgetLayoutTest.py diff --git a/wxPython/misc/widgetLayoutTest.py b/wxPython/misc/widgetLayoutTest.py index c9d30ebc0f..21a61861ca 100644 --- a/wxPython/misc/widgetLayoutTest.py +++ b/wxPython/misc/widgetLayoutTest.py @@ -12,7 +12,7 @@ import os # stuff for debugging print "wx.VERSION_STRING = ", wx.VERSION_STRING print "pid:", os.getpid() -#raw_input("Press Enter...") +##raw_input("Press Enter...") class LayoutTestFrame(wx.Frame): def __init__(self): @@ -49,11 +49,11 @@ class LayoutTestFrame(wx.Frame): self.destroyBtn = destroyBtn bottomPanel = wx.Panel(p, style=wx.SUNKEN_BORDER, name="bottomPanel") - bottomPanel.SetSizeHints((640,240)) - bottomPanel.SetDefaultBackgroundColour("light blue") + bottomPanel.SetMinSize((640,240)) + bottomPanel.SetOwnBackgroundColour("light blue") self.testPanel = wx.Panel(bottomPanel, name="testPanel") - self.testPanel.SetDefaultBackgroundColour((205, 183, 181)) # mistyrose3 + self.testPanel.SetOwnBackgroundColour((205, 183, 181)) # mistyrose3 self.testWidget = None self.infoPane = InfoPane(p) @@ -256,13 +256,15 @@ class LayoutTestFrame(wx.Frame): expr = "w = %s.%s( testPanel, %s )" % (moduleName, className, parameters) self.expression.SetValue(expr) - docstring = "" + docstring = None try: docstring = eval("%s.%s.__init__.__doc__" % (moduleName, className)) except: pass - self.docstring.SetValue(docstring) - + if docstring is not None: + self.docstring.SetValue(docstring) + else: + self.docstring.SetValue("") def OnEnableDestroy(self, evt): evt.Enable(self.testWidget is not None) @@ -336,10 +338,10 @@ class LayoutTestFrame(wx.Frame): self.testPanel.SetSizer(None, True) self.testPanel.Refresh() - # ensure the panel shrinks again - self.testPanel.SetSizeHints((20,20)) + # ensure the panel shrinks again now that it has no sizer + self.testPanel.SetMinSize((20,20)) self.bottomSizer.Layout() - self.testPanel.SetSizeHints(wx.DefaultSize) + self.testPanel.SetMinSize(wx.DefaultSize) # make the create button be default now self.createBtn.SetDefault() @@ -407,6 +409,7 @@ class SizeInfoPane(wx.Panel): self._minsize = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY) self._bestsize = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY) self._adjbstsize = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY) + self._bestfit = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY) # setup the layout fgs = wx.FlexGridSizer(2, 2, 5, 5) @@ -428,6 +431,10 @@ class SizeInfoPane(wx.Panel): 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) fgs.Add(self._adjbstsize, 0, wx.EXPAND) + fgs.Add(wx.StaticText(self, -1, "BestFittingSize:"), + 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) + fgs.Add(self._bestfit, 0, wx.EXPAND) + sbs = wx.StaticBoxSizer(sb, wx.VERTICAL) sbs.Add(fgs, 0, wx.EXPAND|wx.ALL, 4) @@ -439,13 +446,14 @@ class SizeInfoPane(wx.Panel): self._minsize.SetValue( str(win.GetMinSize()) ) self._bestsize.SetValue( str(win.GetBestSize()) ) self._adjbstsize.SetValue( str(win.GetAdjustedBestSize()) ) - + self._bestfit.SetValue( str(win.GetEffectiveMinSize()) ) def Clear(self): self._size.SetValue("") self._minsize.SetValue("") self._bestsize.SetValue("") self._adjbstsize.SetValue("") + self._bestfit.SetValue("") @@ -460,10 +468,10 @@ class ColourInfoPanel(wx.Panel): sb = wx.StaticBox(self, -1, label) self._fgtxt = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY) self._fgclr = wx.Panel(self, style=wx.SIMPLE_BORDER) - self._fgclr.SetSizeHints((20,20)) + self._fgclr.SetMinSize((20,20)) self._bgtxt = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY) self._bgclr = wx.Panel(self, style=wx.SIMPLE_BORDER) - self._bgclr.SetSizeHints((20,20)) + self._bgclr.SetMinSize((20,20)) # setup the layout fgs = wx.FlexGridSizer(2, 3, 5, 5) @@ -494,9 +502,6 @@ class ColourInfoPanel(wx.Panel): self._fgtxt.SetValue( clr2hex(win.GetForegroundColour(), self._fgclr) ) self._bgtxt.SetValue( clr2hex(win.GetBackgroundColour(), self._bgclr) ) -## f = win.GetFont() -## print f.GetNativeFontInfo().ToString() - def Clear(self): self._fgtxt.SetValue("")