diff --git a/wxPython/misc/image.png b/wxPython/misc/image.png deleted file mode 100644 index 5a4ce74b89..0000000000 Binary files a/wxPython/misc/image.png and /dev/null differ diff --git a/wxPython/tests/image.png b/wxPython/tests/image.png new file mode 100644 index 0000000000..fc5db22a70 Binary files /dev/null and b/wxPython/tests/image.png differ diff --git a/wxPython/misc/widgetLayoutTest.py b/wxPython/tests/test_widgetLayout.py similarity index 94% rename from wxPython/misc/widgetLayoutTest.py rename to wxPython/tests/test_widgetLayout.py index 21a61861ca..8188e8ddf5 100644 --- a/wxPython/misc/widgetLayoutTest.py +++ b/wxPython/tests/test_widgetLayout.py @@ -14,6 +14,9 @@ print "wx.VERSION_STRING = ", wx.VERSION_STRING print "pid:", os.getpid() ##raw_input("Press Enter...") +testImage = os.path.join(os.path.dirname(sys.argv[0]), 'image.png') + + class LayoutTestFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, "Widget Layout Tester") @@ -148,8 +151,7 @@ class LayoutTestFrame(wx.Frame): Load and eval a list of lists from a file, load the contents into self.testHistory """ - fname = os.path.join(os.path.dirname(sys.argv[0]), - 'widgetLayoutTest.cfg') + fname = os.path.join(os.path.dirname(sys.argv[0]), 'widgets.cfg') try: self.history = eval(open(fname).read()) except: @@ -171,8 +173,7 @@ class LayoutTestFrame(wx.Frame): def OnSaveHistory(self, evt): if self.needSaved: - fname = os.path.join(os.path.dirname(sys.argv[0]), - 'widgetLayoutTest.cfg') + fname = os.path.join(os.path.dirname(sys.argv[0]), 'widgets.cfg') f = open(fname, 'wb') f.write('[\n') for item in self.history: @@ -233,7 +234,7 @@ class LayoutTestFrame(wx.Frame): def OnHistoryActivate(self, evt): - btn = self.testHistory.GetParent().GetDefaultItem() + btn = self.testHistory.GetTopLevelParent().GetDefaultItem() if btn is not None: e = wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, btn.GetId()) btn.Command(e) @@ -408,8 +409,7 @@ class SizeInfoPane(wx.Panel): self._size = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY) 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) + self._effmin = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY) # setup the layout fgs = wx.FlexGridSizer(2, 2, 5, 5) @@ -427,13 +427,9 @@ class SizeInfoPane(wx.Panel): 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) fgs.Add(self._bestsize, 0, wx.EXPAND) - fgs.Add(wx.StaticText(self, -1, "AdjustedBestSize:"), + fgs.Add(wx.StaticText(self, -1, "EffectiveMinSize:"), 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) + fgs.Add(self._effmin, 0, wx.EXPAND) sbs = wx.StaticBoxSizer(sb, wx.VERTICAL) sbs.Add(fgs, 0, wx.EXPAND|wx.ALL, 4) @@ -445,15 +441,13 @@ class SizeInfoPane(wx.Panel): self._size.SetValue( str(win.GetSize()) ) self._minsize.SetValue( str(win.GetMinSize()) ) self._bestsize.SetValue( str(win.GetBestSize()) ) - self._adjbstsize.SetValue( str(win.GetAdjustedBestSize()) ) - self._bestfit.SetValue( str(win.GetEffectiveMinSize()) ) + self._effmin.SetValue( str(win.GetEffectiveMinSize()) ) def Clear(self): self._size.SetValue("") self._minsize.SetValue("") self._bestsize.SetValue("") - self._adjbstsize.SetValue("") - self._bestfit.SetValue("") + self._effmin.SetValue("") diff --git a/wxPython/misc/widgetLayoutTest.cfg b/wxPython/tests/widgets.cfg similarity index 96% rename from wxPython/misc/widgetLayoutTest.cfg rename to wxPython/tests/widgets.cfg index fa9661b03e..22900c714f 100644 --- a/wxPython/misc/widgetLayoutTest.cfg +++ b/wxPython/tests/widgets.cfg @@ -1,11 +1,12 @@ [ ['wx', 'BitmapButton', '-1, wx.Bitmap("image.png")', ''], -['wx', 'Button', '-1, "normal"', ''], -['wx', 'Button', '-1, "with a longer, longer label"', ''], ['wx', 'Button', '-1, "default"', 'w.SetDefault()'], ['wx', 'Button', '-1, "larger font"', 'w.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.NORMAL))\n\n\n'], -['wx', 'CheckBox', '-1, "checkbox"', ''], +['wx', 'Button', '-1, "normal"', ''], +['wx', 'Button', '-1, "with a longer, longer label"', ''], +['wx', 'Button', 'wx.ID_SAVE', ''], ['wx', 'CheckBox', '-1, "checkbox with longer label"', ''], +['wx', 'CheckBox', '-1, "checkbox"', ''], ['wx', 'CheckListBox', '-1, size=(100,-1), choices="one two three four five six seven eight".split()', ''], ['wx', 'Choice', '-1, choices="one two three four five six seven eight".split()', ''], ['wx', 'Choice', '-1, size=(50,-1), choices="one two three four five six seven eight".split()', ''], @@ -19,10 +20,10 @@ ['wx', 'ListCtrl', 'style=wx.LC_REPORT, size=(100,100)', 'w.InsertColumn(0, "Col1")\nw.InsertStringItem(0, "Item 0")\nw.InsertStringItem(0, "Item 1")\n#w.SetSizeHints((200,100))'], ['wx', 'Notebook', '', 'p = wx.Panel(w)\np.SetMinSize((150,150))\nw.AddPage(p, "test")\n'], ['wx', 'Panel', 'size=(150,150)', ''], -['wx', 'RadioBox', '-1, "label", majorDimension=2, choices="one two three four five six seven eight".split()', ''], -['wx', 'RadioBox', '-1, "label", style=wx.RA_VERTICAL, majorDimension=2, choices="one two three four five six seven eight".split()', ''], ['wx', 'RadioBox', '-1, "label", choices="one two three four".split()', ''], +['wx', 'RadioBox', '-1, "label", majorDimension=2, choices="one two three four five six seven eight".split()', ''], ['wx', 'RadioBox', '-1, "label", style=wx.RA_VERTICAL, choices="one two three four".split()', ''], +['wx', 'RadioBox', '-1, "label", style=wx.RA_VERTICAL, majorDimension=2, choices="one two three four five six seven eight".split()', ''], ['wx', 'RadioButton', '-1, "radio button"', ''], ['wx', 'ScrollBar', '', ''], ['wx', 'ScrollBar', 'style=wx.SB_VERTICAL', ''], @@ -36,7 +37,8 @@ ['wx', 'SpinButton', 'style=wx.SP_VERTICAL', ''], ['wx', 'SpinCtrl', '', ''], ['wx', 'SpinCtrl', 'size=(50, -1)', ''], -['wx', 'StaticBitmap', '-1, wx.Bitmap("image.png")', ''], +['wx', 'StaticBitmap', '-1, wx.Bitmap(testImage)', ''], +['wx', 'StaticBitmap', '-1, wx.Bitmap(testImage), style=wx.SUNKEN_BORDER', ''], ['wx', 'StaticBox', '-1, "a longer label"', ''], ['wx', 'StaticBox', '-1, "label"', ''], ['wx', 'StaticBox', '-1, "with a size", size=(100,75)', ''], @@ -51,10 +53,9 @@ ['wx', 'TextCtrl', '-1, "some\\ndefault text\\n", size=(200, -1), style=wx.TE_MULTILINE', 'w.AppendText("Here is some more text\\n")'], ['wx', 'TreeCtrl', '', ''], ['wx.calendar', 'CalendarCtrl', '-1', ''], -['wx.calendar', 'CalendarCtrl', '-1, style=wx.calendar.CAL_SEQUENTIAL_MONTH_SELECTION', ''], ['wx.calendar', 'CalendarCtrl', '-1', 'w.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL))\n'], -['wx.lib.stattext', 'GenStaticText', '-1, "New font"', 'f = wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)\nw.SetFont(f)\n'], +['wx.calendar', 'CalendarCtrl', '-1, style=wx.calendar.CAL_SEQUENTIAL_MONTH_SELECTION', ''], ['wx.grid', 'Grid', '', 'w.CreateGrid(5,5)\n'], ['wx.grid', 'Grid', 'size=(400,200)', 'w.CreateGrid(100,50)\n'], -['wx', 'Button', 'wx.ID_SAVE', ''], +['wx.lib.stattext', 'GenStaticText', '-1, "New font"', 'f = wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)\nw.SetFont(f)\n'], ]