Move the old widgetLayoutTest app to the tests dir

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46082 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2007-05-16 23:29:56 +00:00
parent 44b93c82b3
commit 14fb2cfc31
4 changed files with 21 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

BIN
wxPython/tests/image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -14,6 +14,9 @@ print "wx.VERSION_STRING = ", wx.VERSION_STRING
print "pid:", os.getpid() print "pid:", os.getpid()
##raw_input("Press Enter...") ##raw_input("Press Enter...")
testImage = os.path.join(os.path.dirname(sys.argv[0]), 'image.png')
class LayoutTestFrame(wx.Frame): class LayoutTestFrame(wx.Frame):
def __init__(self): def __init__(self):
wx.Frame.__init__(self, None, -1, "Widget Layout Tester") 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 Load and eval a list of lists from a file, load the contents
into self.testHistory into self.testHistory
""" """
fname = os.path.join(os.path.dirname(sys.argv[0]), fname = os.path.join(os.path.dirname(sys.argv[0]), 'widgets.cfg')
'widgetLayoutTest.cfg')
try: try:
self.history = eval(open(fname).read()) self.history = eval(open(fname).read())
except: except:
@@ -171,8 +173,7 @@ class LayoutTestFrame(wx.Frame):
def OnSaveHistory(self, evt): def OnSaveHistory(self, evt):
if self.needSaved: if self.needSaved:
fname = os.path.join(os.path.dirname(sys.argv[0]), fname = os.path.join(os.path.dirname(sys.argv[0]), 'widgets.cfg')
'widgetLayoutTest.cfg')
f = open(fname, 'wb') f = open(fname, 'wb')
f.write('[\n') f.write('[\n')
for item in self.history: for item in self.history:
@@ -233,7 +234,7 @@ class LayoutTestFrame(wx.Frame):
def OnHistoryActivate(self, evt): def OnHistoryActivate(self, evt):
btn = self.testHistory.GetParent().GetDefaultItem() btn = self.testHistory.GetTopLevelParent().GetDefaultItem()
if btn is not None: if btn is not None:
e = wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, btn.GetId()) e = wx.CommandEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, btn.GetId())
btn.Command(e) btn.Command(e)
@@ -408,8 +409,7 @@ class SizeInfoPane(wx.Panel):
self._size = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY) self._size = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
self._minsize = 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._bestsize = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
self._adjbstsize = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY) self._effmin = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
self._bestfit = wx.TextCtrl(self, -1, "", style=wx.TE_READONLY)
# setup the layout # setup the layout
fgs = wx.FlexGridSizer(2, 2, 5, 5) fgs = wx.FlexGridSizer(2, 2, 5, 5)
@@ -427,13 +427,9 @@ class SizeInfoPane(wx.Panel):
0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
fgs.Add(self._bestsize, 0, wx.EXPAND) 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) 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
fgs.Add(self._adjbstsize, 0, wx.EXPAND) fgs.Add(self._effmin, 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 = wx.StaticBoxSizer(sb, wx.VERTICAL)
sbs.Add(fgs, 0, wx.EXPAND|wx.ALL, 4) sbs.Add(fgs, 0, wx.EXPAND|wx.ALL, 4)
@@ -445,15 +441,13 @@ class SizeInfoPane(wx.Panel):
self._size.SetValue( str(win.GetSize()) ) self._size.SetValue( str(win.GetSize()) )
self._minsize.SetValue( str(win.GetMinSize()) ) self._minsize.SetValue( str(win.GetMinSize()) )
self._bestsize.SetValue( str(win.GetBestSize()) ) self._bestsize.SetValue( str(win.GetBestSize()) )
self._adjbstsize.SetValue( str(win.GetAdjustedBestSize()) ) self._effmin.SetValue( str(win.GetEffectiveMinSize()) )
self._bestfit.SetValue( str(win.GetEffectiveMinSize()) )
def Clear(self): def Clear(self):
self._size.SetValue("") self._size.SetValue("")
self._minsize.SetValue("") self._minsize.SetValue("")
self._bestsize.SetValue("") self._bestsize.SetValue("")
self._adjbstsize.SetValue("") self._effmin.SetValue("")
self._bestfit.SetValue("")

View File

@@ -1,11 +1,12 @@
[ [
['wx', 'BitmapButton', '-1, wx.Bitmap("image.png")', ''], ['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, "default"', 'w.SetDefault()'],
['wx', 'Button', '-1, "larger font"', 'w.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.NORMAL))\n\n\n'], ['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 with longer label"', ''],
['wx', 'CheckBox', '-1, "checkbox"', ''],
['wx', 'CheckListBox', '-1, size=(100,-1), choices="one two three four five six seven eight".split()', ''], ['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, 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()', ''], ['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', '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', 'Notebook', '', 'p = wx.Panel(w)\np.SetMinSize((150,150))\nw.AddPage(p, "test")\n'],
['wx', 'Panel', 'size=(150,150)', ''], ['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", 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, 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', 'RadioButton', '-1, "radio button"', ''],
['wx', 'ScrollBar', '', ''], ['wx', 'ScrollBar', '', ''],
['wx', 'ScrollBar', 'style=wx.SB_VERTICAL', ''], ['wx', 'ScrollBar', 'style=wx.SB_VERTICAL', ''],
@@ -36,7 +37,8 @@
['wx', 'SpinButton', 'style=wx.SP_VERTICAL', ''], ['wx', 'SpinButton', 'style=wx.SP_VERTICAL', ''],
['wx', 'SpinCtrl', '', ''], ['wx', 'SpinCtrl', '', ''],
['wx', 'SpinCtrl', 'size=(50, -1)', ''], ['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, "a longer label"', ''],
['wx', 'StaticBox', '-1, "label"', ''], ['wx', 'StaticBox', '-1, "label"', ''],
['wx', 'StaticBox', '-1, "with a size", size=(100,75)', ''], ['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', 'TextCtrl', '-1, "some\\ndefault text\\n", size=(200, -1), style=wx.TE_MULTILINE', 'w.AppendText("Here is some more text\\n")'],
['wx', 'TreeCtrl', '', ''], ['wx', 'TreeCtrl', '', ''],
['wx.calendar', 'CalendarCtrl', '-1', ''], ['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.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', '', 'w.CreateGrid(5,5)\n'],
['wx.grid', 'Grid', 'size=(400,200)', 'w.CreateGrid(100,50)\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'],
] ]