Merged wxPython 2.4.x to the 2.5 branch (Finally!!!)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-03-25 06:35:27 +00:00
parent 9b4e3f352b
commit 1e4a197e4c
586 changed files with 62691 additions and 17740 deletions

View File

@@ -1,54 +1,102 @@
from wxPython.wx import *
from wxPython.help import *
#---------------------------------------------------------------------------
# Create and set a help provider. Normally you would do this in
# the app's OnInit as it must be done before any SetHelpText calls.
provider = wxSimpleHelpProvider()
wxHelpProvider_Set(provider)
#---------------------------------------------------------------------------
class TestDialog(wxDialog):
def __init__(self, parent, ID, title,
pos=wxDefaultPosition, size=wxDefaultSize,
style=wxDEFAULT_DIALOG_STYLE):
# Instead of calling wxDialog.__init__ we precreate the dialog
# so we can set an extra style that must be set before
# creation, and then we create the GUI dialog using the Create
# method.
pre = wxPreDialog()
pre.SetExtraStyle(wxDIALOG_EX_CONTEXTHELP)
pre.Create(parent, ID, title, pos, size, style)
# This next step is the most important, it turns this Python
# object into the real wrapper of the dialog (instead of pre)
# as far as the wxPython extension is concerned.
self.this = pre.this
# Now continue with the normal construction of the dialog
# contents
sizer = wxBoxSizer(wxVERTICAL)
label = wxStaticText(self, -1, "This is a wxDialog")
label.SetHelpText("This is the help text for the label")
sizer.Add(label, 0, wxALIGN_CENTRE|wxALL, 5)
box = wxBoxSizer(wxHORIZONTAL)
label = wxStaticText(self, -1, "Field #1:")
label.SetHelpText("This is the help text for the label")
box.Add(label, 0, wxALIGN_CENTRE|wxALL, 5)
text = wxTextCtrl(self, -1, "", size=(80,-1))
text.SetHelpText("Here's some help text for field #1")
box.Add(text, 1, wxALIGN_CENTRE|wxALL, 5)
sizer.AddSizer(box, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5)
box = wxBoxSizer(wxHORIZONTAL)
label = wxStaticText(self, -1, "Field #2:")
label.SetHelpText("This is the help text for the label")
box.Add(label, 0, wxALIGN_CENTRE|wxALL, 5)
text = wxTextCtrl(self, -1, "", size=(80,-1))
text.SetHelpText("Here's some help text for field #2")
box.Add(text, 1, wxALIGN_CENTRE|wxALL, 5)
sizer.AddSizer(box, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5)
line = wxStaticLine(self, -1, size=(20,-1), style=wxLI_HORIZONTAL)
sizer.Add(line, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP, 5)
box = wxBoxSizer(wxHORIZONTAL)
if wxPlatform != "__WXMSW__":
btn = wxContextHelpButton(self)
box.Add(btn, 0, wxALIGN_CENTRE|wxALL, 5)
btn = wxButton(self, wxID_OK, " OK ")
btn.SetDefault()
btn.SetHelpText("The OK button completes the dialog")
box.Add(btn, 0, wxALIGN_CENTRE|wxALL, 5)
btn = wxButton(self, wxID_CANCEL, " Cancel ")
btn.SetHelpText("The Cancel button cnacels the dialog. (Duh!)")
box.Add(btn, 0, wxALIGN_CENTRE|wxALL, 5)
sizer.AddSizer(box, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5)
self.SetSizer(sizer)
self.SetAutoLayout(True)
sizer.Fit(self)
#---------------------------------------------------------------------------
def runTest(frame, nb, log):
win = wxDialog(frame, -1, "This is a wxDialog", size=wxSize(350, 200), style=wxCAPTION)
sizer = wxBoxSizer(wxVERTICAL)
label = wxStaticText(win, -1, "This is a wxDialog")
sizer.Add(label, 0, wxALIGN_CENTRE|wxALL, 5)
box = wxBoxSizer(wxHORIZONTAL)
label = wxStaticText(win, -1, "Field #1:")
box.Add(label, 0, wxALIGN_CENTRE|wxALL, 5)
text = wxTextCtrl(win, -1, "", size=(80,-1))
box.Add(text, 1, wxALIGN_CENTRE|wxALL, 5)
sizer.AddSizer(box, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5)
box = wxBoxSizer(wxHORIZONTAL)
label = wxStaticText(win, -1, "Field #2:")
box.Add(label, 0, wxALIGN_CENTRE|wxALL, 5)
text = wxTextCtrl(win, -1, "", size=(80,-1))
box.Add(text, 1, wxALIGN_CENTRE|wxALL, 5)
sizer.AddSizer(box, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5)
line = wxStaticLine(win, -1, size=(20,-1), style=wxLI_HORIZONTAL)
sizer.Add(line, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP, 5)
box = wxBoxSizer(wxHORIZONTAL)
btn = wxButton(win, wxID_OK, " OK ")
btn.SetDefault()
box.Add(btn, 0, wxALIGN_CENTRE|wxALL, 5)
btn = wxButton(win, wxID_CANCEL, " Cancel ")
box.Add(btn, 0, wxALIGN_CENTRE|wxALL, 5)
sizer.AddSizer(box, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5)
win.SetSizer(sizer)
win.SetAutoLayout(true)
sizer.Fit(win)
win = TestDialog(frame, -1, "This is a wxDialog", size=wxSize(350, 200),
#style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME
style = wxDEFAULT_DIALOG_STYLE
)
win.CenterOnScreen()
val = win.ShowModal()
if val == wxID_OK:
log.WriteText("You pressed OK\n")
@@ -63,10 +111,13 @@ def runTest(frame, nb, log):
overview = """\
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])