Add the test for __main__ to all that didn't have it, so all demo

samples can be run standalone


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20957 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-06-05 23:48:28 +00:00
parent 46ddee38b0
commit 7296575156
54 changed files with 511 additions and 133 deletions

View File

@@ -127,3 +127,10 @@ def runTest(frame, nb, log):
overview = """ overview = """
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -90,3 +90,10 @@ help into your applicaiton using the wxSimpleHelpProvider class.
#---------------------------------------------------------------------- #----------------------------------------------------------------------
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -206,11 +206,38 @@ def runTest(frame, nb, log):
overview = """\ overview = """<html><body>\
This demo shows some examples of data transfer through clipboard or drag and drop. In wxWindows, these two ways to transfer data (either between different applications or inside one and the same) are very similar which allows to implement both of them using almost the same code - or, in other words, if you implement drag and drop support for your application, you get clipboard support for free and vice versa. This demo shows some examples of data transfer through clipboard or
drag and drop. In wxWindows, these two ways to transfer data (either
At the heart of both clipboard and drag and drop operations lies the wxDataObject class. The objects of this class (or, to be precise, classes derived from it) represent the data which is being carried by the mouse during drag and drop operation or copied to or pasted from the clipboard. wxDataObject is a "smart" piece of data because it knows which formats it supports (see GetFormatCount and GetAllFormats) and knows how to render itself in any of them (see GetDataHere). It can also receive its value from the outside in a format it supports if it implements the SetData method. Please see the documentation of this class for more details. between different applications or inside one and the same) are very
similar which allows to implement both of them using almost the same
Both clipboard and drag and drop operations have two sides: the source and target, the data provider and the data receiver. These which may be in the same application and even the same window when, for example, you drag some text from one position to another in a word processor. Let us describe what each of them should do. code - or, in other words, if you implement drag and drop support for
your application, you get clipboard support for free and vice versa.
<p>
At the heart of both clipboard and drag and drop operations lies the
wxDataObject class. The objects of this class (or, to be precise,
classes derived from it) represent the data which is being carried by
the mouse during drag and drop operation or copied to or pasted from
the clipboard. wxDataObject is a "smart" piece of data because it
knows which formats it supports (see GetFormatCount and GetAllFormats)
and knows how to render itself in any of them (see GetDataHere). It
can also receive its value from the outside in a format it supports if
it implements the SetData method. Please see the documentation of this
class for more details.
<p>
Both clipboard and drag and drop operations have two sides: the source
and target, the data provider and the data receiver. These which may
be in the same application and even the same window when, for example,
you drag some text from one position to another in a word
processor. Let us describe what each of them should do.
</body></html>
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -38,3 +38,11 @@ def runTest(frame, nb, log):
overview = fancytext.__doc__.replace("<", "&lt;") overview = fancytext.__doc__.replace("<", "&lt;")
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -74,3 +74,12 @@ overview = """<html><body>
""" % ( FileBrowseButton.__doc__, """ % ( FileBrowseButton.__doc__,
FileBrowseButtonWithHistory.__doc__ , FileBrowseButtonWithHistory.__doc__ ,
str(DirBrowseButton.__doc__) ) str(DirBrowseButton.__doc__) )
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -38,3 +38,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -136,5 +136,8 @@ overview = """<html><body>
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -60,3 +60,12 @@ def runTest(frame, nb, log):
overview = Layoutf.__doc__ overview = Layoutf.__doc__
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -136,3 +136,12 @@ and the second will show #2 (<i>working as of 2.3.2</i>)
</body></html> </body></html>
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -176,3 +176,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -83,3 +83,10 @@ This demo is a contrived example of defining an event class in wxPython and send
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -205,3 +205,12 @@ when the framework allows for it.
""" % os.path.join(os.path.dirname(wxPython.lib.printout.__file__), "printout.py") """ % os.path.join(os.path.dirname(wxPython.lib.printout.__file__), "printout.py")
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -244,3 +244,11 @@ ProcessEvent does, it processes it later from the context of the GUI
thread. thread.
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -121,3 +121,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -139,3 +139,12 @@ and then pass the unicode to the wxPython method.
</body></html> </body></html>
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -110,3 +110,11 @@ else:
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -11,7 +11,10 @@ class TestPanel(wxPanel):
self.log = log self.log = log
cal = wxCalendarCtrl(self, -1, wxDateTime_Now(), pos = (25,50), cal = wxCalendarCtrl(self, -1, wxDateTime_Now(), pos = (25,50),
style = wxCAL_SHOW_HOLIDAYS | wxCAL_SUNDAY_FIRST) style = wxCAL_SHOW_HOLIDAYS
| wxCAL_SUNDAY_FIRST
#| wxCAL_SEQUENTIAL_MONTH_SELECTION
)
EVT_CALENDAR(self, cal.GetId(), self.OnCalSelected) EVT_CALENDAR(self, cal.GetId(), self.OnCalSelected)
@@ -55,3 +58,12 @@ version described in the docs. This one will probably be a bit more efficient
than the one in wxPython.lib.calendar, but I like a few things about it better, than the one in wxPython.lib.calendar, but I like a few things about it better,
so I think both will stay in wxPython. so I think both will stay in wxPython.
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -51,3 +51,11 @@ overview = """\
A checkbox is a labelled box which is either on (checkmark is visible) or off (no checkmark). A checkbox is a labelled box which is either on (checkmark is visible) or off (no checkmark).
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -70,13 +70,15 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -46,3 +46,13 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
A choice item is used to select one of a list of strings. Unlike a listbox, only the selection is visible until the user pulls down the menu of choices. A choice item is used to select one of a list of strings. Unlike a listbox, only the selection is visible until the user pulls down the menu of choices.
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -29,3 +29,13 @@ This class represents the colour chooser dialog.
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -40,3 +40,12 @@ overview = """\
This class provides a composite control that lets the This class provides a composite control that lets the
user easily enter and edit a list of strings. user easily enter and edit a list of strings.
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -35,3 +35,12 @@ overview = """\
This class represents the file chooser dialog. This class represents the file chooser dialog.
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -76,3 +76,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
A generic find and replace dialog. A generic find and replace dialog.
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -75,9 +75,11 @@ def runTest(frame, nb, log):
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
overview = """\ overview = """\
wxFloatBar is a subclass of wxToolBar, implemented in Python, which can be detached from its frame. wxFloatBar is a subclass of wxToolBar, implemented in Python, which
can be detached from its frame.
Drag the toolbar with the mouse to make it float, and drag it back, or close it to make the toolbar return to its original position. Drag the toolbar with the mouse to make it float, and drag it back, or
close it to make the toolbar return to its original position.
""" """
@@ -87,6 +89,13 @@ Drag the toolbar with the mouse to make it float, and drag it back, or close it
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -43,3 +43,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -52,3 +52,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -57,3 +57,10 @@ overview = """\
This control can be used to place a directory listing (with optional files) This control can be used to place a directory listing (with optional files)
on an arbitrary window. on an arbitrary window.
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -35,3 +35,12 @@ overview = """\
At long last there is finally a way to load any supported image type At long last there is finally a way to load any supported image type
directly from any Python file-like object, such as a memory buffer directly from any Python file-like object, such as a memory buffer
using StringIO. """ using StringIO. """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -195,3 +195,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -46,3 +46,11 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -114,10 +114,13 @@ def runTest(frame, nb, log):
overview = """\ overview = """\<html><body>
Objects of this class can be associated with a window to define its layout constraints, with respect to siblings or its parent. Objects of this class can be associated with a window to define its
layout constraints, with respect to siblings or its parent.
The class consists of the following eight constraints of class wxIndividualLayoutConstraint, some or all of which should be accessed directly to set the appropriate constraints. The class consists of the following eight constraints of class
wxIndividualLayoutConstraint, some or all of which should be accessed
directly to set the appropriate constraints.
left: represents the left hand edge of the window left: represents the left hand edge of the window
@@ -135,10 +138,21 @@ centreX: represents the horizontal centre point of the window
centreY: represents the vertical centre point of the window centreY: represents the vertical centre point of the window
Most constraints are initially set to have the relationship wxUnconstrained, which means that their values should be calculated by looking at known constraints. The exceptions are width and height, which are set to wxAsIs to ensure that if the user does not specify a constraint, the existing width and height will be used, to be compatible with panel items which often have take a default size. If the constraint is wxAsIs, the dimension will not be changed. Most constraints are initially set to have the relationship
wxUnconstrained, which means that their values should be calculated by
looking at known constraints. The exceptions are width and height,
which are set to wxAsIs to ensure that if the user does not specify a
constraint, the existing width and height will be used, to be
compatible with panel items which often have take a default size. If
the constraint is wxAsIs, the dimension will not be changed.
wxLayoutConstraints()
-------------------------------------------
Constructor.
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -52,3 +52,12 @@ it. Here are a couple samples of how to use it.
</body></html> </body></html>
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -51,13 +51,22 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
wxMVCTree is a control which handles hierarchical data. It is constructed in model-view-controller architecture, so the display of that data, and the content of the data can be changed greatly without affecting the other parts.
wxMVCTree is a control which handles hierarchical data. It is
constructed in model-view-controller architecture, so the display of
that data, and the content of the data can be changed greatly without
affecting the other parts.
Multiple selections are possible by holding down the Ctrl key. Multiple selections are possible by holding down the Ctrl key.
This demo shows the wxPython directory structure. The interesting part is that the tree model is late-bound to the filesystem, so the filenames are not retrieved until the directory is expanded. In mvctree.py are models for generic data, and both the early and late-bound filesystem models. This demo shows the wxPython directory structure. The interesting part
is that the tree model is late-bound to the filesystem, so the
filenames are not retrieved until the directory is expanded. In
mvctree.py are models for generic data, and both the early and
late-bound filesystem models.
There is also support for editing, though it's not enabled in this demo, to avoid accidentally renaming files! There is also support for editing, though it's not enabled in this
demo, to avoid accidentally renaming files!
""" """
@@ -65,6 +74,7 @@ There is also support for editing, though it's not enabled in this demo, to avoi
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -25,39 +25,14 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
wxMessageDialog() Show a message to the user in a dialog
----------------------------------
wxMessageDialog(wxWindow* parent, const wxString& message, const wxString& caption = "Message box", long style = wxOK | wxCANCEL | wxCENTRE, const wxPoint& pos = wxDefaultPosition)
Constructor. Use wxMessageDialog::ShowModal to show the dialog.
Parameters
-------------------
parent = Parent window.
message = Message to show on the dialog.
caption = The dialog caption.
style = A dialog style (bitlist) containing flags chosen from the following:
wxOK Show an OK button.
wxCANCEL Show a Cancel button.
wxYES_NO Show Yes and No buttons.
wxCENTRE Centre the message. Not Windows.
wxICON_EXCLAMATION Shows an exclamation mark icon. Windows only.
wxICON_HAND Shows a hand icon. Windows only.
wxICON_QUESTION Shows a question mark icon. Windows only.
wxICON_INFORMATION Shows an information (i) icon. Windows only.
pos = Dialog position.
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -173,3 +173,11 @@ def MyBitmapsFunc( index ):
mimetypes_wdr.MyBitmapsFunc = MyBitmapsFunc mimetypes_wdr.MyBitmapsFunc = MyBitmapsFunc
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -45,3 +45,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -25,3 +25,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -21,13 +21,15 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -37,3 +37,11 @@ def runTest(frame, nb, log):
overview = wxPlotCanvas.__doc__ overview = wxPlotCanvas.__doc__
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -18,14 +18,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -152,3 +152,12 @@ child process to exit its main loop.
</body><html> </body><html>
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -30,9 +30,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -47,3 +47,10 @@ def runTest(frame, nb, log):
overview = wxPython.lib.rightalign.__doc__ overview = wxPython.lib.rightalign.__doc__
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -114,17 +114,13 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -17,8 +17,14 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -46,3 +46,10 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -34,3 +34,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -38,10 +38,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -104,5 +104,16 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
A status bar is a narrow window that can be placed along the bottom of a frame to give small amounts of status information. It can contain one or more fields, one or more of which can be variable length according to the size of the window. A status bar is a narrow window that can be placed along the bottom of
""" a frame to give small amounts of status information. It can contain
one or more fields, one or more of which can be variable length
according to the size of the window. """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -17,14 +17,15 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -71,14 +71,6 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
The wxTimer class allows you to execute code at specified intervals. The wxTimer class allows you to execute code at specified intervals.
@@ -87,8 +79,7 @@ The wxTimer class allows you to execute code at specified intervals.
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -48,3 +48,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])

View File

@@ -42,3 +42,12 @@ def runTest(frame, nb, log):
overview = """\ overview = """\
""" """
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])