Switched to using True/False in the wxPython lib and demo instead of
true/false or TRUE/FALSE to prepare for the new boolean type and constants being added to Python. Added code to wx.py to test for the existence of the new constants and to create suitable values if not present. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -62,7 +62,7 @@ class TestPanel(wxPanel):
|
|||||||
sizer.Add(btnSizer, 0, wxEXPAND)
|
sizer.Add(btnSizer, 0, wxEXPAND)
|
||||||
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
|
|
||||||
EVT_WINDOW_DESTROY(self, self.OnDestroy)
|
EVT_WINDOW_DESTROY(self, self.OnDestroy)
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
app = wxPySimpleApp()
|
app = wxPySimpleApp()
|
||||||
frame = TestFrame()
|
frame = TestFrame()
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -101,7 +101,7 @@ class TestPanel(wxWindow):
|
|||||||
self.location.Append(self.current)
|
self.location.Append(self.current)
|
||||||
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
EVT_SIZE(self, self.OnSize)
|
EVT_SIZE(self, self.OnSize)
|
||||||
|
|
||||||
EVT_WINDOW_DESTROY(self, self.OnDestroy)
|
EVT_WINDOW_DESTROY(self, self.OnDestroy)
|
||||||
@@ -230,7 +230,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
app = wxPySimpleApp()
|
app = wxPySimpleApp()
|
||||||
frame = TestFrame()
|
frame = TestFrame()
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@ class TestColourSelect(wxPanel):
|
|||||||
def __init__(self, parent, log):
|
def __init__(self, parent, log):
|
||||||
self.log = log
|
self.log = log
|
||||||
wxPanel.__init__(self, parent, -1)
|
wxPanel.__init__(self, parent, -1)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
mainSizer = wxBoxSizer(wxVERTICAL)
|
mainSizer = wxBoxSizer(wxVERTICAL)
|
||||||
self.SetSizer(mainSizer)
|
self.SetSizer(mainSizer)
|
||||||
t = wxStaticText(self, -1,
|
t = wxStaticText(self, -1,
|
||||||
|
@@ -53,7 +53,7 @@ class TestPanel(wxPanel):
|
|||||||
border = wxBoxSizer(wxVERTICAL)
|
border = wxBoxSizer(wxVERTICAL)
|
||||||
border.Add(sizer, 0, wxALL, 25)
|
border.Add(sizer, 0, wxALL, 25)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(border)
|
self.SetSizer(border)
|
||||||
self.Layout()
|
self.Layout()
|
||||||
|
|
||||||
|
@@ -139,7 +139,7 @@ class DoodleDropTarget(wxPyDropTarget):
|
|||||||
|
|
||||||
def OnDrop(self, x, y):
|
def OnDrop(self, x, y):
|
||||||
self.log.WriteText("OnDrop: %d %d\n" % (x, y))
|
self.log.WriteText("OnDrop: %d %d\n" % (x, y))
|
||||||
return true
|
return True
|
||||||
|
|
||||||
def OnDragOver(self, x, y, d):
|
def OnDragOver(self, x, y, d):
|
||||||
#self.log.WriteText("OnDragOver: %d, %d, %d\n" % (x, y, d))
|
#self.log.WriteText("OnDragOver: %d, %d, %d\n" % (x, y, d))
|
||||||
@@ -154,7 +154,7 @@ class DoodleDropTarget(wxPyDropTarget):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called when OnDrop returns true. We need to get the data and
|
# Called when OnDrop returns True. We need to get the data and
|
||||||
# do something with it.
|
# do something with it.
|
||||||
def OnData(self, x, y, d):
|
def OnData(self, x, y, d):
|
||||||
self.log.WriteText("OnData: %d, %d, %d\n" % (x, y, d))
|
self.log.WriteText("OnData: %d, %d, %d\n" % (x, y, d))
|
||||||
@@ -206,7 +206,7 @@ class CustomDnDPanel(wxPanel):
|
|||||||
def __init__(self, parent, log):
|
def __init__(self, parent, log):
|
||||||
wxPanel.__init__(self, parent, -1)
|
wxPanel.__init__(self, parent, -1)
|
||||||
|
|
||||||
self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false))
|
self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False))
|
||||||
|
|
||||||
# Make the controls
|
# Make the controls
|
||||||
text1 = wxStaticText(self, -1,
|
text1 = wxStaticText(self, -1,
|
||||||
@@ -218,9 +218,9 @@ class CustomDnDPanel(wxPanel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
rb1 = wxRadioButton(self, -1, "Draw", style=wxRB_GROUP)
|
rb1 = wxRadioButton(self, -1, "Draw", style=wxRB_GROUP)
|
||||||
rb1.SetValue(true)
|
rb1.SetValue(True)
|
||||||
rb2 = wxRadioButton(self, -1, "Drag")
|
rb2 = wxRadioButton(self, -1, "Drag")
|
||||||
rb2.SetValue(false)
|
rb2.SetValue(False)
|
||||||
|
|
||||||
text2 = wxStaticText(self, -1,
|
text2 = wxStaticText(self, -1,
|
||||||
"The lower window is accepting a\n"
|
"The lower window is accepting a\n"
|
||||||
@@ -250,7 +250,7 @@ class CustomDnDPanel(wxPanel):
|
|||||||
|
|
||||||
sizer.Add(dndsizer, 1, wxEXPAND)
|
sizer.Add(dndsizer, 1, wxEXPAND)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
|
|
||||||
# Events
|
# Events
|
||||||
@@ -270,12 +270,12 @@ class TestPanel(wxPanel):
|
|||||||
def __init__(self, parent, log):
|
def __init__(self, parent, log):
|
||||||
wxPanel.__init__(self, parent, -1)
|
wxPanel.__init__(self, parent, -1)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
sizer = wxBoxSizer(wxVERTICAL)
|
sizer = wxBoxSizer(wxVERTICAL)
|
||||||
|
|
||||||
msg = "Custom Drag-And-Drop"
|
msg = "Custom Drag-And-Drop"
|
||||||
text = wxStaticText(self, -1, "", style=wxALIGN_CENTRE)
|
text = wxStaticText(self, -1, "", style=wxALIGN_CENTRE)
|
||||||
text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, false))
|
text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, False))
|
||||||
text.SetLabel(msg)
|
text.SetLabel(msg)
|
||||||
w,h = text.GetTextExtent(msg)
|
w,h = text.GetTextExtent(msg)
|
||||||
text.SetSize(wxSize(w,h+1))
|
text.SetSize(wxSize(w,h+1))
|
||||||
@@ -306,7 +306,7 @@ if __name__ == '__main__':
|
|||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
wxInitAllImageHandlers()
|
wxInitAllImageHandlers()
|
||||||
self.MakeFrame()
|
self.MakeFrame()
|
||||||
return true
|
return True
|
||||||
|
|
||||||
def MakeFrame(self, event=None):
|
def MakeFrame(self, event=None):
|
||||||
frame = wxFrame(None, -1, "Custom Drag and Drop", size=(550,400))
|
frame = wxFrame(None, -1, "Custom Drag and Drop", size=(550,400))
|
||||||
@@ -317,7 +317,7 @@ if __name__ == '__main__':
|
|||||||
frame.SetMenuBar(mb)
|
frame.SetMenuBar(mb)
|
||||||
EVT_MENU(frame, 6543, self.MakeFrame)
|
EVT_MENU(frame, 6543, self.MakeFrame)
|
||||||
panel = TestPanel(frame, DummyLog())
|
panel = TestPanel(frame, DummyLog())
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -88,13 +88,13 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# Create an instance of our customized Frame class
|
# Create an instance of our customized Frame class
|
||||||
frame = MyFrame(None, -1, "This is a test")
|
frame = MyFrame(None, -1, "This is a test")
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
|
|
||||||
# Tell wxWindows that this is our main window
|
# Tell wxWindows that this is our main window
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
|
|
||||||
# Return a success flag
|
# Return a success flag
|
||||||
return true
|
return True
|
||||||
|
|
||||||
|
|
||||||
app = MyApp(0) # Create an instance of the application class
|
app = MyApp(0) # Create an instance of the application class
|
||||||
@@ -107,7 +107,7 @@ if __name__ == "__main__":
|
|||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
win = MyFrame(frame, -1, "This is a test")
|
win = MyFrame(frame, -1, "This is a test")
|
||||||
frame.otherWin = win
|
frame.otherWin = win
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
|
|
||||||
overview = """\
|
overview = """\
|
||||||
|
@@ -8,7 +8,7 @@ class ClipTextPanel(wxPanel):
|
|||||||
wxPanel.__init__(self, parent, -1)
|
wxPanel.__init__(self, parent, -1)
|
||||||
self.log = log
|
self.log = log
|
||||||
|
|
||||||
#self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false))
|
#self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False))
|
||||||
|
|
||||||
sizer = wxBoxSizer(wxVERTICAL)
|
sizer = wxBoxSizer(wxVERTICAL)
|
||||||
sizer.Add(wxStaticText(self, -1,
|
sizer.Add(wxStaticText(self, -1,
|
||||||
@@ -28,7 +28,7 @@ class ClipTextPanel(wxPanel):
|
|||||||
EVT_BUTTON(self, 6051, self.OnPaste)
|
EVT_BUTTON(self, 6051, self.OnPaste)
|
||||||
EVT_BUTTON(self, 6052, self.OnCopyBitmap)
|
EVT_BUTTON(self, 6052, self.OnCopyBitmap)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
|
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ class OtherDropTarget(wxPyDropTarget):
|
|||||||
|
|
||||||
def OnDrop(self, x, y):
|
def OnDrop(self, x, y):
|
||||||
self.log.WriteText("OnDrop: %d %d\n" % (x, y))
|
self.log.WriteText("OnDrop: %d %d\n" % (x, y))
|
||||||
return true
|
return True
|
||||||
|
|
||||||
def OnData(self, x, y, d):
|
def OnData(self, x, y, d):
|
||||||
self.log.WriteText("OnData: %d, %d, %d\n" % (x, y, d))
|
self.log.WriteText("OnData: %d, %d, %d\n" % (x, y, d))
|
||||||
@@ -128,7 +128,7 @@ class FileDropPanel(wxPanel):
|
|||||||
def __init__(self, parent, log):
|
def __init__(self, parent, log):
|
||||||
wxPanel.__init__(self, parent, -1)
|
wxPanel.__init__(self, parent, -1)
|
||||||
|
|
||||||
#self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false))
|
#self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False))
|
||||||
|
|
||||||
sizer = wxBoxSizer(wxVERTICAL)
|
sizer = wxBoxSizer(wxVERTICAL)
|
||||||
sizer.Add(wxStaticText(self, -1, " \nDrag some files here:"),
|
sizer.Add(wxStaticText(self, -1, " \nDrag some files here:"),
|
||||||
@@ -148,7 +148,7 @@ class FileDropPanel(wxPanel):
|
|||||||
self.text2.SetDropTarget(dt)
|
self.text2.SetDropTarget(dt)
|
||||||
sizer.Add(self.text2, 1, wxEXPAND)
|
sizer.Add(self.text2, 1, wxEXPAND)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
|
|
||||||
|
|
||||||
@@ -166,12 +166,12 @@ class TestPanel(wxPanel):
|
|||||||
def __init__(self, parent, log):
|
def __init__(self, parent, log):
|
||||||
wxPanel.__init__(self, parent, -1)
|
wxPanel.__init__(self, parent, -1)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
outsideSizer = wxBoxSizer(wxVERTICAL)
|
outsideSizer = wxBoxSizer(wxVERTICAL)
|
||||||
|
|
||||||
msg = "Clipboard / Drag-And-Drop"
|
msg = "Clipboard / Drag-And-Drop"
|
||||||
text = wxStaticText(self, -1, "", style=wxALIGN_CENTRE)
|
text = wxStaticText(self, -1, "", style=wxALIGN_CENTRE)
|
||||||
text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, false))
|
text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, False))
|
||||||
text.SetLabel(msg)
|
text.SetLabel(msg)
|
||||||
w,h = text.GetTextExtent(msg)
|
w,h = text.GetTextExtent(msg)
|
||||||
text.SetSize(wxSize(w,h+1))
|
text.SetSize(wxSize(w,h+1))
|
||||||
|
@@ -14,14 +14,14 @@ ID_BUTTON_wxPyNonFatalErrorDialog = 10004
|
|||||||
ID_BUTTON_wxPyFatalErrorDialogWithTraceback = 10005
|
ID_BUTTON_wxPyFatalErrorDialogWithTraceback = 10005
|
||||||
ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback = 10006
|
ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback = 10006
|
||||||
|
|
||||||
def ErrorDialogsDemoPanelFunc( parent, call_fit = true, set_sizer = true ):
|
def ErrorDialogsDemoPanelFunc( parent, call_fit = True, set_sizer = True ):
|
||||||
item0 = wxBoxSizer( wxVERTICAL )
|
item0 = wxBoxSizer( wxVERTICAL )
|
||||||
|
|
||||||
item1 = wxStaticText( parent, ID_TEXT, "Please select one of the buttons below for an example using explicit errors...", wxDefaultPosition, wxDefaultSize, 0 )
|
item1 = wxStaticText( parent, ID_TEXT, "Please select one of the buttons below for an example using explicit errors...", wxDefaultPosition, wxDefaultSize, 0 )
|
||||||
item0.AddWindow( item1, 0, wxALIGN_CENTRE|wxALL, 5 )
|
item0.AddWindow( item1, 0, wxALIGN_CENTRE|wxALL, 5 )
|
||||||
|
|
||||||
item2 = wxFlexGridSizer( 0, 2, 0, 0 )
|
item2 = wxFlexGridSizer( 0, 2, 0, 0 )
|
||||||
|
|
||||||
item3 = wxButton( parent, ID_BUTTON_wxPyNonFatalError, "wxPyNonFatalError", wxDefaultPosition, wxDefaultSize, 0 )
|
item3 = wxButton( parent, ID_BUTTON_wxPyNonFatalError, "wxPyNonFatalError", wxDefaultPosition, wxDefaultSize, 0 )
|
||||||
item2.AddWindow( item3, 0, wxALIGN_CENTRE|wxALL, 5 )
|
item2.AddWindow( item3, 0, wxALIGN_CENTRE|wxALL, 5 )
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ def ErrorDialogsDemoPanelFunc( parent, call_fit = true, set_sizer = true ):
|
|||||||
item0.AddWindow( item5, 0, wxALIGN_CENTRE|wxALL, 5 )
|
item0.AddWindow( item5, 0, wxALIGN_CENTRE|wxALL, 5 )
|
||||||
|
|
||||||
item6 = wxFlexGridSizer( 0, 2, 0, 0 )
|
item6 = wxFlexGridSizer( 0, 2, 0, 0 )
|
||||||
|
|
||||||
item7 = wxButton( parent, ID_BUTTON_wxPyFatalErrorDialog, "wxPyFatalErrorDialog", wxDefaultPosition, wxDefaultSize, 0 )
|
item7 = wxButton( parent, ID_BUTTON_wxPyFatalErrorDialog, "wxPyFatalErrorDialog", wxDefaultPosition, wxDefaultSize, 0 )
|
||||||
item6.AddWindow( item7, 0, wxALIGN_CENTRE|wxALL, 5 )
|
item6.AddWindow( item7, 0, wxALIGN_CENTRE|wxALL, 5 )
|
||||||
|
|
||||||
@@ -51,16 +51,16 @@ def ErrorDialogsDemoPanelFunc( parent, call_fit = true, set_sizer = true ):
|
|||||||
item0.AddSizer( item6, 0, wxALIGN_CENTRE|wxALL, 5 )
|
item0.AddSizer( item6, 0, wxALIGN_CENTRE|wxALL, 5 )
|
||||||
|
|
||||||
item11 = wxFlexGridSizer( 0, 2, 0, 0 )
|
item11 = wxFlexGridSizer( 0, 2, 0, 0 )
|
||||||
|
|
||||||
item0.AddSizer( item11, 0, wxALIGN_CENTRE|wxALL, 5 )
|
item0.AddSizer( item11, 0, wxALIGN_CENTRE|wxALL, 5 )
|
||||||
|
|
||||||
if set_sizer == true:
|
if set_sizer == True:
|
||||||
parent.SetAutoLayout( true )
|
parent.SetAutoLayout( True )
|
||||||
parent.SetSizer( item0 )
|
parent.SetSizer( item0 )
|
||||||
if call_fit == true:
|
if call_fit == True:
|
||||||
item0.Fit( parent )
|
item0.Fit( parent )
|
||||||
item0.SetSizeHints( parent )
|
item0.SetSizeHints( parent )
|
||||||
|
|
||||||
return item0
|
return item0
|
||||||
|
|
||||||
# Menu bar functions
|
# Menu bar functions
|
||||||
@@ -106,7 +106,7 @@ class MyPanel(wxPanel):
|
|||||||
ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback,
|
ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback,
|
||||||
self.DoDialog)
|
self.DoDialog)
|
||||||
EVT_CLOSE(self,self.OnClose)
|
EVT_CLOSE(self,self.OnClose)
|
||||||
|
|
||||||
IndexFromID = {
|
IndexFromID = {
|
||||||
ID_BUTTON_wxPyFatalErrorDialog: 3,
|
ID_BUTTON_wxPyFatalErrorDialog: 3,
|
||||||
ID_BUTTON_wxPyFatalErrorDialogWithTraceback: 2,
|
ID_BUTTON_wxPyFatalErrorDialogWithTraceback: 2,
|
||||||
@@ -158,9 +158,9 @@ class MyFrame(wxFrame):
|
|||||||
class MyApp(wxApp):
|
class MyApp(wxApp):
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
frame = MyFrame()
|
frame = MyFrame()
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
return true
|
return True
|
||||||
|
|
||||||
def runTest(pframe, nb, log):
|
def runTest(pframe, nb, log):
|
||||||
panel = MyPanel(nb)
|
panel = MyPanel(nb)
|
||||||
|
@@ -36,7 +36,7 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
def OnSelect(self, evt):
|
def OnSelect(self, evt):
|
||||||
face = self.lb1.GetStringSelection()
|
face = self.lb1.GetStringSelection()
|
||||||
font = wxFont(28, wxDEFAULT, wxDEFAULT, wxDEFAULT, false, face)
|
font = wxFont(28, wxDEFAULT, wxDEFAULT, wxDEFAULT, False, face)
|
||||||
self.txt.SetFont(font)
|
self.txt.SetFont(font)
|
||||||
self.txt.SetSize(self.txt.GetBestSize())
|
self.txt.SetSize(self.txt.GetBestSize())
|
||||||
|
|
||||||
|
@@ -28,12 +28,12 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
b = wxGenButton(self, -1, 'disabled')
|
b = wxGenButton(self, -1, 'disabled')
|
||||||
EVT_BUTTON(self, b.GetId(), self.OnButton)
|
EVT_BUTTON(self, b.GetId(), self.OnButton)
|
||||||
b.Enable(false)
|
b.Enable(False)
|
||||||
sizer.Add(b)
|
sizer.Add(b)
|
||||||
|
|
||||||
b = wxGenButton(self, -1, 'bigger')
|
b = wxGenButton(self, -1, 'bigger')
|
||||||
EVT_BUTTON(self, b.GetId(), self.OnBiggerButton)
|
EVT_BUTTON(self, b.GetId(), self.OnBiggerButton)
|
||||||
b.SetFont(wxFont(20, wxSWISS, wxNORMAL, wxBOLD, false))
|
b.SetFont(wxFont(20, wxSWISS, wxNORMAL, wxBOLD, False))
|
||||||
b.SetBezelWidth(5)
|
b.SetBezelWidth(5)
|
||||||
###b.SetBestSize()
|
###b.SetBestSize()
|
||||||
b.SetBackgroundColour("Navy")
|
b.SetBackgroundColour("Navy")
|
||||||
@@ -50,7 +50,7 @@ class TestPanel(wxPanel):
|
|||||||
b = wxGenBitmapButton(self, -1, bmp)
|
b = wxGenBitmapButton(self, -1, bmp)
|
||||||
EVT_BUTTON(self, b.GetId(), self.OnButton)
|
EVT_BUTTON(self, b.GetId(), self.OnButton)
|
||||||
sizer.Add(b)
|
sizer.Add(b)
|
||||||
b.Enable(FALSE)
|
b.Enable(False)
|
||||||
|
|
||||||
b = wxGenBitmapButton(self, -1, None)
|
b = wxGenBitmapButton(self, -1, None)
|
||||||
EVT_BUTTON(self, b.GetId(), self.OnButton)
|
EVT_BUTTON(self, b.GetId(), self.OnButton)
|
||||||
@@ -79,7 +79,7 @@ class TestPanel(wxPanel):
|
|||||||
mask = wxMaskColour(bmp, wxBLUE)
|
mask = wxMaskColour(bmp, wxBLUE)
|
||||||
bmp.SetMask(mask)
|
bmp.SetMask(mask)
|
||||||
b.SetBitmapSelected(bmp)
|
b.SetBitmapSelected(bmp)
|
||||||
b.SetToggle(true)
|
b.SetToggle(True)
|
||||||
b.SetBestSize()
|
b.SetBestSize()
|
||||||
sizer.Add(b)
|
sizer.Add(b)
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ class TestPanel(wxPanel):
|
|||||||
mask = wxMaskColour(bmp, wxBLUE)
|
mask = wxMaskColour(bmp, wxBLUE)
|
||||||
bmp.SetMask(mask)
|
bmp.SetMask(mask)
|
||||||
b.SetBitmapSelected(bmp)
|
b.SetBitmapSelected(bmp)
|
||||||
b.SetUseFocusIndicator(false)
|
b.SetUseFocusIndicator(False)
|
||||||
b.SetBestSize()
|
b.SetBestSize()
|
||||||
sizer.Add(b)
|
sizer.Add(b)
|
||||||
|
|
||||||
|
@@ -87,16 +87,16 @@ class MyCellEditor(wxPyGridCellEditor):
|
|||||||
|
|
||||||
def EndEdit(self, row, col, grid):
|
def EndEdit(self, row, col, grid):
|
||||||
"""
|
"""
|
||||||
Complete the editing of the current cell. Returns true if the value
|
Complete the editing of the current cell. Returns True if the value
|
||||||
has changed. If necessary, the control may be destroyed.
|
has changed. If necessary, the control may be destroyed.
|
||||||
*Must Override*
|
*Must Override*
|
||||||
"""
|
"""
|
||||||
self.log.write("MyCellEditor: EndEdit (%d,%d)\n" % (row, col))
|
self.log.write("MyCellEditor: EndEdit (%d,%d)\n" % (row, col))
|
||||||
changed = false
|
changed = False
|
||||||
|
|
||||||
val = self._tc.GetValue()
|
val = self._tc.GetValue()
|
||||||
if val != self.startValue:
|
if val != self.startValue:
|
||||||
changed = true
|
changed = True
|
||||||
grid.GetTable().SetValue(row, col, val) # update the table
|
grid.GetTable().SetValue(row, col, val) # update the table
|
||||||
|
|
||||||
self.startValue = ''
|
self.startValue = ''
|
||||||
@@ -116,7 +116,7 @@ class MyCellEditor(wxPyGridCellEditor):
|
|||||||
|
|
||||||
def IsAcceptedKey(self, evt):
|
def IsAcceptedKey(self, evt):
|
||||||
"""
|
"""
|
||||||
Return TRUE to allow the given key to start editing: the base class
|
Return True to allow the given key to start editing: the base class
|
||||||
version only checks that the event has no modifiers. F2 is special
|
version only checks that the event has no modifiers. F2 is special
|
||||||
and will always start the editor.
|
and will always start the editor.
|
||||||
"""
|
"""
|
||||||
@@ -228,7 +228,7 @@ if __name__ == '__main__':
|
|||||||
import sys
|
import sys
|
||||||
app = wxPySimpleApp()
|
app = wxPySimpleApp()
|
||||||
frame = TestFrame(None, sys.stdout)
|
frame = TestFrame(None, sys.stdout)
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -95,7 +95,7 @@ class CustomDataTable(wxPyGridTableBase):
|
|||||||
if typeName == colType:
|
if typeName == colType:
|
||||||
return true
|
return true
|
||||||
else:
|
else:
|
||||||
return false
|
return False
|
||||||
|
|
||||||
def CanSetValueAs(self, row, col, typeName):
|
def CanSetValueAs(self, row, col, typeName):
|
||||||
return self.CanGetValueAs(row, col, typeName)
|
return self.CanGetValueAs(row, col, typeName)
|
||||||
@@ -121,7 +121,7 @@ class CustTableGrid(wxGrid):
|
|||||||
|
|
||||||
self.SetRowLabelSize(0)
|
self.SetRowLabelSize(0)
|
||||||
self.SetMargins(0,0)
|
self.SetMargins(0,0)
|
||||||
self.AutoSizeColumns(false)
|
self.AutoSizeColumns(False)
|
||||||
|
|
||||||
EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
|
EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
|
||||||
|
|
||||||
|
@@ -151,7 +151,7 @@ class DragableGrid(wxGrid):
|
|||||||
# The second parameter means that the grid is to take ownership of the
|
# The second parameter means that the grid is to take ownership of the
|
||||||
# table and will destroy it when done. Otherwise you would need to keep
|
# table and will destroy it when done. Otherwise you would need to keep
|
||||||
# a reference to it and call it's Destroy method later.
|
# a reference to it and call it's Destroy method later.
|
||||||
self.SetTable(table, true)
|
self.SetTable(table, True)
|
||||||
|
|
||||||
# Enable Column moving
|
# Enable Column moving
|
||||||
wxGridColMover(self)
|
wxGridColMover(self)
|
||||||
@@ -187,7 +187,7 @@ if __name__ == '__main__':
|
|||||||
import sys
|
import sys
|
||||||
app = wxPySimpleApp()
|
app = wxPySimpleApp()
|
||||||
frame = TestFrame(None, sys.stdout)
|
frame = TestFrame(None, sys.stdout)
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
@@ -55,7 +55,7 @@ if __name__ == '__main__':
|
|||||||
import sys
|
import sys
|
||||||
app = wxPySimpleApp()
|
app = wxPySimpleApp()
|
||||||
frame = TestFrame(None, sys.stdout)
|
frame = TestFrame(None, sys.stdout)
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@ class HugeTable(wxPyGridTableBase):
|
|||||||
return 10000
|
return 10000
|
||||||
|
|
||||||
def IsEmptyCell(self, row, col):
|
def IsEmptyCell(self, row, col):
|
||||||
return false
|
return False
|
||||||
|
|
||||||
def GetValue(self, row, col):
|
def GetValue(self, row, col):
|
||||||
return str( (row, col) )
|
return str( (row, col) )
|
||||||
@@ -45,7 +45,7 @@ class HugeTableGrid(wxGrid):
|
|||||||
# The second parameter means that the grid is to take ownership of the
|
# The second parameter means that the grid is to take ownership of the
|
||||||
# table and will destroy it when done. Otherwise you would need to keep
|
# table and will destroy it when done. Otherwise you would need to keep
|
||||||
# a reference to it and call it's Destroy method later.
|
# a reference to it and call it's Destroy method later.
|
||||||
self.SetTable(table, true)
|
self.SetTable(table, True)
|
||||||
|
|
||||||
EVT_GRID_CELL_RIGHT_CLICK(self, self.OnRightDown) #added
|
EVT_GRID_CELL_RIGHT_CLICK(self, self.OnRightDown) #added
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ class TestFrame(wxFrame):
|
|||||||
wxFrame.__init__(self, parent, -1, "Huge (virtual) Table Demo", size=(640,480))
|
wxFrame.__init__(self, parent, -1, "Huge (virtual) Table Demo", size=(640,480))
|
||||||
grid = HugeTableGrid(self, log)
|
grid = HugeTableGrid(self, log)
|
||||||
|
|
||||||
grid.SetReadOnly(5,5, true)
|
grid.SetReadOnly(5,5, True)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ if __name__ == '__main__':
|
|||||||
import sys
|
import sys
|
||||||
app = wxPySimpleApp()
|
app = wxPySimpleApp()
|
||||||
frame = TestFrame(None, sys.stdout)
|
frame = TestFrame(None, sys.stdout)
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ class SimpleGrid(wxGrid): ##, wxGridAutoEditMixin):
|
|||||||
EVT_IDLE(self, self.OnIdle)
|
EVT_IDLE(self, self.OnIdle)
|
||||||
|
|
||||||
self.CreateGrid(25, 25) #, wxGrid.wxGridSelectRows)
|
self.CreateGrid(25, 25) #, wxGrid.wxGridSelectRows)
|
||||||
##self.EnableEditing(false)
|
##self.EnableEditing(False)
|
||||||
|
|
||||||
# simple cell formatting
|
# simple cell formatting
|
||||||
self.SetColSize(3, 200)
|
self.SetColSize(3, 200)
|
||||||
@@ -26,7 +26,7 @@ class SimpleGrid(wxGrid): ##, wxGridAutoEditMixin):
|
|||||||
self.SetCellFont(0, 0, wxFont(12, wxROMAN, wxITALIC, wxNORMAL))
|
self.SetCellFont(0, 0, wxFont(12, wxROMAN, wxITALIC, wxNORMAL))
|
||||||
self.SetCellTextColour(1, 1, wxRED)
|
self.SetCellTextColour(1, 1, wxRED)
|
||||||
self.SetCellBackgroundColour(2, 2, wxCYAN)
|
self.SetCellBackgroundColour(2, 2, wxCYAN)
|
||||||
self.SetReadOnly(3, 3, true)
|
self.SetReadOnly(3, 3, True)
|
||||||
|
|
||||||
self.SetCellEditor(5, 0, wxGridCellNumberEditor(1,1000))
|
self.SetCellEditor(5, 0, wxGridCellNumberEditor(1,1000))
|
||||||
self.SetCellValue(5, 0, "123")
|
self.SetCellValue(5, 0, "123")
|
||||||
@@ -224,7 +224,7 @@ if __name__ == '__main__':
|
|||||||
import sys
|
import sys
|
||||||
app = wxPySimpleApp()
|
app = wxPySimpleApp()
|
||||||
frame = TestFrame(None, sys.stdout)
|
frame = TestFrame(None, sys.stdout)
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -60,7 +60,7 @@ editorDemoData = [
|
|||||||
('wxGridCellBoolEditor', '1', wxGridCellBoolEditor, ()),
|
('wxGridCellBoolEditor', '1', wxGridCellBoolEditor, ()),
|
||||||
('wxGridCellChoiceEditor', 'one', wxGridCellChoiceEditor, (['one', 'two', 'three', 'four',
|
('wxGridCellChoiceEditor', 'one', wxGridCellChoiceEditor, (['one', 'two', 'three', 'four',
|
||||||
'kick', 'Microsoft', 'out the',
|
'kick', 'Microsoft', 'out the',
|
||||||
'door'], false)),
|
'door'], False)),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -139,15 +139,15 @@ Renderers used together.
|
|||||||
attr = wxGridCellAttr()
|
attr = wxGridCellAttr()
|
||||||
attr.SetFont(font)
|
attr.SetFont(font)
|
||||||
attr.SetBackgroundColour(wxLIGHT_GREY)
|
attr.SetBackgroundColour(wxLIGHT_GREY)
|
||||||
attr.SetReadOnly(true)
|
attr.SetReadOnly(True)
|
||||||
attr.SetAlignment(wxRIGHT, -1)
|
attr.SetAlignment(wxRIGHT, -1)
|
||||||
self.SetColAttr(renCol, attr)
|
self.SetColAttr(renCol, attr)
|
||||||
attr.IncRef()
|
attr.IncRef()
|
||||||
self.SetColAttr(edCol, attr)
|
self.SetColAttr(edCol, attr)
|
||||||
|
|
||||||
# There is a bug in wxGTK for this method...
|
# There is a bug in wxGTK for this method...
|
||||||
self.AutoSizeColumns(true)
|
self.AutoSizeColumns(True)
|
||||||
self.AutoSizeRows(true)
|
self.AutoSizeRows(True)
|
||||||
|
|
||||||
EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
|
EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ if __name__ == '__main__':
|
|||||||
import sys
|
import sys
|
||||||
app = wxPySimpleApp()
|
app = wxPySimpleApp()
|
||||||
frame = TestFrame(None, sys.stdout)
|
frame = TestFrame(None, sys.stdout)
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -21,38 +21,38 @@ class AnchorsDemoFrame(wxFrame):
|
|||||||
self._init_utils()
|
self._init_utils()
|
||||||
|
|
||||||
self.mainPanel = wxPanel(size = wxSize(320, 160), parent = self, id = wxID_ANCHORSDEMOFRAMEMAINPANEL, name = 'panel1', style = wxTAB_TRAVERSAL | wxCLIP_CHILDREN, pos = wxPoint(0, 0))
|
self.mainPanel = wxPanel(size = wxSize(320, 160), parent = self, id = wxID_ANCHORSDEMOFRAMEMAINPANEL, name = 'panel1', style = wxTAB_TRAVERSAL | wxCLIP_CHILDREN, pos = wxPoint(0, 0))
|
||||||
self.mainPanel.SetAutoLayout(true)
|
self.mainPanel.SetAutoLayout(True)
|
||||||
|
|
||||||
self.okButton = wxButton(label = 'OK', id = wxID_ANCHORSDEMOFRAMEOKBUTTON, parent = self.mainPanel, name = 'okButton', size = wxSize(72, 24), style = 0, pos = wxPoint(240, 128))
|
self.okButton = wxButton(label = 'OK', id = wxID_ANCHORSDEMOFRAMEOKBUTTON, parent = self.mainPanel, name = 'okButton', size = wxSize(72, 24), style = 0, pos = wxPoint(240, 128))
|
||||||
self.okButton.SetConstraints(LayoutAnchors(self.okButton, false, false, true, true))
|
self.okButton.SetConstraints(LayoutAnchors(self.okButton, False, False, True, True))
|
||||||
EVT_BUTTON(self.okButton, wxID_ANCHORSDEMOFRAMEOKBUTTON, self.OnOkButtonButton)
|
EVT_BUTTON(self.okButton, wxID_ANCHORSDEMOFRAMEOKBUTTON, self.OnOkButtonButton)
|
||||||
|
|
||||||
self.backgroundPanel = wxPanel(size = wxSize(304, 80), parent = self.mainPanel, id = wxID_ANCHORSDEMOFRAMEBACKGROUNDPANEL, name = 'backgroundPanel', style = wxSIMPLE_BORDER | wxCLIP_CHILDREN, pos = wxPoint(8, 40))
|
self.backgroundPanel = wxPanel(size = wxSize(304, 80), parent = self.mainPanel, id = wxID_ANCHORSDEMOFRAMEBACKGROUNDPANEL, name = 'backgroundPanel', style = wxSIMPLE_BORDER | wxCLIP_CHILDREN, pos = wxPoint(8, 40))
|
||||||
self.backgroundPanel.SetBackgroundColour(wxColour(255, 255, 255))
|
self.backgroundPanel.SetBackgroundColour(wxColour(255, 255, 255))
|
||||||
self.backgroundPanel.SetConstraints(LayoutAnchors(self.backgroundPanel, true, true, true, true))
|
self.backgroundPanel.SetConstraints(LayoutAnchors(self.backgroundPanel, True, True, True, True))
|
||||||
|
|
||||||
self.anchoredPanel = wxPanel(size = wxSize(88, 48), id = wxID_ANCHORSDEMOFRAMEANCHOREDPANEL, parent = self.backgroundPanel, name = 'anchoredPanel', style = wxSIMPLE_BORDER, pos = wxPoint(104, 16))
|
self.anchoredPanel = wxPanel(size = wxSize(88, 48), id = wxID_ANCHORSDEMOFRAMEANCHOREDPANEL, parent = self.backgroundPanel, name = 'anchoredPanel', style = wxSIMPLE_BORDER, pos = wxPoint(104, 16))
|
||||||
self.anchoredPanel.SetBackgroundColour(wxColour(0, 0, 222))
|
self.anchoredPanel.SetBackgroundColour(wxColour(0, 0, 222))
|
||||||
self.anchoredPanel.SetConstraints(LayoutAnchors(self.anchoredPanel, false, false, false, false))
|
self.anchoredPanel.SetConstraints(LayoutAnchors(self.anchoredPanel, False, False, False, False))
|
||||||
|
|
||||||
self.leftCheckBox = wxCheckBox(label = 'Left', id = wxID_ANCHORSDEMOFRAMELEFTCHECKBOX, parent = self.mainPanel, name = 'leftCheckBox', size = wxSize(40, 16), style = 0, pos = wxPoint(8, 8))
|
self.leftCheckBox = wxCheckBox(label = 'Left', id = wxID_ANCHORSDEMOFRAMELEFTCHECKBOX, parent = self.mainPanel, name = 'leftCheckBox', size = wxSize(40, 16), style = 0, pos = wxPoint(8, 8))
|
||||||
self.leftCheckBox.SetConstraints(LayoutAnchors(self.leftCheckBox, false, true, false, false))
|
self.leftCheckBox.SetConstraints(LayoutAnchors(self.leftCheckBox, False, True, False, False))
|
||||||
EVT_CHECKBOX(self.leftCheckBox, wxID_ANCHORSDEMOFRAMELEFTCHECKBOX, self.OnCheckboxCheckbox)
|
EVT_CHECKBOX(self.leftCheckBox, wxID_ANCHORSDEMOFRAMELEFTCHECKBOX, self.OnCheckboxCheckbox)
|
||||||
|
|
||||||
self.topCheckBox = wxCheckBox(label = 'Top', id = wxID_ANCHORSDEMOFRAMETOPCHECKBOX, parent = self.mainPanel, name = 'topCheckBox', size = wxSize(40, 16), style = 0, pos = wxPoint(88, 8))
|
self.topCheckBox = wxCheckBox(label = 'Top', id = wxID_ANCHORSDEMOFRAMETOPCHECKBOX, parent = self.mainPanel, name = 'topCheckBox', size = wxSize(40, 16), style = 0, pos = wxPoint(88, 8))
|
||||||
self.topCheckBox.SetConstraints(LayoutAnchors(self.topCheckBox, false, true, false, false))
|
self.topCheckBox.SetConstraints(LayoutAnchors(self.topCheckBox, False, True, False, False))
|
||||||
EVT_CHECKBOX(self.topCheckBox, wxID_ANCHORSDEMOFRAMETOPCHECKBOX, self.OnCheckboxCheckbox)
|
EVT_CHECKBOX(self.topCheckBox, wxID_ANCHORSDEMOFRAMETOPCHECKBOX, self.OnCheckboxCheckbox)
|
||||||
|
|
||||||
self.rightCheckBox = wxCheckBox(label = 'Right', id = wxID_ANCHORSDEMOFRAMERIGHTCHECKBOX, parent = self.mainPanel, name = 'rightCheckBox', size = wxSize(48, 16), style = 0, pos = wxPoint(168, 8))
|
self.rightCheckBox = wxCheckBox(label = 'Right', id = wxID_ANCHORSDEMOFRAMERIGHTCHECKBOX, parent = self.mainPanel, name = 'rightCheckBox', size = wxSize(48, 16), style = 0, pos = wxPoint(168, 8))
|
||||||
self.rightCheckBox.SetConstraints(LayoutAnchors(self.rightCheckBox, false, true, false, false))
|
self.rightCheckBox.SetConstraints(LayoutAnchors(self.rightCheckBox, False, True, False, False))
|
||||||
EVT_CHECKBOX(self.rightCheckBox, wxID_ANCHORSDEMOFRAMERIGHTCHECKBOX, self.OnCheckboxCheckbox)
|
EVT_CHECKBOX(self.rightCheckBox, wxID_ANCHORSDEMOFRAMERIGHTCHECKBOX, self.OnCheckboxCheckbox)
|
||||||
|
|
||||||
self.bottomCheckBox = wxCheckBox(label = 'Bottom', id = wxID_ANCHORSDEMOFRAMEBOTTOMCHECKBOX, parent = self.mainPanel, name = 'bottomCheckBox', size = wxSize(56, 16), style = 0, pos = wxPoint(248, 8))
|
self.bottomCheckBox = wxCheckBox(label = 'Bottom', id = wxID_ANCHORSDEMOFRAMEBOTTOMCHECKBOX, parent = self.mainPanel, name = 'bottomCheckBox', size = wxSize(56, 16), style = 0, pos = wxPoint(248, 8))
|
||||||
self.bottomCheckBox.SetConstraints(LayoutAnchors(self.bottomCheckBox, false, true, false, false))
|
self.bottomCheckBox.SetConstraints(LayoutAnchors(self.bottomCheckBox, False, True, False, False))
|
||||||
EVT_CHECKBOX(self.bottomCheckBox, wxID_ANCHORSDEMOFRAMEBOTTOMCHECKBOX, self.OnCheckboxCheckbox)
|
EVT_CHECKBOX(self.bottomCheckBox, wxID_ANCHORSDEMOFRAMEBOTTOMCHECKBOX, self.OnCheckboxCheckbox)
|
||||||
|
|
||||||
self.helpStaticText = wxStaticText(label = 'Select anchor options above, then resize window to see the effect', id = wxID_ANCHORSDEMOFRAMEHELPSTATICTEXT, parent = self.mainPanel, name = 'helpStaticText', size = wxSize(224, 24), style = wxST_NO_AUTORESIZE, pos = wxPoint(8, 128))
|
self.helpStaticText = wxStaticText(label = 'Select anchor options above, then resize window to see the effect', id = wxID_ANCHORSDEMOFRAMEHELPSTATICTEXT, parent = self.mainPanel, name = 'helpStaticText', size = wxSize(224, 24), style = wxST_NO_AUTORESIZE, pos = wxPoint(8, 128))
|
||||||
self.helpStaticText.SetConstraints(LayoutAnchors(self.helpStaticText, true, false, true, true))
|
self.helpStaticText.SetConstraints(LayoutAnchors(self.helpStaticText, True, False, True, True))
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
self._init_ctrls(parent)
|
self._init_ctrls(parent)
|
||||||
@@ -71,7 +71,7 @@ class AnchorsDemoFrame(wxFrame):
|
|||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
win = AnchorsDemoFrame(frame)
|
win = AnchorsDemoFrame(frame)
|
||||||
frame.otherWin = win
|
frame.otherWin = win
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@ class TestLayoutf(wxPanel):
|
|||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wxPanel.__init__(self, parent, -1)
|
wxPanel.__init__(self, parent, -1)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
EVT_BUTTON(self, 100, self.OnButton)
|
EVT_BUTTON(self, 100, self.OnButton)
|
||||||
|
|
||||||
self.panelA = wxWindow(self, -1, wxPyDefaultPosition, wxPyDefaultSize, wxSIMPLE_BORDER)
|
self.panelA = wxWindow(self, -1, wxPyDefaultPosition, wxPyDefaultSize, wxSIMPLE_BORDER)
|
||||||
|
@@ -33,14 +33,14 @@ class MyParentFrame(wxMDIParentFrame):
|
|||||||
|
|
||||||
|
|
||||||
def OnExit(self, evt):
|
def OnExit(self, evt):
|
||||||
self.Close(true)
|
self.Close(True)
|
||||||
|
|
||||||
|
|
||||||
def OnNewWindow(self, evt):
|
def OnNewWindow(self, evt):
|
||||||
self.winCount = self.winCount + 1
|
self.winCount = self.winCount + 1
|
||||||
win = wxMDIChildFrame(self, -1, "Child Window: %d" % self.winCount)
|
win = wxMDIChildFrame(self, -1, "Child Window: %d" % self.winCount)
|
||||||
canvas = MyCanvas(win)
|
canvas = MyCanvas(win)
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
|
|
||||||
def OnEraseBackground(self, evt):
|
def OnEraseBackground(self, evt):
|
||||||
@@ -68,9 +68,9 @@ if __name__ == '__main__':
|
|||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
wxInitAllImageHandlers()
|
wxInitAllImageHandlers()
|
||||||
frame = MyParentFrame()
|
frame = MyParentFrame()
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
return true
|
return True
|
||||||
|
|
||||||
|
|
||||||
app = MyApp(0)
|
app = MyApp(0)
|
||||||
|
@@ -44,7 +44,7 @@ class MyParentFrame(wxMDIParentFrame):
|
|||||||
win.SetOrientation(wxLAYOUT_HORIZONTAL)
|
win.SetOrientation(wxLAYOUT_HORIZONTAL)
|
||||||
win.SetAlignment(wxLAYOUT_TOP)
|
win.SetAlignment(wxLAYOUT_TOP)
|
||||||
win.SetBackgroundColour(wxColour(255, 0, 0))
|
win.SetBackgroundColour(wxColour(255, 0, 0))
|
||||||
win.SetSashVisible(wxSASH_BOTTOM, true)
|
win.SetSashVisible(wxSASH_BOTTOM, True)
|
||||||
|
|
||||||
self.topWindow = win
|
self.topWindow = win
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ class MyParentFrame(wxMDIParentFrame):
|
|||||||
win.SetOrientation(wxLAYOUT_HORIZONTAL)
|
win.SetOrientation(wxLAYOUT_HORIZONTAL)
|
||||||
win.SetAlignment(wxLAYOUT_BOTTOM)
|
win.SetAlignment(wxLAYOUT_BOTTOM)
|
||||||
win.SetBackgroundColour(wxColour(0, 0, 255))
|
win.SetBackgroundColour(wxColour(0, 0, 255))
|
||||||
win.SetSashVisible(wxSASH_TOP, true)
|
win.SetSashVisible(wxSASH_TOP, True)
|
||||||
|
|
||||||
self.bottomWindow = win
|
self.bottomWindow = win
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ class MyParentFrame(wxMDIParentFrame):
|
|||||||
win.SetOrientation(wxLAYOUT_VERTICAL)
|
win.SetOrientation(wxLAYOUT_VERTICAL)
|
||||||
win.SetAlignment(wxLAYOUT_LEFT)
|
win.SetAlignment(wxLAYOUT_LEFT)
|
||||||
win.SetBackgroundColour(wxColour(0, 255, 0))
|
win.SetBackgroundColour(wxColour(0, 255, 0))
|
||||||
win.SetSashVisible(wxSASH_RIGHT, TRUE)
|
win.SetSashVisible(wxSASH_RIGHT, True)
|
||||||
win.SetExtraBorderSize(10)
|
win.SetExtraBorderSize(10)
|
||||||
textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
|
textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
|
||||||
wxTE_MULTILINE|wxSUNKEN_BORDER)
|
wxTE_MULTILINE|wxSUNKEN_BORDER)
|
||||||
@@ -81,7 +81,7 @@ class MyParentFrame(wxMDIParentFrame):
|
|||||||
win.SetOrientation(wxLAYOUT_VERTICAL)
|
win.SetOrientation(wxLAYOUT_VERTICAL)
|
||||||
win.SetAlignment(wxLAYOUT_LEFT)
|
win.SetAlignment(wxLAYOUT_LEFT)
|
||||||
win.SetBackgroundColour(wxColour(0, 255, 255))
|
win.SetBackgroundColour(wxColour(0, 255, 255))
|
||||||
win.SetSashVisible(wxSASH_RIGHT, TRUE)
|
win.SetSashVisible(wxSASH_RIGHT, True)
|
||||||
|
|
||||||
self.leftWindow2 = win
|
self.leftWindow2 = win
|
||||||
|
|
||||||
@@ -113,14 +113,14 @@ class MyParentFrame(wxMDIParentFrame):
|
|||||||
|
|
||||||
|
|
||||||
def OnExit(self, evt):
|
def OnExit(self, evt):
|
||||||
self.Close(true)
|
self.Close(True)
|
||||||
|
|
||||||
|
|
||||||
def OnNewWindow(self, evt):
|
def OnNewWindow(self, evt):
|
||||||
self.winCount = self.winCount + 1
|
self.winCount = self.winCount + 1
|
||||||
win = wxMDIChildFrame(self, -1, "Child Window: %d" % self.winCount)
|
win = wxMDIChildFrame(self, -1, "Child Window: %d" % self.winCount)
|
||||||
canvas = MyCanvas(win)
|
canvas = MyCanvas(win)
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
@@ -130,9 +130,9 @@ if __name__ == '__main__':
|
|||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
wxInitAllImageHandlers()
|
wxInitAllImageHandlers()
|
||||||
frame = MyParentFrame()
|
frame = MyParentFrame()
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
return true
|
return True
|
||||||
|
|
||||||
|
|
||||||
app = MyApp(0)
|
app = MyApp(0)
|
||||||
|
@@ -270,8 +270,8 @@ class wxPythonDemo(wxFrame):
|
|||||||
EVT_ERASE_BACKGROUND(splitter, EmptyHandler)
|
EVT_ERASE_BACKGROUND(splitter, EmptyHandler)
|
||||||
EVT_ERASE_BACKGROUND(splitter2, EmptyHandler)
|
EVT_ERASE_BACKGROUND(splitter2, EmptyHandler)
|
||||||
|
|
||||||
# Prevent TreeCtrl from displaying all items after destruction when true
|
# Prevent TreeCtrl from displaying all items after destruction when True
|
||||||
self.dying = false
|
self.dying = False
|
||||||
|
|
||||||
# Make a File menu
|
# Make a File menu
|
||||||
self.mainmenu = wxMenuBar()
|
self.mainmenu = wxMenuBar()
|
||||||
@@ -313,12 +313,14 @@ class wxPythonDemo(wxFrame):
|
|||||||
|
|
||||||
self.finddata = wxFindReplaceData()
|
self.finddata = wxFindReplaceData()
|
||||||
|
|
||||||
# set the menu accellerator table...
|
if 0:
|
||||||
aTable = wxAcceleratorTable([(wxACCEL_ALT, ord('X'), exitID),
|
# This is another way to set Accelerators, in addition to
|
||||||
(wxACCEL_CTRL, ord('H'), helpID),
|
# using the '\t<key>' syntax in the menu items.
|
||||||
(wxACCEL_CTRL, ord('F'), findID),
|
aTable = wxAcceleratorTable([(wxACCEL_ALT, ord('X'), exitID),
|
||||||
(wxACCEL_NORMAL, WXK_F3, findnextID)])
|
(wxACCEL_CTRL, ord('H'), helpID),
|
||||||
self.SetAcceleratorTable(aTable)
|
(wxACCEL_CTRL, ord('F'), findID),
|
||||||
|
(wxACCEL_NORMAL, WXK_F3, findnextID)])
|
||||||
|
self.SetAcceleratorTable(aTable)
|
||||||
|
|
||||||
|
|
||||||
# Create a TreeCtrl
|
# Create a TreeCtrl
|
||||||
@@ -393,7 +395,7 @@ class wxPythonDemo(wxFrame):
|
|||||||
#wxLog_SetActiveTarget(wxLogStderr())
|
#wxLog_SetActiveTarget(wxLogStderr())
|
||||||
#wxLog_SetTraceMask(wxTraceMessages)
|
#wxLog_SetTraceMask(wxTraceMessages)
|
||||||
|
|
||||||
self.Show(true)
|
self.Show(True)
|
||||||
|
|
||||||
|
|
||||||
# add the windows to the splitter and split it.
|
# add the windows to the splitter and split it.
|
||||||
@@ -548,7 +550,7 @@ class wxPythonDemo(wxFrame):
|
|||||||
wxFR_NOUPDOWN |
|
wxFR_NOUPDOWN |
|
||||||
wxFR_NOMATCHCASE |
|
wxFR_NOMATCHCASE |
|
||||||
wxFR_NOWHOLEWORD)
|
wxFR_NOWHOLEWORD)
|
||||||
self.finddlg.Show(true)
|
self.finddlg.Show(True)
|
||||||
|
|
||||||
def OnFind(self, event):
|
def OnFind(self, event):
|
||||||
self.nb.SetSelection(1)
|
self.nb.SetSelection(1)
|
||||||
@@ -590,7 +592,7 @@ class wxPythonDemo(wxFrame):
|
|||||||
|
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
def OnCloseWindow(self, event):
|
def OnCloseWindow(self, event):
|
||||||
self.dying = true
|
self.dying = True
|
||||||
self.window = None
|
self.window = None
|
||||||
self.mainmenu = None
|
self.mainmenu = None
|
||||||
if hasattr(self, "tbicon"):
|
if hasattr(self, "tbicon"):
|
||||||
@@ -635,9 +637,9 @@ class wxPythonDemo(wxFrame):
|
|||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
def OnTaskBarActivate(self, evt):
|
def OnTaskBarActivate(self, evt):
|
||||||
if self.IsIconized():
|
if self.IsIconized():
|
||||||
self.Iconize(false)
|
self.Iconize(False)
|
||||||
if not self.IsShown():
|
if not self.IsShown():
|
||||||
self.Show(true)
|
self.Show(True)
|
||||||
self.Raise()
|
self.Raise()
|
||||||
|
|
||||||
#---------------------------------------------
|
#---------------------------------------------
|
||||||
@@ -688,7 +690,7 @@ class MySplashScreen(wxSplashScreen):
|
|||||||
|
|
||||||
def OnClose(self, evt):
|
def OnClose(self, evt):
|
||||||
frame = wxPythonDemo(None, -1, "wxPython: (A Demonstration)")
|
frame = wxPythonDemo(None, -1, "wxPython: (A Demonstration)")
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
evt.Skip() # Make sure the default handler runs too...
|
evt.Skip() # Make sure the default handler runs too...
|
||||||
|
|
||||||
|
|
||||||
@@ -701,7 +703,7 @@ class MyApp(wxApp):
|
|||||||
wxInitAllImageHandlers()
|
wxInitAllImageHandlers()
|
||||||
splash = MySplashScreen()
|
splash = MySplashScreen()
|
||||||
splash.Show()
|
splash.Show()
|
||||||
return true
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -30,7 +30,7 @@ class TestPanel(wxPanel):
|
|||||||
sizer.Add(btns, 0, wxEXPAND|wxALL, 15)
|
sizer.Add(btns, 0, wxEXPAND|wxALL, 15)
|
||||||
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
|
|
||||||
self.sizer = sizer # save it for testing later
|
self.sizer = sizer # save it for testing later
|
||||||
|
|
||||||
|
@@ -33,9 +33,9 @@ class MyPrintout(wxPrintout):
|
|||||||
def HasPage(self, page):
|
def HasPage(self, page):
|
||||||
self.log.WriteText("wxPrintout.HasPage: %d\n" % page)
|
self.log.WriteText("wxPrintout.HasPage: %d\n" % page)
|
||||||
if page <= 2:
|
if page <= 2:
|
||||||
return true
|
return True
|
||||||
else:
|
else:
|
||||||
return false
|
return False
|
||||||
|
|
||||||
def GetPageInfo(self):
|
def GetPageInfo(self):
|
||||||
self.log.WriteText("wxPrintout.GetPageInfo\n")
|
self.log.WriteText("wxPrintout.GetPageInfo\n")
|
||||||
@@ -82,7 +82,7 @@ class MyPrintout(wxPrintout):
|
|||||||
self.canvas.DoDrawing(dc)
|
self.canvas.DoDrawing(dc)
|
||||||
dc.DrawText("Page: %d" % page, marginX/2, maxY-marginY)
|
dc.DrawText("Page: %d" % page, marginX/2, maxY-marginY)
|
||||||
|
|
||||||
return true
|
return True
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
@@ -117,14 +117,14 @@ class TestPrintPanel(wxPanel):
|
|||||||
|
|
||||||
self.box.Add(subbox, 0, wxGROW)
|
self.box.Add(subbox, 0, wxGROW)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(self.box)
|
self.SetSizer(self.box)
|
||||||
|
|
||||||
|
|
||||||
def OnPrintSetup(self, event):
|
def OnPrintSetup(self, event):
|
||||||
printerDialog = wxPrintDialog(self)
|
printerDialog = wxPrintDialog(self)
|
||||||
printerDialog.GetPrintDialogData().SetPrintData(self.printData)
|
printerDialog.GetPrintDialogData().SetPrintData(self.printData)
|
||||||
printerDialog.GetPrintDialogData().SetSetupDialog(true)
|
printerDialog.GetPrintDialogData().SetSetupDialog(True)
|
||||||
printerDialog.ShowModal();
|
printerDialog.ShowModal();
|
||||||
self.printData = printerDialog.GetPrintDialogData().GetPrintData()
|
self.printData = printerDialog.GetPrintDialogData().GetPrintData()
|
||||||
printerDialog.Destroy()
|
printerDialog.Destroy()
|
||||||
@@ -144,7 +144,7 @@ class TestPrintPanel(wxPanel):
|
|||||||
frame.Initialize()
|
frame.Initialize()
|
||||||
frame.SetPosition(self.frame.GetPosition())
|
frame.SetPosition(self.frame.GetPosition())
|
||||||
frame.SetSize(self.frame.GetSize())
|
frame.SetSize(self.frame.GetSize())
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@ class TestPanel(wxPanel):
|
|||||||
sizer.AddSpacer(10,10, pos=(13,1))
|
sizer.AddSpacer(10,10, pos=(13,1))
|
||||||
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
@@ -39,7 +39,7 @@ class ScrolledPanel(wxScrolledWindow):
|
|||||||
|
|
||||||
# The following is all that is needed to integrate the sizer and the
|
# The following is all that is needed to integrate the sizer and the
|
||||||
# scrolled window. In this case we will only support vertical scrolling.
|
# scrolled window. In this case we will only support vertical scrolling.
|
||||||
self.EnableScrolling(false, true)
|
self.EnableScrolling(False, True)
|
||||||
self.SetScrollRate(0, 20)
|
self.SetScrollRate(0, 20)
|
||||||
box.SetVirtualSizeHints(self)
|
box.SetVirtualSizeHints(self)
|
||||||
EVT_CHILD_FOCUS(self, self.OnChildFocus)
|
EVT_CHILD_FOCUS(self, self.OnChildFocus)
|
||||||
|
@@ -479,16 +479,16 @@ class TestFrame(wxFrame):
|
|||||||
self.SetStatusText("Resize this frame to see how the sizers respond...")
|
self.SetStatusText("Resize this frame to see how the sizers respond...")
|
||||||
self.sizer.Fit(self)
|
self.sizer.Fit(self)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(self.sizer)
|
self.SetSizer(self.sizer)
|
||||||
EVT_CLOSE(self, self.OnCloseWindow)
|
EVT_CLOSE(self, self.OnCloseWindow)
|
||||||
|
|
||||||
def OnCloseWindow(self, event):
|
def OnCloseWindow(self, event):
|
||||||
self.MakeModal(false)
|
self.MakeModal(False)
|
||||||
self.Destroy()
|
self.Destroy()
|
||||||
|
|
||||||
def OnButton(self, event):
|
def OnButton(self, event):
|
||||||
self.Close(true)
|
self.Close(True)
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -531,8 +531,8 @@ class TestSelectionPanel(wxPanel):
|
|||||||
if func:
|
if func:
|
||||||
win = TestFrame(self, title, func)
|
win = TestFrame(self, title, func)
|
||||||
win.CentreOnParent(wxBOTH)
|
win.CentreOnParent(wxBOTH)
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
win.MakeModal(true)
|
win.MakeModal(True)
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -570,15 +570,15 @@ if __name__ == '__main__':
|
|||||||
self.Destroy()
|
self.Destroy()
|
||||||
|
|
||||||
def OnExit(self, event):
|
def OnExit(self, event):
|
||||||
self.Close(true)
|
self.Close(True)
|
||||||
|
|
||||||
|
|
||||||
class TestApp(wxApp):
|
class TestApp(wxApp):
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
frame = MainFrame()
|
frame = MainFrame()
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
return true
|
return True
|
||||||
|
|
||||||
app = TestApp(0)
|
app = TestApp(0)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
@@ -201,8 +201,8 @@ class AppFrame(wxFrame):
|
|||||||
EVT_MENU(self, 212, self.OnViewArticle)
|
EVT_MENU(self, 212, self.OnViewArticle)
|
||||||
self.mainmenu.Append(menu, '&View')
|
self.mainmenu.Append(menu, '&View')
|
||||||
menu = wxMenu()
|
menu = wxMenu()
|
||||||
menu.Append(220, '&Internal', 'Use internal text browser',TRUE)
|
menu.Append(220, '&Internal', 'Use internal text browser',True)
|
||||||
menu.Check(220, true)
|
menu.Check(220, True)
|
||||||
self.UseInternal = 1;
|
self.UseInternal = 1;
|
||||||
EVT_MENU(self, 220, self.OnBrowserInternal)
|
EVT_MENU(self, 220, self.OnBrowserInternal)
|
||||||
menu.Append(222, '&Settings...', 'External browser Settings')
|
menu.Append(222, '&Settings...', 'External browser Settings')
|
||||||
@@ -279,7 +279,7 @@ class AppFrame(wxFrame):
|
|||||||
if self.UseInternal:
|
if self.UseInternal:
|
||||||
self.view = HTMLTextView(self, -1, 'slashdot.org',
|
self.view = HTMLTextView(self, -1, 'slashdot.org',
|
||||||
'http://slashdot.org')
|
'http://slashdot.org')
|
||||||
self.view.Show(true)
|
self.view.Show(True)
|
||||||
else:
|
else:
|
||||||
self.logprint(self.BrowserSettings % ('http://slashdot.org'))
|
self.logprint(self.BrowserSettings % ('http://slashdot.org'))
|
||||||
#os.system(self.BrowserSettings % ('http://slashdot.org'))
|
#os.system(self.BrowserSettings % ('http://slashdot.org'))
|
||||||
@@ -296,7 +296,7 @@ class AppFrame(wxFrame):
|
|||||||
url = self.url[self.current]
|
url = self.url[self.current]
|
||||||
if self.UseInternal:
|
if self.UseInternal:
|
||||||
self.view = HTMLTextView(self, -1, url, url)
|
self.view = HTMLTextView(self, -1, url, url)
|
||||||
self.view.Show(true)
|
self.view.Show(True)
|
||||||
else:
|
else:
|
||||||
self.logprint(self.BrowserSettings % (url))
|
self.logprint(self.BrowserSettings % (url))
|
||||||
os.system(self.BrowserSettings % (url))
|
os.system(self.BrowserSettings % (url))
|
||||||
@@ -353,9 +353,9 @@ if __name__ == '__main__':
|
|||||||
class MyApp(wxApp):
|
class MyApp(wxApp):
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
frame = AppFrame(None, -1, "Slashdot Breaking News")
|
frame = AppFrame(None, -1, "Slashdot Breaking News")
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
return true
|
return True
|
||||||
|
|
||||||
app = MyApp(0)
|
app = MyApp(0)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
@@ -368,7 +368,7 @@ if __name__ == '__main__':
|
|||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
win = AppFrame(None, -1, "Slashdot Breaking News")
|
win = AppFrame(None, -1, "Slashdot Breaking News")
|
||||||
frame.otherWin = win
|
frame.otherWin = win
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
|
|
||||||
overview = __doc__
|
overview = __doc__
|
||||||
|
@@ -78,14 +78,14 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
splitter.SplitVertically(tree, valueWindow, 150)
|
splitter.SplitVertically(tree, valueWindow, 150)
|
||||||
scroller.SetTargetWindow(tree)
|
scroller.SetTargetWindow(tree)
|
||||||
scroller.EnableScrolling(FALSE, FALSE)
|
scroller.EnableScrolling(False, False)
|
||||||
|
|
||||||
valueWindow.SetTreeCtrl(tree)
|
valueWindow.SetTreeCtrl(tree)
|
||||||
tree.SetCompanionWindow(valueWindow)
|
tree.SetCompanionWindow(valueWindow)
|
||||||
|
|
||||||
sizer = wxBoxSizer(wxVERTICAL)
|
sizer = wxBoxSizer(wxVERTICAL)
|
||||||
sizer.Add(scroller, 1, wxEXPAND|wxALL, 25)
|
sizer.Add(scroller, 1, wxEXPAND|wxALL, 25)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ class TablePanel(wxPanel):
|
|||||||
box.Add(btn, 0, wxALIGN_CENTER|wxALL, 15)
|
box.Add(btn, 0, wxALIGN_CENTER|wxALL, 15)
|
||||||
EVT_BUTTON(self, k, self.OnButton)
|
EVT_BUTTON(self, k, self.OnButton)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(box)
|
self.SetSizer(box)
|
||||||
|
|
||||||
def OnButton(self, evt):
|
def OnButton(self, evt):
|
||||||
|
@@ -30,11 +30,11 @@ class CalcBarThread:
|
|||||||
self.val = val
|
self.val = val
|
||||||
|
|
||||||
def Start(self):
|
def Start(self):
|
||||||
self.keepGoing = self.running = true
|
self.keepGoing = self.running = True
|
||||||
thread.start_new_thread(self.Run, ())
|
thread.start_new_thread(self.Run, ())
|
||||||
|
|
||||||
def Stop(self):
|
def Stop(self):
|
||||||
self.keepGoing = false
|
self.keepGoing = False
|
||||||
|
|
||||||
def IsRunning(self):
|
def IsRunning(self):
|
||||||
return self.running
|
return self.running
|
||||||
@@ -57,7 +57,7 @@ class CalcBarThread:
|
|||||||
if self.val < 0: self.val = 0
|
if self.val < 0: self.val = 0
|
||||||
if self.val > 300: self.val = 300
|
if self.val > 300: self.val = 300
|
||||||
|
|
||||||
self.running = false
|
self.running = False
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ class TestFrame(wxFrame):
|
|||||||
sizer.Add(self.graph, 1, wxEXPAND)
|
sizer.Add(self.graph, 1, wxEXPAND)
|
||||||
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
sizer.Fit(self)
|
sizer.Fit(self)
|
||||||
|
|
||||||
EVT_UPDATE_BARGRAPH(self, self.OnUpdate)
|
EVT_UPDATE_BARGRAPH(self, self.OnUpdate)
|
||||||
@@ -194,7 +194,7 @@ class TestFrame(wxFrame):
|
|||||||
|
|
||||||
def OnUpdate(self, evt):
|
def OnUpdate(self, evt):
|
||||||
self.graph.SetValue(evt.barNum, evt.value)
|
self.graph.SetValue(evt.barNum, evt.value)
|
||||||
self.graph.Refresh(false)
|
self.graph.Refresh(False)
|
||||||
|
|
||||||
|
|
||||||
def OnCloseWindow(self, evt):
|
def OnCloseWindow(self, evt):
|
||||||
@@ -217,7 +217,7 @@ class TestFrame(wxFrame):
|
|||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
win = TestFrame(frame, log)
|
win = TestFrame(frame, log)
|
||||||
frame.otherWin = win
|
frame.otherWin = win
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
@@ -43,7 +43,7 @@ class TestPanel(wxPanel):
|
|||||||
self.throbbers['autoreverse']['throbber'] = Throbber(self, -1,
|
self.throbbers['autoreverse']['throbber'] = Throbber(self, -1,
|
||||||
images, #size=(36, 36),
|
images, #size=(36, 36),
|
||||||
frameDelay = 0.1,
|
frameDelay = 0.1,
|
||||||
reverse = true)
|
reverse = True)
|
||||||
self.throbbers['autoreverse']['throbber'].sequence.append(0)
|
self.throbbers['autoreverse']['throbber'].sequence.append(0)
|
||||||
self.throbbers['label']['throbber'] = Throbber(self, -1,
|
self.throbbers['label']['throbber'] = Throbber(self, -1,
|
||||||
images, #size=(36, 36),
|
images, #size=(36, 36),
|
||||||
@@ -113,7 +113,7 @@ class TestPanel(wxPanel):
|
|||||||
flag = wxALIGN_CENTER)
|
flag = wxALIGN_CENTER)
|
||||||
|
|
||||||
self.SetSizer(box)
|
self.SetSizer(box)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.Layout()
|
self.Layout()
|
||||||
sizer.SetSizeHints(self)
|
sizer.SetSizeHints(self)
|
||||||
sizer.Fit(self)
|
sizer.Fit(self)
|
||||||
|
@@ -30,12 +30,12 @@ class TestPanel(wxPanel):
|
|||||||
def __init__(self, parent, log):
|
def __init__(self, parent, log):
|
||||||
wxPanel.__init__(self, parent, -1)
|
wxPanel.__init__(self, parent, -1)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
outsideSizer = wxBoxSizer(wxVERTICAL)
|
outsideSizer = wxBoxSizer(wxVERTICAL)
|
||||||
|
|
||||||
msg = "Drag-And-Drop of URLs"
|
msg = "Drag-And-Drop of URLs"
|
||||||
text = wxStaticText(self, -1, "", style=wxALIGN_CENTRE)
|
text = wxStaticText(self, -1, "", style=wxALIGN_CENTRE)
|
||||||
text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, false))
|
text.SetFont(wxFont(24, wxSWISS, wxNORMAL, wxBOLD, False))
|
||||||
text.SetLabel(msg)
|
text.SetLabel(msg)
|
||||||
w,h = text.GetTextExtent(msg)
|
w,h = text.GetTextExtent(msg)
|
||||||
text.SetSize(wxSize(w,h+1))
|
text.SetSize(wxSize(w,h+1))
|
||||||
@@ -44,7 +44,7 @@ class TestPanel(wxPanel):
|
|||||||
outsideSizer.Add(wxStaticLine(self, -1), 0, wxEXPAND)
|
outsideSizer.Add(wxStaticLine(self, -1), 0, wxEXPAND)
|
||||||
outsideSizer.Add(20,20)
|
outsideSizer.Add(20,20)
|
||||||
|
|
||||||
self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, false))
|
self.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False))
|
||||||
|
|
||||||
inSizer = wxFlexGridSizer(2, 2, 5, 5)
|
inSizer = wxFlexGridSizer(2, 2, 5, 5)
|
||||||
inSizer.AddGrowableCol(0)
|
inSizer.AddGrowableCol(0)
|
||||||
|
@@ -56,7 +56,7 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
f = self.GetFont()
|
f = self.GetFont()
|
||||||
font = wxFont(14, f.GetFamily(), f.GetStyle(), wxBOLD, false,
|
font = wxFont(14, f.GetFamily(), f.GetStyle(), wxBOLD, False,
|
||||||
f.GetFaceName(), f.GetEncoding())
|
f.GetFaceName(), f.GetEncoding())
|
||||||
|
|
||||||
self.AddLine(box)
|
self.AddLine(box)
|
||||||
@@ -79,7 +79,7 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
border = wxBoxSizer(wxVERTICAL)
|
border = wxBoxSizer(wxVERTICAL)
|
||||||
border.Add(box, 1, wxEXPAND|wxALL, 10)
|
border.Add(box, 1, wxEXPAND|wxALL, 10)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(border)
|
self.SetSizer(border)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -11,9 +11,9 @@ try:
|
|||||||
else:
|
else:
|
||||||
from xml.parsers import pyexpat
|
from xml.parsers import pyexpat
|
||||||
parsermodule = pyexpat
|
parsermodule = pyexpat
|
||||||
haveXML = true
|
haveXML = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
haveXML = false
|
haveXML = False
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ class MyFrame(wxFrame):
|
|||||||
|
|
||||||
|
|
||||||
def OnCloseWindow(self, event):
|
def OnCloseWindow(self, event):
|
||||||
app.keepGoing = false
|
app.keepGoing = False
|
||||||
self.Destroy()
|
self.Destroy()
|
||||||
|
|
||||||
def OnIdle(self, event):
|
def OnIdle(self, event):
|
||||||
@@ -104,12 +104,12 @@ class MyApp(wxApp):
|
|||||||
|
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
frame = MyFrame(None, -1, "This is a test")
|
frame = MyFrame(None, -1, "This is a test")
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
|
|
||||||
self.keepGoing = true
|
self.keepGoing = True
|
||||||
|
|
||||||
return true
|
return True
|
||||||
|
|
||||||
|
|
||||||
app = MyApp(0)
|
app = MyApp(0)
|
||||||
|
@@ -292,7 +292,7 @@ class MyFrame(wxFrame):
|
|||||||
menubar = wxMenuBar()
|
menubar = wxMenuBar()
|
||||||
menubar.Append(menu, "Game")
|
menubar.Append(menu, "Game")
|
||||||
menu = wxMenu()
|
menu = wxMenu()
|
||||||
#menu.Append(1010, "Internal", "Use internal dictionary", TRUE)
|
#menu.Append(1010, "Internal", "Use internal dictionary", True)
|
||||||
menu.Append(1011, "ASCII File...")
|
menu.Append(1011, "ASCII File...")
|
||||||
urls = [ 'wxPython home', 'http://wxPython.org/',
|
urls = [ 'wxPython home', 'http://wxPython.org/',
|
||||||
'slashdot.org', 'http://slashdot.org/',
|
'slashdot.org', 'http://slashdot.org/',
|
||||||
@@ -349,7 +349,7 @@ class MyFrame(wxFrame):
|
|||||||
|
|
||||||
def OnGameDemo(self, event):
|
def OnGameDemo(self, event):
|
||||||
frame = HangmanDemoFrame(self.wf, self, -1, wxDefaultPosition, self.GetSize())
|
frame = HangmanDemoFrame(self.wf, self, -1, wxDefaultPosition, self.GetSize())
|
||||||
frame.Show(TRUE)
|
frame.Show(True)
|
||||||
|
|
||||||
def OnDictFile(self, event):
|
def OnDictFile(self, event):
|
||||||
fd = wxFileDialog(self)
|
fd = wxFileDialog(self)
|
||||||
@@ -433,8 +433,8 @@ class MyApp(wxApp):
|
|||||||
wf = WordFetcher(defaultfile)
|
wf = WordFetcher(defaultfile)
|
||||||
frame = MyFrame(None, wf)
|
frame = MyFrame(None, wf)
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
frame.Show(TRUE)
|
frame.Show(True)
|
||||||
return TRUE
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -458,7 +458,7 @@ def runTest(frame, nb, log):
|
|||||||
wf = WordFetcher(defaultfile)
|
wf = WordFetcher(defaultfile)
|
||||||
win = MyFrame(frame, wf)
|
win = MyFrame(frame, wf)
|
||||||
frame.otherWin = win
|
frame.otherWin = win
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
@@ -82,14 +82,14 @@ if __name__ == "__main__":
|
|||||||
outputWindowClass = wxPyInformationalMessagesFrame
|
outputWindowClass = wxPyInformationalMessagesFrame
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
frame = MyFrame(self.stdioWin)
|
frame = MyFrame(self.stdioWin)
|
||||||
frame.Show(TRUE)
|
frame.Show(True)
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
if isinstance(sys.stdout,wxPyInformationalMessagesFrame):
|
if isinstance(sys.stdout,wxPyInformationalMessagesFrame):
|
||||||
sys.stdout.SetParent(frame)
|
sys.stdout.SetParent(frame)
|
||||||
#self.redirectStdio(None)# this is done automatically
|
#self.redirectStdio(None)# this is done automatically
|
||||||
# by the MyApp(1) call below
|
# by the MyApp(1) call below
|
||||||
print "Starting.\n",
|
print "Starting.\n",
|
||||||
return true
|
return True
|
||||||
|
|
||||||
app = MyApp(1)
|
app = MyApp(1)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
@@ -78,7 +78,7 @@ class pyTree(wx.wxTreeCtrl):
|
|||||||
wx.wxTreeCtrl.__init__(self, parent, id)
|
wx.wxTreeCtrl.__init__(self, parent, id)
|
||||||
self.root = self.AddRoot(str(root), -1, -1, wx.wxTreeItemData(root))
|
self.root = self.AddRoot(str(root), -1, -1, wx.wxTreeItemData(root))
|
||||||
if dir(root):
|
if dir(root):
|
||||||
self.SetItemHasChildren(self.root, wx.TRUE)
|
self.SetItemHasChildren(self.root, wx.True)
|
||||||
wx.EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.OnItemExpanding)
|
wx.EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.OnItemExpanding)
|
||||||
wx.EVT_TREE_ITEM_COLLAPSED(self, self.GetId(), self.OnItemCollapsed)
|
wx.EVT_TREE_ITEM_COLLAPSED(self, self.GetId(), self.OnItemCollapsed)
|
||||||
wx.EVT_TREE_SEL_CHANGED(self, self.GetId(), self.OnSelChanged)
|
wx.EVT_TREE_SEL_CHANGED(self, self.GetId(), self.OnSelChanged)
|
||||||
@@ -121,7 +121,7 @@ class pyTree(wx.wxTreeCtrl):
|
|||||||
new_item = self.AppendItem( item, key, -1, -1,
|
new_item = self.AppendItem( item, key, -1, -1,
|
||||||
wx.wxTreeItemData(new_obj) )
|
wx.wxTreeItemData(new_obj) )
|
||||||
if dir(new_obj):
|
if dir(new_obj):
|
||||||
self.SetItemHasChildren(new_item, wx.TRUE)
|
self.SetItemHasChildren(new_item, wx.True)
|
||||||
|
|
||||||
def OnItemCollapsed(self, event):
|
def OnItemCollapsed(self, event):
|
||||||
"""
|
"""
|
||||||
@@ -205,9 +205,9 @@ if __name__ == '__main__':
|
|||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
"""OnInit. Boring, boring, boring!"""
|
"""OnInit. Boring, boring, boring!"""
|
||||||
frame = MyFrame()
|
frame = MyFrame()
|
||||||
frame.Show(wx.TRUE)
|
frame.Show(wx.True)
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
return wx.TRUE
|
return wx.True
|
||||||
|
|
||||||
app = MyApp(0)
|
app = MyApp(0)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
@@ -51,7 +51,7 @@ class RunDemoApp(wxApp):
|
|||||||
EVT_MENU(self, 101, self.OnButton)
|
EVT_MENU(self, 101, self.OnButton)
|
||||||
menuBar.Append(menu, "&File")
|
menuBar.Append(menu, "&File")
|
||||||
frame.SetMenuBar(menuBar)
|
frame.SetMenuBar(menuBar)
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
EVT_CLOSE(frame, self.OnCloseFrame)
|
EVT_CLOSE(frame, self.OnCloseFrame)
|
||||||
|
|
||||||
win = self.demoModule.runTest(frame, frame, Log())
|
win = self.demoModule.runTest(frame, frame, Log())
|
||||||
@@ -75,17 +75,17 @@ class RunDemoApp(wxApp):
|
|||||||
# It was probably a dialog or something that is already
|
# It was probably a dialog or something that is already
|
||||||
# gone, so we're done.
|
# gone, so we're done.
|
||||||
frame.Destroy()
|
frame.Destroy()
|
||||||
return true
|
return True
|
||||||
|
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
self.frame = frame
|
self.frame = frame
|
||||||
#wxLog_SetActiveTarget(wxLogStderr())
|
#wxLog_SetActiveTarget(wxLogStderr())
|
||||||
#wxLog_SetTraceMask(wxTraceMessages)
|
#wxLog_SetTraceMask(wxTraceMessages)
|
||||||
return true
|
return True
|
||||||
|
|
||||||
|
|
||||||
def OnButton(self, evt):
|
def OnButton(self, evt):
|
||||||
self.frame.Close(true)
|
self.frame.Close(True)
|
||||||
|
|
||||||
|
|
||||||
def OnCloseFrame(self, evt):
|
def OnCloseFrame(self, evt):
|
||||||
|
@@ -33,7 +33,7 @@ class MyFrame(wxFrame):
|
|||||||
sizer.Add(text, 0, wxALL, 10)
|
sizer.Add(text, 0, wxALL, 10)
|
||||||
sizer.Add(btn, 0, wxALL, 10)
|
sizer.Add(btn, 0, wxALL, 10)
|
||||||
panel.SetSizer(sizer)
|
panel.SetSizer(sizer)
|
||||||
panel.SetAutoLayout(true)
|
panel.SetAutoLayout(True)
|
||||||
panel.Layout()
|
panel.Layout()
|
||||||
|
|
||||||
EVT_BUTTON(self, btn.GetId(), self.OnButton)
|
EVT_BUTTON(self, btn.GetId(), self.OnButton)
|
||||||
@@ -46,6 +46,6 @@ class MyFrame(wxFrame):
|
|||||||
|
|
||||||
app = wxPySimpleApp()
|
app = wxPySimpleApp()
|
||||||
frame = MyFrame(None, "Simple wxPython App")
|
frame = MyFrame(None, "Simple wxPython App")
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
|
||||||
|
@@ -59,11 +59,11 @@ class SecondThreadApp(wxApp):
|
|||||||
catcher = HiddenCatcher()
|
catcher = HiddenCatcher()
|
||||||
#self.SetTopWindow(catcher)
|
#self.SetTopWindow(catcher)
|
||||||
self.catcher =catcher
|
self.catcher =catcher
|
||||||
return true
|
return True
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
def add_cone():
|
def add_cone():
|
||||||
frame = VtkFrame(None, -1, "Cone")
|
frame = VtkFrame(None, -1, "Cone")
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
|
|
||||||
|
@@ -75,7 +75,7 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
# set attributes of calendar
|
# set attributes of calendar
|
||||||
|
|
||||||
self.calend.hide_title = TRUE
|
self.calend.hide_title = True
|
||||||
self.calend.HideGrid()
|
self.calend.HideGrid()
|
||||||
self.calend.SetWeekColor('WHITE', 'BLACK')
|
self.calend.SetWeekColor('WHITE', 'BLACK')
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
mID = NewId()
|
mID = NewId()
|
||||||
self.scroll = wxScrollBar(self, mID, wxPoint(100, 240), wxSize(200, 20), wxSB_HORIZONTAL)
|
self.scroll = wxScrollBar(self, mID, wxPoint(100, 240), wxSize(200, 20), wxSB_HORIZONTAL)
|
||||||
self.scroll.SetScrollbar(start_month-1, 1, 12, 1, TRUE)
|
self.scroll.SetScrollbar(start_month-1, 1, 12, 1, True)
|
||||||
EVT_COMMAND_SCROLL(self, mID, self.Scroll)
|
EVT_COMMAND_SCROLL(self, mID, self.Scroll)
|
||||||
|
|
||||||
# spin control for year selection
|
# spin control for year selection
|
||||||
@@ -147,8 +147,8 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
def TestFrame(self, event):
|
def TestFrame(self, event):
|
||||||
frame = CalendFrame(self, -1, "Test Calendar", self.log)
|
frame = CalendFrame(self, -1, "Test Calendar", self.log)
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
return true
|
return True
|
||||||
|
|
||||||
# calendar print preview
|
# calendar print preview
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ class TestPanel(wxPanel):
|
|||||||
name = event.GetString()
|
name = event.GetString()
|
||||||
self.log.WriteText('EvtComboBox: %s\n' % name)
|
self.log.WriteText('EvtComboBox: %s\n' % name)
|
||||||
monthval = self.date.FindString(name)
|
monthval = self.date.FindString(name)
|
||||||
self.scroll.SetScrollbar(monthval, 1, 12, 1, TRUE)
|
self.scroll.SetScrollbar(monthval, 1, 12, 1, True)
|
||||||
|
|
||||||
self.calend.SetMonth(monthval+1)
|
self.calend.SetMonth(monthval+1)
|
||||||
self.ResetDisplay()
|
self.ResetDisplay()
|
||||||
@@ -366,8 +366,8 @@ class PrintCalend:
|
|||||||
self.sel_lst = [] # highlighted selected days
|
self.sel_lst = [] # highlighted selected days
|
||||||
|
|
||||||
self.size = None
|
self.size = None
|
||||||
self.hide_title = FALSE
|
self.hide_title = False
|
||||||
self.hide_grid = FALSE
|
self.hide_grid = False
|
||||||
self.set_day = None
|
self.set_day = None
|
||||||
|
|
||||||
def SetParms(self):
|
def SetParms(self):
|
||||||
@@ -416,7 +416,7 @@ class PrintCalend:
|
|||||||
frame.Initialize()
|
frame.Initialize()
|
||||||
frame.SetPosition(self.frame.GetPosition())
|
frame.SetPosition(self.frame.GetPosition())
|
||||||
frame.SetSize(self.frame.GetSize())
|
frame.SetSize(self.frame.GetSize())
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
|
|
||||||
def Print(self):
|
def Print(self):
|
||||||
pdd = wxPrintDialogData()
|
pdd = wxPrintDialogData()
|
||||||
@@ -438,7 +438,7 @@ class PrintCalend:
|
|||||||
|
|
||||||
if self.preview is None:
|
if self.preview is None:
|
||||||
cal.SetPSize(size[0]/self.pagew, size[1]/self.pageh)
|
cal.SetPSize(size[0]/self.pagew, size[1]/self.pageh)
|
||||||
cal.SetPreview(FALSE)
|
cal.SetPreview(False)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if self.preview == 1:
|
if self.preview == 1:
|
||||||
@@ -454,7 +454,7 @@ class PrintCalend:
|
|||||||
cal.grid_color = self.grid_color
|
cal.grid_color = self.grid_color
|
||||||
cal.high_color = self.high_color
|
cal.high_color = self.high_color
|
||||||
cal.back_color = self.back_color
|
cal.back_color = self.back_color
|
||||||
cal.outer_border = FALSE
|
cal.outer_border = False
|
||||||
cal.font = self.font
|
cal.font = self.font
|
||||||
cal.bold = self.bold
|
cal.bold = self.bold
|
||||||
|
|
||||||
@@ -534,9 +534,9 @@ class SetPrintout(wxPrintout):
|
|||||||
|
|
||||||
def HasPage(self, page):
|
def HasPage(self, page):
|
||||||
if page <= self.end_pg:
|
if page <= self.end_pg:
|
||||||
return true
|
return True
|
||||||
else:
|
else:
|
||||||
return false
|
return False
|
||||||
|
|
||||||
def GetPageInfo(self):
|
def GetPageInfo(self):
|
||||||
self.end_pg = self.canvas.GetTotalPages()
|
self.end_pg = self.canvas.GetTotalPages()
|
||||||
@@ -594,14 +594,14 @@ class SetPrintout(wxPrintout):
|
|||||||
self.canvas.SetPageSize(self.psizew, self.psizeh)
|
self.canvas.SetPageSize(self.psizew, self.psizeh)
|
||||||
|
|
||||||
self.canvas.DoDrawing(dc)
|
self.canvas.DoDrawing(dc)
|
||||||
return true
|
return True
|
||||||
|
|
||||||
class MyApp(wxApp):
|
class MyApp(wxApp):
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
frame = CalendFrame(None, -1, "Test Calendar")
|
frame = CalendFrame(None, -1, "Test Calendar")
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
return true
|
return True
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ class TestCheckBox(wxPanel):
|
|||||||
cID = NewId()
|
cID = NewId()
|
||||||
cb1 = wxCheckBox(self, cID, " Apples", wxPoint(65, 40), wxSize(150, 20), wxNO_BORDER)
|
cb1 = wxCheckBox(self, cID, " Apples", wxPoint(65, 40), wxSize(150, 20), wxNO_BORDER)
|
||||||
cb2 = wxCheckBox(self, cID+1, " Oranges", wxPoint(65, 60), wxSize(150, 20), wxNO_BORDER)
|
cb2 = wxCheckBox(self, cID+1, " Oranges", wxPoint(65, 60), wxSize(150, 20), wxNO_BORDER)
|
||||||
cb2.SetValue(true)
|
cb2.SetValue(True)
|
||||||
cb3 = wxCheckBox(self, cID+2, " Pears", wxPoint(65, 80), wxSize(150, 20), wxNO_BORDER)
|
cb3 = wxCheckBox(self, cID+2, " Pears", wxPoint(65, 80), wxSize(150, 20), wxNO_BORDER)
|
||||||
|
|
||||||
EVT_CHECKBOX(self, cID, self.EvtCheckBox)
|
EVT_CHECKBOX(self, cID, self.EvtCheckBox)
|
||||||
|
@@ -45,7 +45,7 @@ class TestPanel(wxPanel):
|
|||||||
item = wxMenuItem(menu, wxNewId(), "If supported, this is bold")
|
item = wxMenuItem(menu, wxNewId(), "If supported, this is bold")
|
||||||
df = wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT)
|
df = wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT)
|
||||||
nf = wxFont(df.GetPointSize(), df.GetFamily(), df.GetStyle(), wxBOLD,
|
nf = wxFont(df.GetPointSize(), df.GetFamily(), df.GetStyle(), wxBOLD,
|
||||||
false, df.GetFaceName())
|
False, df.GetFaceName())
|
||||||
item.SetFont(nf)
|
item.SetFont(nf)
|
||||||
menu.AppendItem(item)
|
menu.AppendItem(item)
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ from wxPython.wx import *
|
|||||||
|
|
||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
dlg = wxColourDialog(frame)
|
dlg = wxColourDialog(frame)
|
||||||
dlg.GetColourData().SetChooseFull(true)
|
dlg.GetColourData().SetChooseFull(True)
|
||||||
if dlg.ShowModal() == wxID_OK:
|
if dlg.ShowModal() == wxID_OK:
|
||||||
data = dlg.GetColourData()
|
data = dlg.GetColourData()
|
||||||
log.WriteText('You selected: %s\n' % str(data.GetColour().Get()))
|
log.WriteText('You selected: %s\n' % str(data.GetColour().Get()))
|
||||||
|
@@ -84,7 +84,7 @@ class TestDialog(wxDialog):
|
|||||||
sizer.AddSizer(box, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5)
|
sizer.AddSizer(box, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5)
|
||||||
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
sizer.Fit(self)
|
sizer.Fit(self)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -9,9 +9,9 @@ class DragShape:
|
|||||||
def __init__(self, bmp):
|
def __init__(self, bmp):
|
||||||
self.bmp = bmp
|
self.bmp = bmp
|
||||||
self.pos = wxPoint(0,0)
|
self.pos = wxPoint(0,0)
|
||||||
self.shown = true
|
self.shown = True
|
||||||
self.text = None
|
self.text = None
|
||||||
self.fullscreen = false
|
self.fullscreen = False
|
||||||
|
|
||||||
|
|
||||||
def HitTest(self, pt):
|
def HitTest(self, pt):
|
||||||
@@ -31,11 +31,11 @@ class DragShape:
|
|||||||
|
|
||||||
dc.Blit(self.pos.x, self.pos.y,
|
dc.Blit(self.pos.x, self.pos.y,
|
||||||
self.bmp.GetWidth(), self.bmp.GetHeight(),
|
self.bmp.GetWidth(), self.bmp.GetHeight(),
|
||||||
memDC, 0, 0, op, true)
|
memDC, 0, 0, op, True)
|
||||||
|
|
||||||
return true
|
return True
|
||||||
else:
|
else:
|
||||||
return false
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ class DragCanvas(wxScrolledWindow):
|
|||||||
bmp = images.getTestStarBitmap()
|
bmp = images.getTestStarBitmap()
|
||||||
shape = DragShape(bmp)
|
shape = DragShape(bmp)
|
||||||
shape.pos = wxPoint(5, 5)
|
shape.pos = wxPoint(5, 5)
|
||||||
shape.fullscreen = true
|
shape.fullscreen = True
|
||||||
self.shapes.append(shape)
|
self.shapes.append(shape)
|
||||||
|
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ class DragCanvas(wxScrolledWindow):
|
|||||||
|
|
||||||
# reposition and draw the shape
|
# reposition and draw the shape
|
||||||
self.dragShape.pos = self.dragShape.pos + evt.GetPosition() - self.dragStartPos
|
self.dragShape.pos = self.dragShape.pos + evt.GetPosition() - self.dragStartPos
|
||||||
self.dragShape.shown = true
|
self.dragShape.shown = True
|
||||||
self.dragShape.Draw(dc)
|
self.dragShape.Draw(dc)
|
||||||
self.dragShape = None
|
self.dragShape = None
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ class DragCanvas(wxScrolledWindow):
|
|||||||
|
|
||||||
# erase the shape since it will be drawn independently now
|
# erase the shape since it will be drawn independently now
|
||||||
dc = wxClientDC(self)
|
dc = wxClientDC(self)
|
||||||
self.dragShape.shown = false
|
self.dragShape.shown = False
|
||||||
self.EraseShape(self.dragShape, dc)
|
self.EraseShape(self.dragShape, dc)
|
||||||
|
|
||||||
|
|
||||||
@@ -228,16 +228,16 @@ class DragCanvas(wxScrolledWindow):
|
|||||||
# if we have shape and image then move it, posibly highlighting another shape.
|
# if we have shape and image then move it, posibly highlighting another shape.
|
||||||
elif self.dragShape and self.dragImage:
|
elif self.dragShape and self.dragImage:
|
||||||
onShape = self.FindShape(evt.GetPosition())
|
onShape = self.FindShape(evt.GetPosition())
|
||||||
unhiliteOld = false
|
unhiliteOld = False
|
||||||
hiliteNew = false
|
hiliteNew = False
|
||||||
|
|
||||||
# figure out what to hilite and what to unhilite
|
# figure out what to hilite and what to unhilite
|
||||||
if self.hiliteShape:
|
if self.hiliteShape:
|
||||||
if onShape is None or self.hiliteShape is not onShape:
|
if onShape is None or self.hiliteShape is not onShape:
|
||||||
unhiliteOld = true
|
unhiliteOld = True
|
||||||
|
|
||||||
if onShape and onShape is not self.hiliteShape and onShape.shown:
|
if onShape and onShape is not self.hiliteShape and onShape.shown:
|
||||||
hiliteNew = TRUE
|
hiliteNew = True
|
||||||
|
|
||||||
# if needed, hide the drag image so we can update the window
|
# if needed, hide the drag image so we can update the window
|
||||||
if unhiliteOld or hiliteNew:
|
if unhiliteOld or hiliteNew:
|
||||||
|
@@ -10,7 +10,7 @@ def runTest(frame, nb, log):
|
|||||||
box = wxBoxSizer(wxVERTICAL)
|
box = wxBoxSizer(wxVERTICAL)
|
||||||
box.Add(ed, 1, wxALL|wxGROW, 1)
|
box.Add(ed, 1, wxALL|wxGROW, 1)
|
||||||
win.SetSizer(box)
|
win.SetSizer(box)
|
||||||
win.SetAutoLayout(true)
|
win.SetAutoLayout(True)
|
||||||
|
|
||||||
ed.SetText(["",
|
ed.SetText(["",
|
||||||
"This is a simple text editor, the class name is",
|
"This is a simple text editor, the class name is",
|
||||||
|
@@ -37,7 +37,7 @@ class TestPanel(wxPanel):
|
|||||||
box.Add(t, 0, wxCENTER|wxALL, 5)
|
box.Add(t, 0, wxCENTER|wxALL, 5)
|
||||||
|
|
||||||
self.SetSizer(box)
|
self.SetSizer(box)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
|
|
||||||
# Make a menu
|
# Make a menu
|
||||||
self.menu = m = wxMenu()
|
self.menu = m = wxMenu()
|
||||||
@@ -46,10 +46,10 @@ class TestPanel(wxPanel):
|
|||||||
m.Append(wxID_CLOSE, "&Close")
|
m.Append(wxID_CLOSE, "&Close")
|
||||||
m.Append(wxID_SAVE, "&Save")
|
m.Append(wxID_SAVE, "&Save")
|
||||||
m.Append(wxID_SAVEAS, "Save &as...")
|
m.Append(wxID_SAVEAS, "Save &as...")
|
||||||
m.Enable(wxID_NEW, false)
|
m.Enable(wxID_NEW, False)
|
||||||
m.Enable(wxID_CLOSE, false)
|
m.Enable(wxID_CLOSE, False)
|
||||||
m.Enable(wxID_SAVE, false)
|
m.Enable(wxID_SAVE, False)
|
||||||
m.Enable(wxID_SAVEAS, false)
|
m.Enable(wxID_SAVEAS, False)
|
||||||
|
|
||||||
# and a file history
|
# and a file history
|
||||||
self.filehistory = wxFileHistory()
|
self.filehistory = wxFileHistory()
|
||||||
|
@@ -25,14 +25,14 @@ class TestPanel(wxPanel):
|
|||||||
data = wxFindReplaceData()
|
data = wxFindReplaceData()
|
||||||
dlg = wxFindReplaceDialog(self, data, "Find")
|
dlg = wxFindReplaceDialog(self, data, "Find")
|
||||||
dlg.data = data # save a reference to it...
|
dlg.data = data # save a reference to it...
|
||||||
dlg.Show(true)
|
dlg.Show(True)
|
||||||
|
|
||||||
|
|
||||||
def OnShowFindReplace(self, evt):
|
def OnShowFindReplace(self, evt):
|
||||||
data = wxFindReplaceData()
|
data = wxFindReplaceData()
|
||||||
dlg = wxFindReplaceDialog(self, data, "Find & Replace", wxFR_REPLACEDIALOG)
|
dlg = wxFindReplaceDialog(self, data, "Find & Replace", wxFR_REPLACEDIALOG)
|
||||||
dlg.data = data # save a reference to it...
|
dlg.data = data # save a reference to it...
|
||||||
dlg.Show(true)
|
dlg.Show(True)
|
||||||
|
|
||||||
|
|
||||||
def OnFind(self, evt):
|
def OnFind(self, evt):
|
||||||
|
@@ -70,7 +70,7 @@ class TestFloatBar(wxFrame):
|
|||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
win = TestFloatBar(frame, log)
|
win = TestFloatBar(frame, log)
|
||||||
frame.otherWin = win
|
frame.otherWin = win
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -82,7 +82,7 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
def OnSelectFont(self, evt):
|
def OnSelectFont(self, evt):
|
||||||
data = wxFontData()
|
data = wxFontData()
|
||||||
data.EnableEffects(true)
|
data.EnableEffects(True)
|
||||||
data.SetColour(self.curClr) # set colour
|
data.SetColour(self.curClr) # set colour
|
||||||
data.SetInitialFont(self.curFont)
|
data.SetInitialFont(self.curFont)
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ class MyFrame(wxFrame):
|
|||||||
|
|
||||||
|
|
||||||
def OnCloseMe(self, event):
|
def OnCloseMe(self, event):
|
||||||
self.Close(true)
|
self.Close(True)
|
||||||
|
|
||||||
def OnCloseWindow(self, event):
|
def OnCloseWindow(self, event):
|
||||||
self.Destroy()
|
self.Destroy()
|
||||||
@@ -27,7 +27,7 @@ def runTest(frame, nb, log):
|
|||||||
win = MyFrame(frame, -1, "This is a wxFrame", size=(350, 200),
|
win = MyFrame(frame, -1, "This is a wxFrame", size=(350, 200),
|
||||||
style = wxDEFAULT_FRAME_STYLE)# | wxFRAME_TOOL_WINDOW )
|
style = wxDEFAULT_FRAME_STYLE)# | wxFRAME_TOOL_WINDOW )
|
||||||
frame.otherWin = win
|
frame.otherWin = win
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
@@ -1,18 +1,18 @@
|
|||||||
from wxPython.wx import *
|
from wxPython.wx import *
|
||||||
try:
|
try:
|
||||||
from wxPython.glcanvas import *
|
from wxPython.glcanvas import *
|
||||||
haveGLCanvas = true
|
haveGLCanvas = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
haveGLCanvas = false
|
haveGLCanvas = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# The Python OpenGL package can be found at
|
# The Python OpenGL package can be found at
|
||||||
# http://PyOpenGL.sourceforge.net/
|
# http://PyOpenGL.sourceforge.net/
|
||||||
from OpenGL.GL import *
|
from OpenGL.GL import *
|
||||||
from OpenGL.GLUT import *
|
from OpenGL.GLUT import *
|
||||||
haveOpenGL = true
|
haveOpenGL = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
haveOpenGL = false
|
haveOpenGL = False
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ else:
|
|||||||
c.SetSize((200, 200))
|
c.SetSize((200, 200))
|
||||||
box.Add(c, 0, wxALIGN_CENTER|wxALL, 15)
|
box.Add(c, 0, wxALIGN_CENTER|wxALL, 15)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(box)
|
self.SetSizer(box)
|
||||||
|
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ else:
|
|||||||
canvasClass = eval(canvasClassName)
|
canvasClass = eval(canvasClassName)
|
||||||
frame = wxFrame(None, -1, canvasClassName, size=(400,400))
|
frame = wxFrame(None, -1, canvasClassName, size=(400,400))
|
||||||
canvas = canvasClass(frame)
|
canvas = canvasClass(frame)
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ else:
|
|||||||
class MyCanvasBase(wxGLCanvas):
|
class MyCanvasBase(wxGLCanvas):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wxGLCanvas.__init__(self, parent, -1)
|
wxGLCanvas.__init__(self, parent, -1)
|
||||||
self.init = false
|
self.init = False
|
||||||
# initial mouse position
|
# initial mouse position
|
||||||
self.lastx = self.x = 30
|
self.lastx = self.x = 30
|
||||||
self.lasty = self.y = 30
|
self.lasty = self.y = 30
|
||||||
@@ -110,7 +110,7 @@ else:
|
|||||||
self.SetCurrent()
|
self.SetCurrent()
|
||||||
if not self.init:
|
if not self.init:
|
||||||
self.InitGL()
|
self.InitGL()
|
||||||
self.init = true
|
self.init = True
|
||||||
self.OnDraw()
|
self.OnDraw()
|
||||||
|
|
||||||
def OnMouseDown(self, evt):
|
def OnMouseDown(self, evt):
|
||||||
@@ -123,7 +123,7 @@ else:
|
|||||||
if evt.Dragging() and evt.LeftIsDown():
|
if evt.Dragging() and evt.LeftIsDown():
|
||||||
self.x, self.y = self.lastx, self.lasty
|
self.x, self.y = self.lastx, self.lasty
|
||||||
self.x, self.y = evt.GetPosition()
|
self.x, self.y = evt.GetPosition()
|
||||||
self.Refresh(false)
|
self.Refresh(False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -268,9 +268,9 @@ def _test():
|
|||||||
frame = wxFrame(None, -1, "GL Demos", wxDefaultPosition, wxSize(600,300))
|
frame = wxFrame(None, -1, "GL Demos", wxDefaultPosition, wxSize(600,300))
|
||||||
#win = ConeCanvas(frame)
|
#win = ConeCanvas(frame)
|
||||||
MySplitter(frame)
|
MySplitter(frame)
|
||||||
frame.Show(TRUE)
|
frame.Show(True)
|
||||||
self.SetTopWindow(frame)
|
self.SetTopWindow(frame)
|
||||||
return TRUE
|
return True
|
||||||
|
|
||||||
app = MyApp(0)
|
app = MyApp(0)
|
||||||
app.MainLoop()
|
app.MainLoop()
|
||||||
|
@@ -37,7 +37,7 @@ class TestPanel(wxPanel):
|
|||||||
sz.AddGrowableCol(1)
|
sz.AddGrowableCol(1)
|
||||||
sz.AddGrowableCol(2)
|
sz.AddGrowableCol(2)
|
||||||
self.SetSizer(sz)
|
self.SetSizer(sz)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
@@ -29,7 +29,7 @@ class ButtonPanel(wxPanel):
|
|||||||
box.Add(btn, 0, wxALIGN_CENTER|wxALL, 15)
|
box.Add(btn, 0, wxALIGN_CENTER|wxALL, 15)
|
||||||
EVT_BUTTON(self, k, self.OnButton)
|
EVT_BUTTON(self, k, self.OnButton)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(box)
|
self.SetSizer(box)
|
||||||
|
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ class ButtonPanel(wxPanel):
|
|||||||
modName = buttonDefs[evt.GetId()][0]
|
modName = buttonDefs[evt.GetId()][0]
|
||||||
module = __import__(modName)
|
module = __import__(modName)
|
||||||
frame = module.TestFrame(None, self.log)
|
frame = module.TestFrame(None, self.log)
|
||||||
frame.Show(true)
|
frame.Show(True)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
@@ -52,9 +52,9 @@ class MyHtmlFilter(wxHtmlFilter):
|
|||||||
# This method decides if this filter is able to read the file
|
# This method decides if this filter is able to read the file
|
||||||
def CanRead(self, fsfile):
|
def CanRead(self, fsfile):
|
||||||
self.log.write("CanRead: %s\n" % fsfile.GetMimeType())
|
self.log.write("CanRead: %s\n" % fsfile.GetMimeType())
|
||||||
return FALSE
|
return False
|
||||||
|
|
||||||
# If CanRead returns true then this method is called to actually
|
# If CanRead returns True then this method is called to actually
|
||||||
# read the file and return the contents.
|
# read the file and return the contents.
|
||||||
def ReadFile(self, fsfile):
|
def ReadFile(self, fsfile):
|
||||||
return ""
|
return ""
|
||||||
@@ -114,7 +114,7 @@ class TestHtmlPanel(wxPanel):
|
|||||||
|
|
||||||
self.box.Add(subbox, 0, wxGROW)
|
self.box.Add(subbox, 0, wxGROW)
|
||||||
self.SetSizer(self.box)
|
self.SetSizer(self.box)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
|
|
||||||
# A button with this ID is created on the widget test page.
|
# A button with this ID is created on the widget test page.
|
||||||
EVT_BUTTON(self, wxID_OK, self.OnOk)
|
EVT_BUTTON(self, wxID_OK, self.OnOk)
|
||||||
|
@@ -68,7 +68,7 @@ class TestPanel(wxWindow):
|
|||||||
self.location.Append(self.current)
|
self.location.Append(self.current)
|
||||||
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
EVT_SIZE(self, self.OnSize)
|
EVT_SIZE(self, self.OnSize)
|
||||||
|
|
||||||
# Hook up the event handlers for the IE window
|
# Hook up the event handlers for the IE window
|
||||||
|
@@ -12,11 +12,11 @@ class TestPanel( wxPanel ):
|
|||||||
|
|
||||||
self.set_min = wxCheckBox( panel, -1, "Set minimum value:" )
|
self.set_min = wxCheckBox( panel, -1, "Set minimum value:" )
|
||||||
self.min = wxIntCtrl( panel, size=wxSize( 50, -1 ) )
|
self.min = wxIntCtrl( panel, size=wxSize( 50, -1 ) )
|
||||||
self.min.Enable( FALSE )
|
self.min.Enable( False )
|
||||||
|
|
||||||
self.set_max = wxCheckBox( panel, -1, "Set maximum value:" )
|
self.set_max = wxCheckBox( panel, -1, "Set maximum value:" )
|
||||||
self.max = wxIntCtrl( panel, size=wxSize( 50, -1 ) )
|
self.max = wxIntCtrl( panel, size=wxSize( 50, -1 ) )
|
||||||
self.max.Enable( FALSE )
|
self.max.Enable( False )
|
||||||
|
|
||||||
self.limit_target = wxCheckBox( panel, -1, "Limit control" )
|
self.limit_target = wxCheckBox( panel, -1, "Limit control" )
|
||||||
self.allow_none = wxCheckBox( panel, -1, "Allow empty control" )
|
self.allow_none = wxCheckBox( panel, -1, "Allow empty control" )
|
||||||
@@ -48,7 +48,7 @@ class TestPanel( wxPanel ):
|
|||||||
outer_box = wxBoxSizer( wxVERTICAL )
|
outer_box = wxBoxSizer( wxVERTICAL )
|
||||||
outer_box.AddSizer( grid, 0, wxALIGN_CENTRE|wxALL, 20 )
|
outer_box.AddSizer( grid, 0, wxALIGN_CENTRE|wxALL, 20 )
|
||||||
|
|
||||||
panel.SetAutoLayout( true )
|
panel.SetAutoLayout( True )
|
||||||
panel.SetSizer( outer_box )
|
panel.SetSizer( outer_box )
|
||||||
outer_box.Fit( panel )
|
outer_box.Fit( panel )
|
||||||
panel.Move( (50,50) )
|
panel.Move( (50,50) )
|
||||||
@@ -169,7 +169,7 @@ Here's the API for wxIntCtrl:
|
|||||||
<DT><B>limited</B>
|
<DT><B>limited</B>
|
||||||
<DD>Boolean indicating whether the control prevents values from
|
<DD>Boolean indicating whether the control prevents values from
|
||||||
exceeding the currently set minimum and maximum values (bounds).
|
exceeding the currently set minimum and maximum values (bounds).
|
||||||
If <I>false</I> and bounds are set, out-of-bounds values will
|
If <I>False</I> and bounds are set, out-of-bounds values will
|
||||||
be colored with the current out-of-bounds color.
|
be colored with the current out-of-bounds color.
|
||||||
<BR>
|
<BR>
|
||||||
<DT><B>allow_none</B>
|
<DT><B>allow_none</B>
|
||||||
@@ -178,7 +178,7 @@ Here's the API for wxIntCtrl:
|
|||||||
<BR>
|
<BR>
|
||||||
<DT><B>allow_long</B>
|
<DT><B>allow_long</B>
|
||||||
<DD>Boolean indicating whether or not the control is allowed to hold
|
<DD>Boolean indicating whether or not the control is allowed to hold
|
||||||
and return a value of type long as well as int. If false, the
|
and return a value of type long as well as int. If False, the
|
||||||
control will be implicitly limited to have a value such that
|
control will be implicitly limited to have a value such that
|
||||||
-sys.maxint-1 <= n <= sys.maxint.
|
-sys.maxint-1 <= n <= sys.maxint.
|
||||||
<BR>
|
<BR>
|
||||||
@@ -255,7 +255,7 @@ It will return None if no upper bound is currently specified.
|
|||||||
<DT><B>SetBounds(min=None,max=None)</B>
|
<DT><B>SetBounds(min=None,max=None)</B>
|
||||||
<DD>This function is a convenience function for setting the min and max
|
<DD>This function is a convenience function for setting the min and max
|
||||||
values at the same time. The function only applies the maximum bound
|
values at the same time. The function only applies the maximum bound
|
||||||
if setting the minimum bound is successful, and returns true
|
if setting the minimum bound is successful, and returns True
|
||||||
only if both operations succeed. <B><I>Note:</I></B> leaving out an argument
|
only if both operations succeed. <B><I>Note:</I></B> leaving out an argument
|
||||||
will remove the corresponding bound.
|
will remove the corresponding bound.
|
||||||
<DT><B>GetBounds()</B>
|
<DT><B>GetBounds()</B>
|
||||||
@@ -265,14 +265,14 @@ that bound is not set.
|
|||||||
<BR>
|
<BR>
|
||||||
<BR>
|
<BR>
|
||||||
<DT><B>IsInBounds(value=None)</B>
|
<DT><B>IsInBounds(value=None)</B>
|
||||||
<DD>Returns <I>true</I> if no value is specified and the current value
|
<DD>Returns <I>True</I> if no value is specified and the current value
|
||||||
of the control falls within the current bounds. This function can also
|
of the control falls within the current bounds. This function can also
|
||||||
be called with a value to see if that value would fall within the current
|
be called with a value to see if that value would fall within the current
|
||||||
bounds of the given control.
|
bounds of the given control.
|
||||||
<BR>
|
<BR>
|
||||||
<BR>
|
<BR>
|
||||||
<DT><B>SetLimited(bool)</B>
|
<DT><B>SetLimited(bool)</B>
|
||||||
<DD>If called with a value of true, this function will cause the control
|
<DD>If called with a value of True, this function will cause the control
|
||||||
to limit the value to fall within the bounds currently specified.
|
to limit the value to fall within the bounds currently specified.
|
||||||
If the control's value currently exceeds the bounds, it will then
|
If the control's value currently exceeds the bounds, it will then
|
||||||
be limited accordingly.
|
be limited accordingly.
|
||||||
@@ -280,31 +280,31 @@ If called with a value of 0, this function will disable value
|
|||||||
limiting, but coloring of out-of-bounds values will still take
|
limiting, but coloring of out-of-bounds values will still take
|
||||||
place if bounds have been set for the control.
|
place if bounds have been set for the control.
|
||||||
<DT><B>IsLimited()</B>
|
<DT><B>IsLimited()</B>
|
||||||
<DD>Returns <I>true</I> if the control is currently limiting the
|
<DD>Returns <I>True</I> if the control is currently limiting the
|
||||||
value to fall within the current bounds.
|
value to fall within the current bounds.
|
||||||
<BR>
|
<BR>
|
||||||
<BR>
|
<BR>
|
||||||
<DT><B>SetNoneAllowed(bool)</B>
|
<DT><B>SetNoneAllowed(bool)</B>
|
||||||
<DD>If called with a value of true, this function will cause the control
|
<DD>If called with a value of True, this function will cause the control
|
||||||
to allow the value to be empty, representing a value of None.
|
to allow the value to be empty, representing a value of None.
|
||||||
If called with a value of fakse, this function will prevent the value
|
If called with a value of fakse, this function will prevent the value
|
||||||
from being None. If the value of the control is currently None,
|
from being None. If the value of the control is currently None,
|
||||||
ie. the control is empty, then the value will be changed to that
|
ie. the control is empty, then the value will be changed to that
|
||||||
of the lower bound of the control, or 0 if no lower bound is set.
|
of the lower bound of the control, or 0 if no lower bound is set.
|
||||||
<DT><B>IsNoneAllowed()</B>
|
<DT><B>IsNoneAllowed()</B>
|
||||||
<DD>Returns <I>true</I> if the control currently allows its
|
<DD>Returns <I>True</I> if the control currently allows its
|
||||||
value to be None.
|
value to be None.
|
||||||
<BR>
|
<BR>
|
||||||
<BR>
|
<BR>
|
||||||
<DT><B>SetLongAllowed(bool)</B>
|
<DT><B>SetLongAllowed(bool)</B>
|
||||||
<DD>If called with a value of true, this function will cause the
|
<DD>If called with a value of True, this function will cause the
|
||||||
control to allow the value to be a long. If called with a value
|
control to allow the value to be a long. If called with a value
|
||||||
of false, and the value of the control is currently a long value,
|
of False, and the value of the control is currently a long value,
|
||||||
the value of the control will be adjusted to fall within the
|
the value of the control will be adjusted to fall within the
|
||||||
size of an integer type, at either the sys.maxint or -sys.maxint-1,
|
size of an integer type, at either the sys.maxint or -sys.maxint-1,
|
||||||
for positive and negative values, respectively.
|
for positive and negative values, respectively.
|
||||||
<DT><B>IsLongAllowed()</B>
|
<DT><B>IsLongAllowed()</B>
|
||||||
<DD>Returns <I>true</I> if the control currently allows its
|
<DD>Returns <I>True</I> if the control currently allows its
|
||||||
value to be of type long.
|
value to be of type long.
|
||||||
<BR>
|
<BR>
|
||||||
<BR>
|
<BR>
|
||||||
|
@@ -11,7 +11,7 @@ class JoystickTestPanel(wxPanel):
|
|||||||
style = wxTAB_TRAVERSAL ):
|
style = wxTAB_TRAVERSAL ):
|
||||||
wxPanel.__init__(self, parent, id, pos, size, style)
|
wxPanel.__init__(self, parent, id, pos, size, style)
|
||||||
|
|
||||||
MakeJoystickTestPanel( self, true )
|
MakeJoystickTestPanel( self, True )
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.stick = wxJoystick()
|
self.stick = wxJoystick()
|
||||||
|
@@ -120,11 +120,11 @@ class KeySink(wxWindow):
|
|||||||
#| wxSUNKEN_BORDER
|
#| wxSUNKEN_BORDER
|
||||||
)
|
)
|
||||||
self.SetBackgroundColour(wxBLUE)
|
self.SetBackgroundColour(wxBLUE)
|
||||||
self.haveFocus = false
|
self.haveFocus = False
|
||||||
self.callSkip = false
|
self.callSkip = False
|
||||||
self.logKeyDn = true
|
self.logKeyDn = True
|
||||||
self.logKeyUp = true
|
self.logKeyUp = True
|
||||||
self.logChar = true
|
self.logChar = True
|
||||||
|
|
||||||
EVT_PAINT(self, self.OnPaint)
|
EVT_PAINT(self, self.OnPaint)
|
||||||
EVT_SET_FOCUS(self, self.OnSetFocus)
|
EVT_SET_FOCUS(self, self.OnSetFocus)
|
||||||
@@ -164,11 +164,11 @@ class KeySink(wxWindow):
|
|||||||
|
|
||||||
|
|
||||||
def OnSetFocus(self, evt):
|
def OnSetFocus(self, evt):
|
||||||
self.haveFocus = true
|
self.haveFocus = True
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
def OnKillFocus(self, evt):
|
def OnKillFocus(self, evt):
|
||||||
self.haveFocus = false
|
self.haveFocus = False
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
def OnMouse(self, evt):
|
def OnMouse(self, evt):
|
||||||
@@ -277,15 +277,15 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
cb2 = wxCheckBox(self, -1, "EVT_KEY_UP")
|
cb2 = wxCheckBox(self, -1, "EVT_KEY_UP")
|
||||||
EVT_CHECKBOX(self, cb2.GetId(), self.OnKeyUpCB)
|
EVT_CHECKBOX(self, cb2.GetId(), self.OnKeyUpCB)
|
||||||
cb2.SetValue(true)
|
cb2.SetValue(True)
|
||||||
|
|
||||||
cb3 = wxCheckBox(self, -1, "EVT_KEY_DOWN")
|
cb3 = wxCheckBox(self, -1, "EVT_KEY_DOWN")
|
||||||
EVT_CHECKBOX(self, cb3.GetId(), self.OnKeyDnCB)
|
EVT_CHECKBOX(self, cb3.GetId(), self.OnKeyDnCB)
|
||||||
cb3.SetValue(true)
|
cb3.SetValue(True)
|
||||||
|
|
||||||
cb4 = wxCheckBox(self, -1, "EVT_CHAR")
|
cb4 = wxCheckBox(self, -1, "EVT_CHAR")
|
||||||
EVT_CHECKBOX(self, cb4.GetId(), self.OnCharCB)
|
EVT_CHECKBOX(self, cb4.GetId(), self.OnCharCB)
|
||||||
cb4.SetValue(true)
|
cb4.SetValue(True)
|
||||||
|
|
||||||
buttons = wxBoxSizer(wxHORIZONTAL)
|
buttons = wxBoxSizer(wxHORIZONTAL)
|
||||||
buttons.Add(btn, 0, wxALL, 4)
|
buttons.Add(btn, 0, wxALL, 4)
|
||||||
|
@@ -17,7 +17,7 @@ class TestPanel(wxPanel):
|
|||||||
led = wxLEDNumberCtrl(self, -1, (25,100), (280, 50))
|
led = wxLEDNumberCtrl(self, -1, (25,100), (280, 50))
|
||||||
led.SetValue("56789")
|
led.SetValue("56789")
|
||||||
led.SetAlignment(wxLED_ALIGN_RIGHT)
|
led.SetAlignment(wxLED_ALIGN_RIGHT)
|
||||||
led.SetDrawFaded(false)
|
led.SetDrawFaded(False)
|
||||||
|
|
||||||
led = wxLEDNumberCtrl(self, -1, (25,175), (280, 50),
|
led = wxLEDNumberCtrl(self, -1, (25,175), (280, 50),
|
||||||
wxLED_ALIGN_CENTER)# | wxLED_DRAW_FADED)
|
wxLED_ALIGN_CENTER)# | wxLED_DRAW_FADED)
|
||||||
|
@@ -6,7 +6,7 @@ from wxPython.wx import *
|
|||||||
class TestLayoutConstraints(wxPanel):
|
class TestLayoutConstraints(wxPanel):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wxPanel.__init__(self, parent, -1)
|
wxPanel.__init__(self, parent, -1)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
EVT_BUTTON(self, 100, self.OnButton)
|
EVT_BUTTON(self, 100, self.OnButton)
|
||||||
|
|
||||||
self.SetBackgroundColour(wxNamedColour("MEDIUM ORCHID"))
|
self.SetBackgroundColour(wxNamedColour("MEDIUM ORCHID"))
|
||||||
|
@@ -109,7 +109,7 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
|
|||||||
# see wxPython/lib/mixins/listctrl.py
|
# see wxPython/lib/mixins/listctrl.py
|
||||||
self.itemDataMap = musicdata
|
self.itemDataMap = musicdata
|
||||||
wxColumnSorterMixin.__init__(self, 3)
|
wxColumnSorterMixin.__init__(self, 3)
|
||||||
#self.SortListItems(0, true)
|
#self.SortListItems(0, True)
|
||||||
|
|
||||||
EVT_SIZE(self, self.OnSize)
|
EVT_SIZE(self, self.OnSize)
|
||||||
EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected)
|
EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected)
|
||||||
|
@@ -18,7 +18,7 @@ class TestPanel(wxPanel):
|
|||||||
box.Add(20, 30)
|
box.Add(20, 30)
|
||||||
box.Add(b1, 0, wxALIGN_CENTER|wxALL, 15)
|
box.Add(b1, 0, wxALIGN_CENTER|wxALL, 15)
|
||||||
box.Add(b2, 0, wxALIGN_CENTER|wxALL, 15)
|
box.Add(b2, 0, wxALIGN_CENTER|wxALL, 15)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(box)
|
self.SetSizer(box)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -29,11 +29,11 @@ def runTest(frame, nb, log):
|
|||||||
p = wxMVCTree(nb, -1)
|
p = wxMVCTree(nb, -1)
|
||||||
#f = wxFrame(frame, -1, "wxMVCTree")
|
#f = wxFrame(frame, -1, "wxMVCTree")
|
||||||
#p = wxMVCTree(f, -1)
|
#p = wxMVCTree(f, -1)
|
||||||
p.SetAssumeChildren(true)
|
p.SetAssumeChildren(True)
|
||||||
p.SetModel(LateFSTreeModel(os.path.normpath(os.getcwd() + os.sep +'..')))
|
p.SetModel(LateFSTreeModel(os.path.normpath(os.getcwd() + os.sep +'..')))
|
||||||
#Uncomment this to enable live filename editing!
|
#Uncomment this to enable live filename editing!
|
||||||
# p.AddEditor(FileEditor(p))
|
# p.AddEditor(FileEditor(p))
|
||||||
p.SetMultiSelect(true)
|
p.SetMultiSelect(True)
|
||||||
EVT_MVCTREE_SEL_CHANGING(p, p.GetId(), selchanging)
|
EVT_MVCTREE_SEL_CHANGING(p, p.GetId(), selchanging)
|
||||||
EVT_MVCTREE_SEL_CHANGED(p, p.GetId(), selchanged)
|
EVT_MVCTREE_SEL_CHANGED(p, p.GetId(), selchanged)
|
||||||
EVT_MVCTREE_ITEM_EXPANDED(p, p.GetId(), expanded)
|
EVT_MVCTREE_ITEM_EXPANDED(p, p.GetId(), expanded)
|
||||||
@@ -44,7 +44,7 @@ def runTest(frame, nb, log):
|
|||||||
|
|
||||||
return p
|
return p
|
||||||
#frame.otherWin = f
|
#frame.otherWin = f
|
||||||
#f.Show(true)
|
#f.Show(True)
|
||||||
#return None
|
#return None
|
||||||
|
|
||||||
|
|
||||||
|
@@ -86,7 +86,7 @@ class TestMaskWindow(wxScrolledWindow):
|
|||||||
x,y = 120+150*(i%4), 20+100*(i/4)
|
x,y = 120+150*(i%4), 20+100*(i/4)
|
||||||
dc.DrawText(text, x, y-20)
|
dc.DrawText(text, x, y-20)
|
||||||
mdc.SelectObject(self.bmp_withcolourmask)
|
mdc.SelectObject(self.bmp_withcolourmask)
|
||||||
dc.Blit(x,y, cx,cy, mdc, 0,0, code, true)
|
dc.Blit(x,y, cx,cy, mdc, 0,0, code, True)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
|
|
||||||
|
@@ -151,7 +151,7 @@ check the source for this sample to see how to implement them.
|
|||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
win = MyFrame(frame, -1, log)
|
win = MyFrame(frame, -1, log)
|
||||||
frame.otherWin = win
|
frame.otherWin = win
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
@@ -14,7 +14,7 @@ class MimeTypesTestPanel(wxPanel):
|
|||||||
style = wxTAB_TRAVERSAL ):
|
style = wxTAB_TRAVERSAL ):
|
||||||
wxPanel.__init__(self, parent, id, pos, size, style)
|
wxPanel.__init__(self, parent, id, pos, size, style)
|
||||||
|
|
||||||
MakeMimeTypesTestPanel( self, true )
|
MakeMimeTypesTestPanel( self, True )
|
||||||
|
|
||||||
# WDR: handler declarations for MimeTypesTestPanel
|
# WDR: handler declarations for MimeTypesTestPanel
|
||||||
EVT_LISTBOX(self, ID_LISTBOX, self.OnListbox)
|
EVT_LISTBOX(self, ID_LISTBOX, self.OnListbox)
|
||||||
@@ -34,8 +34,8 @@ class MimeTypesTestPanel(wxPanel):
|
|||||||
def OnListbox(self, event):
|
def OnListbox(self, event):
|
||||||
mimetype = event.GetString()
|
mimetype = event.GetString()
|
||||||
self.GetInputText().SetValue(mimetype)
|
self.GetInputText().SetValue(mimetype)
|
||||||
self.GetMimeBtn().SetValue(TRUE)
|
self.GetMimeBtn().SetValue(True)
|
||||||
self.GetExtensionBtn().SetValue(FALSE)
|
self.GetExtensionBtn().SetValue(False)
|
||||||
self.OnLookup()
|
self.OnLookup()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ class MyMiniFrame(wxMiniFrame):
|
|||||||
EVT_CLOSE(self, self.OnCloseWindow)
|
EVT_CLOSE(self, self.OnCloseWindow)
|
||||||
|
|
||||||
def OnCloseMe(self, event):
|
def OnCloseMe(self, event):
|
||||||
self.Close(true)
|
self.Close(True)
|
||||||
|
|
||||||
def OnCloseWindow(self, event):
|
def OnCloseWindow(self, event):
|
||||||
print "OnCloseWindow"
|
print "OnCloseWindow"
|
||||||
@@ -29,7 +29,7 @@ def runTest(frame, nb, log):
|
|||||||
win.SetSize((200, 200))
|
win.SetSize((200, 200))
|
||||||
win.CenterOnParent(wxBOTH)
|
win.CenterOnParent(wxBOTH)
|
||||||
frame.otherWin = win
|
frame.otherWin = win
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
@@ -112,10 +112,10 @@ class MyEvtHandler(wxShapeEvtHandler):
|
|||||||
canvas.PrepareDC(dc)
|
canvas.PrepareDC(dc)
|
||||||
|
|
||||||
if shape.Selected():
|
if shape.Selected():
|
||||||
shape.Select(false, dc)
|
shape.Select(False, dc)
|
||||||
canvas.Redraw(dc)
|
canvas.Redraw(dc)
|
||||||
else:
|
else:
|
||||||
redraw = false
|
redraw = False
|
||||||
shapeList = canvas.GetDiagram().GetShapeList()
|
shapeList = canvas.GetDiagram().GetShapeList()
|
||||||
toUnselect = []
|
toUnselect = []
|
||||||
for s in shapeList:
|
for s in shapeList:
|
||||||
@@ -125,11 +125,11 @@ class MyEvtHandler(wxShapeEvtHandler):
|
|||||||
# shapes too!) and bad things will happen...
|
# shapes too!) and bad things will happen...
|
||||||
toUnselect.append(s)
|
toUnselect.append(s)
|
||||||
|
|
||||||
shape.Select(true, dc)
|
shape.Select(True, dc)
|
||||||
|
|
||||||
if toUnselect:
|
if toUnselect:
|
||||||
for s in toUnselect:
|
for s in toUnselect:
|
||||||
s.Select(false, dc)
|
s.Select(False, dc)
|
||||||
canvas.Redraw(dc)
|
canvas.Redraw(dc)
|
||||||
|
|
||||||
self.UpdateStatusBar(shape)
|
self.UpdateStatusBar(shape)
|
||||||
@@ -209,7 +209,7 @@ class TestWindow(wxShapeCanvas):
|
|||||||
line.MakeLineControlPoints(2)
|
line.MakeLineControlPoints(2)
|
||||||
fromShape.AddLine(line, toShape)
|
fromShape.AddLine(line, toShape)
|
||||||
self.diagram.AddShape(line)
|
self.diagram.AddShape(line)
|
||||||
line.Show(true)
|
line.Show(True)
|
||||||
|
|
||||||
# for some reason, the shapes have to be moved for the line to show up...
|
# for some reason, the shapes have to be moved for the line to show up...
|
||||||
fromShape.Move(dc, fromShape.GetX(), fromShape.GetY())
|
fromShape.Move(dc, fromShape.GetX(), fromShape.GetY())
|
||||||
@@ -218,7 +218,7 @@ class TestWindow(wxShapeCanvas):
|
|||||||
|
|
||||||
|
|
||||||
def MyAddShape(self, shape, x, y, pen, brush, text):
|
def MyAddShape(self, shape, x, y, pen, brush, text):
|
||||||
shape.SetDraggable(true, true)
|
shape.SetDraggable(True, True)
|
||||||
shape.SetCanvas(self)
|
shape.SetCanvas(self)
|
||||||
shape.SetX(x)
|
shape.SetX(x)
|
||||||
shape.SetY(y)
|
shape.SetY(y)
|
||||||
@@ -227,7 +227,7 @@ class TestWindow(wxShapeCanvas):
|
|||||||
if text: shape.AddText(text)
|
if text: shape.AddText(text)
|
||||||
#shape.SetShadowMode(SHADOW_RIGHT)
|
#shape.SetShadowMode(SHADOW_RIGHT)
|
||||||
self.diagram.AddShape(shape)
|
self.diagram.AddShape(shape)
|
||||||
shape.Show(true)
|
shape.Show(True)
|
||||||
|
|
||||||
evthandler = MyEvtHandler(self.log, self.frame)
|
evthandler = MyEvtHandler(self.log, self.frame)
|
||||||
evthandler.SetShape(shape)
|
evthandler.SetShape(shape)
|
||||||
|
@@ -38,7 +38,7 @@ class TestDateControl(wxPopupControl):
|
|||||||
# the calendar control
|
# the calendar control
|
||||||
txtValue = self.GetValue()
|
txtValue = self.GetValue()
|
||||||
dmy = txtValue.split('/')
|
dmy = txtValue.split('/')
|
||||||
didSet = false
|
didSet = False
|
||||||
if len(dmy) == 3:
|
if len(dmy) == 3:
|
||||||
date = self.cal.GetDate()
|
date = self.cal.GetDate()
|
||||||
d = int(dmy[0])
|
d = int(dmy[0])
|
||||||
@@ -48,7 +48,7 @@ class TestDateControl(wxPopupControl):
|
|||||||
if m >= 0 and m < 12:
|
if m >= 0 and m < 12:
|
||||||
if y > 1000:
|
if y > 1000:
|
||||||
self.cal.SetDate(wxDateTimeFromDMY(d,m,y))
|
self.cal.SetDate(wxDateTimeFromDMY(d,m,y))
|
||||||
didSet = true
|
didSet = True
|
||||||
if not didSet:
|
if not didSet:
|
||||||
self.cal.SetDate(wxDateTime_Today())
|
self.cal.SetDate(wxDateTime_Today())
|
||||||
|
|
||||||
|
@@ -55,7 +55,7 @@ class TestPopup(wxPopupWindow):
|
|||||||
self.ReleaseMouse()
|
self.ReleaseMouse()
|
||||||
|
|
||||||
def OnRightUp(self, evt):
|
def OnRightUp(self, evt):
|
||||||
self.Show(false)
|
self.Show(False)
|
||||||
self.Destroy()
|
self.Destroy()
|
||||||
|
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ class TestTransientPopup(wxPopupTransientWindow):
|
|||||||
|
|
||||||
def ProcessLeftDown(self, evt):
|
def ProcessLeftDown(self, evt):
|
||||||
self.log.write("ProcessLeftDown\n")
|
self.log.write("ProcessLeftDown\n")
|
||||||
return false
|
return False
|
||||||
|
|
||||||
def OnDismiss(self):
|
def OnDismiss(self):
|
||||||
self.log.write("OnDismiss\n")
|
self.log.write("OnDismiss\n")
|
||||||
@@ -113,7 +113,7 @@ class TestPanel(wxPanel):
|
|||||||
sz = btn.GetSize()
|
sz = btn.GetSize()
|
||||||
win.Position(pos, (0, sz.height))
|
win.Position(pos, (0, sz.height))
|
||||||
|
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
|
|
||||||
def OnShowPopupTransient(self, evt):
|
def OnShowPopupTransient(self, evt):
|
||||||
@@ -139,7 +139,7 @@ class TestPanel(wxPanel):
|
|||||||
sz = btn.GetSize()
|
sz = btn.GetSize()
|
||||||
win.Position(pos, (0, sz.height))
|
win.Position(pos, (0, sz.height))
|
||||||
|
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
class TestPopupWithListbox(wxPopupWindow):
|
class TestPopupWithListbox(wxPopupWindow):
|
||||||
def __init__(self, parent, style, log):
|
def __init__(self, parent, style, log):
|
||||||
|
@@ -5,9 +5,9 @@ from wxPython.wx import *
|
|||||||
|
|
||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
data = wxPrintDialogData()
|
data = wxPrintDialogData()
|
||||||
data.EnablePrintToFile(true)
|
data.EnablePrintToFile(True)
|
||||||
data.EnablePageNumbers(true)
|
data.EnablePageNumbers(True)
|
||||||
data.EnableSelection(true)
|
data.EnableSelection(True)
|
||||||
dlg = wxPrintDialog(frame, data)
|
dlg = wxPrintDialog(frame, data)
|
||||||
if dlg.ShowModal() == wxID_OK:
|
if dlg.ShowModal() == wxID_OK:
|
||||||
log.WriteText('\n')
|
log.WriteText('\n')
|
||||||
|
@@ -27,9 +27,9 @@ class TestPanel(wxPanel):
|
|||||||
self.inp = wxTextCtrl(self, -1, '', style=wxTE_PROCESS_ENTER)
|
self.inp = wxTextCtrl(self, -1, '', style=wxTE_PROCESS_ENTER)
|
||||||
self.sndBtn = wxButton(self, -1, 'Send')
|
self.sndBtn = wxButton(self, -1, 'Send')
|
||||||
self.termBtn = wxButton(self, -1, 'Close Stream')
|
self.termBtn = wxButton(self, -1, 'Close Stream')
|
||||||
self.inp.Enable(false)
|
self.inp.Enable(False)
|
||||||
self.sndBtn.Enable(false)
|
self.sndBtn.Enable(False)
|
||||||
self.termBtn.Enable(false)
|
self.termBtn.Enable(False)
|
||||||
|
|
||||||
# Hook up the events
|
# Hook up the events
|
||||||
EVT_BUTTON(self, self.exBtn.GetId(), self.OnExecuteBtn)
|
EVT_BUTTON(self, self.exBtn.GetId(), self.OnExecuteBtn)
|
||||||
@@ -55,7 +55,7 @@ class TestPanel(wxPanel):
|
|||||||
sizer.Add(box2, 0, wxEXPAND|wxALL, 10)
|
sizer.Add(box2, 0, wxEXPAND|wxALL, 10)
|
||||||
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
@@ -73,11 +73,11 @@ class TestPanel(wxPanel):
|
|||||||
pid = wxExecute(cmd, wxEXEC_ASYNC, self.process)
|
pid = wxExecute(cmd, wxEXEC_ASYNC, self.process)
|
||||||
self.log.write('OnExecuteBtn: "%s" pid: %s\n' % (cmd, pid))
|
self.log.write('OnExecuteBtn: "%s" pid: %s\n' % (cmd, pid))
|
||||||
|
|
||||||
self.inp.Enable(true)
|
self.inp.Enable(True)
|
||||||
self.sndBtn.Enable(true)
|
self.sndBtn.Enable(True)
|
||||||
self.termBtn.Enable(true)
|
self.termBtn.Enable(True)
|
||||||
self.cmd.Enable(false)
|
self.cmd.Enable(False)
|
||||||
self.exBtn.Enable(false)
|
self.exBtn.Enable(False)
|
||||||
self.inp.SetFocus()
|
self.inp.SetFocus()
|
||||||
|
|
||||||
|
|
||||||
@@ -115,11 +115,11 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
self.process.Destroy()
|
self.process.Destroy()
|
||||||
self.process = None
|
self.process = None
|
||||||
self.inp.Enable(false)
|
self.inp.Enable(False)
|
||||||
self.sndBtn.Enable(false)
|
self.sndBtn.Enable(False)
|
||||||
self.termBtn.Enable(false)
|
self.termBtn.Enable(False)
|
||||||
self.cmd.Enable(true)
|
self.cmd.Enable(True)
|
||||||
self.exBtn.Enable(true)
|
self.exBtn.Enable(True)
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
@@ -11,7 +11,7 @@ def runTest(frame, nb, log):
|
|||||||
frame,
|
frame,
|
||||||
wxPD_CAN_ABORT | wxPD_APP_MODAL)
|
wxPD_CAN_ABORT | wxPD_APP_MODAL)
|
||||||
|
|
||||||
keepGoing = true
|
keepGoing = True
|
||||||
count = 0
|
count = 0
|
||||||
while keepGoing and count < max:
|
while keepGoing and count < max:
|
||||||
count = count + 1
|
count = count + 1
|
||||||
|
@@ -12,7 +12,7 @@ class TestColourChooser(wxPanel):
|
|||||||
sizer = wxBoxSizer(wxVERTICAL)
|
sizer = wxBoxSizer(wxVERTICAL)
|
||||||
sizer.Add(chooser, 0, wxALL, 25)
|
sizer.Add(chooser, 0, wxALL, 25)
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
|
|
||||||
#---------------------------------------------------------------
|
#---------------------------------------------------------------
|
||||||
|
@@ -67,7 +67,7 @@ class TestPanel( wxPanel ):
|
|||||||
|
|
||||||
for radio, text in self.group1_ctrls + self.group2_ctrls:
|
for radio, text in self.group1_ctrls + self.group2_ctrls:
|
||||||
radio.SetValue(0)
|
radio.SetValue(0)
|
||||||
text.Enable(FALSE)
|
text.Enable(False)
|
||||||
|
|
||||||
|
|
||||||
def OnGroup1Select( self, event ):
|
def OnGroup1Select( self, event ):
|
||||||
@@ -75,18 +75,18 @@ class TestPanel( wxPanel ):
|
|||||||
self.log.write('Group1 %s selected\n' % radio_selected.GetLabel() )
|
self.log.write('Group1 %s selected\n' % radio_selected.GetLabel() )
|
||||||
for radio, text in self.group1_ctrls:
|
for radio, text in self.group1_ctrls:
|
||||||
if radio is radio_selected:
|
if radio is radio_selected:
|
||||||
text.Enable(TRUE)
|
text.Enable(True)
|
||||||
else:
|
else:
|
||||||
text.Enable(FALSE)
|
text.Enable(False)
|
||||||
|
|
||||||
def OnGroup2Select( self, event ):
|
def OnGroup2Select( self, event ):
|
||||||
radio_selected = event.GetEventObject()
|
radio_selected = event.GetEventObject()
|
||||||
self.log.write('Group2 %s selected\n' % radio_selected.GetLabel() )
|
self.log.write('Group2 %s selected\n' % radio_selected.GetLabel() )
|
||||||
for radio, text in self.group2_ctrls:
|
for radio, text in self.group2_ctrls:
|
||||||
if radio is radio_selected:
|
if radio is radio_selected:
|
||||||
text.Enable(TRUE)
|
text.Enable(True)
|
||||||
else:
|
else:
|
||||||
text.Enable(FALSE)
|
text.Enable(False)
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ class TestPanel(wxPanel):
|
|||||||
sizer.Add(fgs, 0, wxALL, 25)
|
sizer.Add(fgs, 0, wxALL, 25)
|
||||||
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ class TestSashWindow(wxPanel):
|
|||||||
win.SetOrientation(wxLAYOUT_HORIZONTAL)
|
win.SetOrientation(wxLAYOUT_HORIZONTAL)
|
||||||
win.SetAlignment(wxLAYOUT_TOP)
|
win.SetAlignment(wxLAYOUT_TOP)
|
||||||
win.SetBackgroundColour(wxColour(255, 0, 0))
|
win.SetBackgroundColour(wxColour(255, 0, 0))
|
||||||
win.SetSashVisible(wxSASH_BOTTOM, true)
|
win.SetSashVisible(wxSASH_BOTTOM, True)
|
||||||
|
|
||||||
self.topWindow = win
|
self.topWindow = win
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ class TestSashWindow(wxPanel):
|
|||||||
win.SetOrientation(wxLAYOUT_HORIZONTAL)
|
win.SetOrientation(wxLAYOUT_HORIZONTAL)
|
||||||
win.SetAlignment(wxLAYOUT_BOTTOM)
|
win.SetAlignment(wxLAYOUT_BOTTOM)
|
||||||
win.SetBackgroundColour(wxColour(0, 0, 255))
|
win.SetBackgroundColour(wxColour(0, 0, 255))
|
||||||
win.SetSashVisible(wxSASH_TOP, true)
|
win.SetSashVisible(wxSASH_TOP, True)
|
||||||
|
|
||||||
self.bottomWindow = win
|
self.bottomWindow = win
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ class TestSashWindow(wxPanel):
|
|||||||
win.SetOrientation(wxLAYOUT_VERTICAL)
|
win.SetOrientation(wxLAYOUT_VERTICAL)
|
||||||
win.SetAlignment(wxLAYOUT_LEFT)
|
win.SetAlignment(wxLAYOUT_LEFT)
|
||||||
win.SetBackgroundColour(wxColour(0, 255, 0))
|
win.SetBackgroundColour(wxColour(0, 255, 0))
|
||||||
win.SetSashVisible(wxSASH_RIGHT, TRUE)
|
win.SetSashVisible(wxSASH_RIGHT, True)
|
||||||
win.SetExtraBorderSize(10)
|
win.SetExtraBorderSize(10)
|
||||||
textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
|
textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
|
||||||
wxTE_MULTILINE|wxSUNKEN_BORDER)
|
wxTE_MULTILINE|wxSUNKEN_BORDER)
|
||||||
@@ -74,7 +74,7 @@ class TestSashWindow(wxPanel):
|
|||||||
win.SetOrientation(wxLAYOUT_VERTICAL)
|
win.SetOrientation(wxLAYOUT_VERTICAL)
|
||||||
win.SetAlignment(wxLAYOUT_LEFT)
|
win.SetAlignment(wxLAYOUT_LEFT)
|
||||||
win.SetBackgroundColour(wxColour(0, 255, 255))
|
win.SetBackgroundColour(wxColour(0, 255, 255))
|
||||||
win.SetSashVisible(wxSASH_RIGHT, TRUE)
|
win.SetSashVisible(wxSASH_RIGHT, True)
|
||||||
|
|
||||||
self.leftWindow2 = win
|
self.leftWindow2 = win
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ class MyCanvas(wxScrolledWindow):
|
|||||||
self.maxHeight = 1000
|
self.maxHeight = 1000
|
||||||
self.x = self.y = 0
|
self.x = self.y = 0
|
||||||
self.curLine = []
|
self.curLine = []
|
||||||
self.drawing = false
|
self.drawing = False
|
||||||
|
|
||||||
self.SetBackgroundColour("WHITE")
|
self.SetBackgroundColour("WHITE")
|
||||||
self.SetCursor(wxStockCursor(wxCURSOR_PENCIL))
|
self.SetCursor(wxStockCursor(wxCURSOR_PENCIL))
|
||||||
@@ -88,7 +88,7 @@ class MyCanvas(wxScrolledWindow):
|
|||||||
dc.SetPen(wxGREEN_PEN)
|
dc.SetPen(wxGREEN_PEN)
|
||||||
dc.DrawSpline(lst+[(100,100)])
|
dc.DrawSpline(lst+[(100,100)])
|
||||||
|
|
||||||
dc.DrawBitmap(self.bmp, 200, 20, true)
|
dc.DrawBitmap(self.bmp, 200, 20, True)
|
||||||
dc.SetTextForeground(wxColour(0, 0xFF, 0x80))
|
dc.SetTextForeground(wxColour(0, 0xFF, 0x80))
|
||||||
dc.DrawText("a bitmap", 200, 85)
|
dc.DrawText("a bitmap", 200, 85)
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ class MyCanvas(wxScrolledWindow):
|
|||||||
self.SetXY(event)
|
self.SetXY(event)
|
||||||
self.curLine = []
|
self.curLine = []
|
||||||
self.CaptureMouse()
|
self.CaptureMouse()
|
||||||
self.drawing = true
|
self.drawing = True
|
||||||
|
|
||||||
elif event.Dragging() and self.drawing:
|
elif event.Dragging() and self.drawing:
|
||||||
if BUFFERED:
|
if BUFFERED:
|
||||||
@@ -179,7 +179,7 @@ class MyCanvas(wxScrolledWindow):
|
|||||||
self.lines.append(self.curLine)
|
self.lines.append(self.curLine)
|
||||||
self.curLine = []
|
self.curLine = []
|
||||||
self.ReleaseMouse()
|
self.ReleaseMouse()
|
||||||
self.drawing = false
|
self.drawing = False
|
||||||
|
|
||||||
|
|
||||||
## This is an example of what to do for the EVT_MOUSEWHEEL event,
|
## This is an example of what to do for the EVT_MOUSEWHEEL event,
|
||||||
|
@@ -15,7 +15,7 @@ class TestPanel(wxPanel):
|
|||||||
sc = wxSpinCtrl(self, -1, "", wxPoint(30, 50), wxSize(80, -1))
|
sc = wxSpinCtrl(self, -1, "", wxPoint(30, 50), wxSize(80, -1))
|
||||||
sc.SetRange(1,100)
|
sc.SetRange(1,100)
|
||||||
sc.SetValue(5)
|
sc.SetValue(5)
|
||||||
#sc.Enable(false)
|
#sc.Enable(False)
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
@@ -24,7 +24,7 @@ class TestPanel(wxPanel):
|
|||||||
|
|
||||||
str = "This is a different font."
|
str = "This is a different font."
|
||||||
text = wxStaticText(self, -1, str, (20, 100))
|
text = wxStaticText(self, -1, str, (20, 100))
|
||||||
font = wxFont(18, wxSWISS, wxNORMAL, wxNORMAL, false, "Arial")
|
font = wxFont(18, wxSWISS, wxNORMAL, wxNORMAL, False, "Arial")
|
||||||
w, h, d, e = self.GetFullTextExtent(str, font)
|
w, h, d, e = self.GetFullTextExtent(str, font)
|
||||||
text.SetFont(font)
|
text.SetFont(font)
|
||||||
text.SetSize(wxSize(w, h))
|
text.SetSize(wxSize(w, h))
|
||||||
|
@@ -10,7 +10,7 @@ class CustomStatusBar(wxStatusBar):
|
|||||||
wxStatusBar.__init__(self, parent, -1)
|
wxStatusBar.__init__(self, parent, -1)
|
||||||
self.SetFieldsCount(3)
|
self.SetFieldsCount(3)
|
||||||
self.log = log
|
self.log = log
|
||||||
self.sizeChanged = false
|
self.sizeChanged = False
|
||||||
EVT_SIZE(self, self.OnSize)
|
EVT_SIZE(self, self.OnSize)
|
||||||
EVT_IDLE(self, self.OnIdle)
|
EVT_IDLE(self, self.OnIdle)
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ class CustomStatusBar(wxStatusBar):
|
|||||||
|
|
||||||
self.cb = wxCheckBox(self, 1001, "toggle clock")
|
self.cb = wxCheckBox(self, 1001, "toggle clock")
|
||||||
EVT_CHECKBOX(self, 1001, self.OnToggleClock)
|
EVT_CHECKBOX(self, 1001, self.OnToggleClock)
|
||||||
self.cb.SetValue(true)
|
self.cb.SetValue(True)
|
||||||
|
|
||||||
# set the initial position of the checkbox
|
# set the initial position of the checkbox
|
||||||
self.Reposition()
|
self.Reposition()
|
||||||
@@ -52,7 +52,7 @@ class CustomStatusBar(wxStatusBar):
|
|||||||
# Set a flag so the idle time handler will also do the repositioning.
|
# Set a flag so the idle time handler will also do the repositioning.
|
||||||
# It is done this way to get around a buglet where GetFieldRect is not
|
# It is done this way to get around a buglet where GetFieldRect is not
|
||||||
# accurate during the EVT_SIZE resulting from a frame maximize.
|
# accurate during the EVT_SIZE resulting from a frame maximize.
|
||||||
self.sizeChanged = true
|
self.sizeChanged = True
|
||||||
|
|
||||||
|
|
||||||
def OnIdle(self, evt):
|
def OnIdle(self, evt):
|
||||||
@@ -65,7 +65,7 @@ class CustomStatusBar(wxStatusBar):
|
|||||||
rect = self.GetFieldRect(1)
|
rect = self.GetFieldRect(1)
|
||||||
self.cb.SetPosition(wxPoint(rect.x+2, rect.y+2))
|
self.cb.SetPosition(wxPoint(rect.x+2, rect.y+2))
|
||||||
self.cb.SetSize(wxSize(rect.width-4, rect.height-4))
|
self.cb.SetSize(wxSize(rect.width-4, rect.height-4))
|
||||||
self.sizeChanged = false
|
self.sizeChanged = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ class TestCustomStatusBar(wxFrame):
|
|||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
win = TestCustomStatusBar(frame, log)
|
win = TestCustomStatusBar(frame, log)
|
||||||
frame.otherWin = win
|
frame.otherWin = win
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -74,7 +74,7 @@ class MySTC(wxStyledTextCtrl):
|
|||||||
% (evt.GetDragAllowMove(), evt.GetDragText()))
|
% (evt.GetDragAllowMove(), evt.GetDragText()))
|
||||||
|
|
||||||
if debug and evt.GetPosition() < 250:
|
if debug and evt.GetPosition() < 250:
|
||||||
evt.SetDragAllowMove(false) # you can prevent moving of text (only copy)
|
evt.SetDragAllowMove(False) # you can prevent moving of text (only copy)
|
||||||
evt.SetDragText("DRAGGED TEXT") # you can change what is dragged
|
evt.SetDragText("DRAGGED TEXT") # you can change what is dragged
|
||||||
#evt.SetDragText("") # or prevent the drag with empty text
|
#evt.SetDragText("") # or prevent the drag with empty text
|
||||||
|
|
||||||
@@ -159,13 +159,13 @@ def runTest(frame, nb, log):
|
|||||||
s = wxBoxSizer(wxHORIZONTAL)
|
s = wxBoxSizer(wxHORIZONTAL)
|
||||||
s.Add(ed, 1, wxEXPAND)
|
s.Add(ed, 1, wxEXPAND)
|
||||||
p.SetSizer(s)
|
p.SetSizer(s)
|
||||||
p.SetAutoLayout(true)
|
p.SetAutoLayout(True)
|
||||||
|
|
||||||
|
|
||||||
#ed.SetBufferedDraw(false)
|
#ed.SetBufferedDraw(False)
|
||||||
#ed.StyleClearAll()
|
#ed.StyleClearAll()
|
||||||
#ed.SetScrollWidth(800)
|
#ed.SetScrollWidth(800)
|
||||||
#ed.SetWrapMode(true)
|
#ed.SetWrapMode(True)
|
||||||
|
|
||||||
ed.SetText(demoText)
|
ed.SetText(demoText)
|
||||||
if wxUSE_UNICODE:
|
if wxUSE_UNICODE:
|
||||||
|
@@ -51,8 +51,8 @@ class PythonSTC(wxStyledTextCtrl):
|
|||||||
self.SetProperty("tab.timmy.whinge.level", "1")
|
self.SetProperty("tab.timmy.whinge.level", "1")
|
||||||
self.SetMargins(0,0)
|
self.SetMargins(0,0)
|
||||||
|
|
||||||
self.SetViewWhiteSpace(false)
|
self.SetViewWhiteSpace(False)
|
||||||
#self.SetBufferedDraw(false)
|
#self.SetBufferedDraw(False)
|
||||||
|
|
||||||
self.SetEdgeMode(wxSTC_EDGE_BACKGROUND)
|
self.SetEdgeMode(wxSTC_EDGE_BACKGROUND)
|
||||||
self.SetEdgeColumn(78)
|
self.SetEdgeColumn(78)
|
||||||
@@ -61,7 +61,7 @@ class PythonSTC(wxStyledTextCtrl):
|
|||||||
#self.SetFoldFlags(16) ### WHAT IS THIS VALUE? WHAT ARE THE OTHER FLAGS? DOES IT MATTER?
|
#self.SetFoldFlags(16) ### WHAT IS THIS VALUE? WHAT ARE THE OTHER FLAGS? DOES IT MATTER?
|
||||||
self.SetMarginType(2, wxSTC_MARGIN_SYMBOL)
|
self.SetMarginType(2, wxSTC_MARGIN_SYMBOL)
|
||||||
self.SetMarginMask(2, wxSTC_MASK_FOLDERS)
|
self.SetMarginMask(2, wxSTC_MASK_FOLDERS)
|
||||||
self.SetMarginSensitive(2, true)
|
self.SetMarginSensitive(2, True)
|
||||||
self.SetMarginWidth(2, 12)
|
self.SetMarginWidth(2, 12)
|
||||||
|
|
||||||
if 0: # simple folder marks, like the old version
|
if 0: # simple folder marks, like the old version
|
||||||
@@ -165,7 +165,7 @@ class PythonSTC(wxStyledTextCtrl):
|
|||||||
kw.append("this_is_a_much_much_much_much_much_much_much_longer_value")
|
kw.append("this_is_a_much_much_much_much_much_much_much_longer_value")
|
||||||
|
|
||||||
kw.sort() # Python sorts are case sensitive
|
kw.sort() # Python sorts are case sensitive
|
||||||
self.AutoCompSetIgnoreCase(false) # so this needs to match
|
self.AutoCompSetIgnoreCase(False) # so this needs to match
|
||||||
|
|
||||||
self.AutoCompShow(0, " ".join(kw))
|
self.AutoCompShow(0, " ".join(kw))
|
||||||
else:
|
else:
|
||||||
@@ -201,9 +201,9 @@ class PythonSTC(wxStyledTextCtrl):
|
|||||||
else:
|
else:
|
||||||
self.BraceHighlight(braceAtCaret, braceOpposite)
|
self.BraceHighlight(braceAtCaret, braceOpposite)
|
||||||
#pt = self.PointFromPosition(braceOpposite)
|
#pt = self.PointFromPosition(braceOpposite)
|
||||||
#self.Refresh(true, wxRect(pt.x, pt.y, 5,5))
|
#self.Refresh(True, wxRect(pt.x, pt.y, 5,5))
|
||||||
#print pt
|
#print pt
|
||||||
#self.Refresh(false)
|
#self.Refresh(False)
|
||||||
|
|
||||||
|
|
||||||
def OnMarginClick(self, evt):
|
def OnMarginClick(self, evt):
|
||||||
@@ -215,22 +215,22 @@ class PythonSTC(wxStyledTextCtrl):
|
|||||||
lineClicked = self.LineFromPosition(evt.GetPosition())
|
lineClicked = self.LineFromPosition(evt.GetPosition())
|
||||||
if self.GetFoldLevel(lineClicked) & wxSTC_FOLDLEVELHEADERFLAG:
|
if self.GetFoldLevel(lineClicked) & wxSTC_FOLDLEVELHEADERFLAG:
|
||||||
if evt.GetShift():
|
if evt.GetShift():
|
||||||
self.SetFoldExpanded(lineClicked, true)
|
self.SetFoldExpanded(lineClicked, True)
|
||||||
self.Expand(lineClicked, true, true, 1)
|
self.Expand(lineClicked, True, True, 1)
|
||||||
elif evt.GetControl():
|
elif evt.GetControl():
|
||||||
if self.GetFoldExpanded(lineClicked):
|
if self.GetFoldExpanded(lineClicked):
|
||||||
self.SetFoldExpanded(lineClicked, false)
|
self.SetFoldExpanded(lineClicked, False)
|
||||||
self.Expand(lineClicked, false, true, 0)
|
self.Expand(lineClicked, False, True, 0)
|
||||||
else:
|
else:
|
||||||
self.SetFoldExpanded(lineClicked, true)
|
self.SetFoldExpanded(lineClicked, True)
|
||||||
self.Expand(lineClicked, true, true, 100)
|
self.Expand(lineClicked, True, True, 100)
|
||||||
else:
|
else:
|
||||||
self.ToggleFold(lineClicked)
|
self.ToggleFold(lineClicked)
|
||||||
|
|
||||||
|
|
||||||
def FoldAll(self):
|
def FoldAll(self):
|
||||||
lineCount = self.GetLineCount()
|
lineCount = self.GetLineCount()
|
||||||
expanding = true
|
expanding = True
|
||||||
|
|
||||||
# find out if we are folding or unfolding
|
# find out if we are folding or unfolding
|
||||||
for lineNum in range(lineCount):
|
for lineNum in range(lineCount):
|
||||||
@@ -245,12 +245,12 @@ class PythonSTC(wxStyledTextCtrl):
|
|||||||
(level & wxSTC_FOLDLEVELNUMBERMASK) == wxSTC_FOLDLEVELBASE:
|
(level & wxSTC_FOLDLEVELNUMBERMASK) == wxSTC_FOLDLEVELBASE:
|
||||||
|
|
||||||
if expanding:
|
if expanding:
|
||||||
self.SetFoldExpanded(lineNum, true)
|
self.SetFoldExpanded(lineNum, True)
|
||||||
lineNum = self.Expand(lineNum, true)
|
lineNum = self.Expand(lineNum, True)
|
||||||
lineNum = lineNum - 1
|
lineNum = lineNum - 1
|
||||||
else:
|
else:
|
||||||
lastChild = self.GetLastChild(lineNum, -1)
|
lastChild = self.GetLastChild(lineNum, -1)
|
||||||
self.SetFoldExpanded(lineNum, false)
|
self.SetFoldExpanded(lineNum, False)
|
||||||
if lastChild > lineNum:
|
if lastChild > lineNum:
|
||||||
self.HideLines(lineNum+1, lastChild)
|
self.HideLines(lineNum+1, lastChild)
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ class PythonSTC(wxStyledTextCtrl):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def Expand(self, line, doExpand, force=false, visLevels=0, level=-1):
|
def Expand(self, line, doExpand, force=False, visLevels=0, level=-1):
|
||||||
lastChild = self.GetLastChild(line, level)
|
lastChild = self.GetLastChild(line, level)
|
||||||
line = line + 1
|
line = line + 1
|
||||||
while line <= lastChild:
|
while line <= lastChild:
|
||||||
@@ -277,16 +277,16 @@ class PythonSTC(wxStyledTextCtrl):
|
|||||||
if level & wxSTC_FOLDLEVELHEADERFLAG:
|
if level & wxSTC_FOLDLEVELHEADERFLAG:
|
||||||
if force:
|
if force:
|
||||||
if visLevels > 1:
|
if visLevels > 1:
|
||||||
self.SetFoldExpanded(line, true)
|
self.SetFoldExpanded(line, True)
|
||||||
else:
|
else:
|
||||||
self.SetFoldExpanded(line, false)
|
self.SetFoldExpanded(line, False)
|
||||||
line = self.Expand(line, doExpand, force, visLevels-1)
|
line = self.Expand(line, doExpand, force, visLevels-1)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if doExpand and self.GetFoldExpanded(line):
|
if doExpand and self.GetFoldExpanded(line):
|
||||||
line = self.Expand(line, true, force, visLevels-1)
|
line = self.Expand(line, True, force, visLevels-1)
|
||||||
else:
|
else:
|
||||||
line = self.Expand(line, false, force, visLevels-1)
|
line = self.Expand(line, False, force, visLevels-1)
|
||||||
else:
|
else:
|
||||||
line = line + 1;
|
line = line + 1;
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ def runTest(frame, nb, log):
|
|||||||
s = wxBoxSizer(wxHORIZONTAL)
|
s = wxBoxSizer(wxHORIZONTAL)
|
||||||
s.Add(ed, 1, wxEXPAND)
|
s.Add(ed, 1, wxEXPAND)
|
||||||
p.SetSizer(s)
|
p.SetSizer(s)
|
||||||
p.SetAutoLayout(true)
|
p.SetAutoLayout(True)
|
||||||
|
|
||||||
|
|
||||||
ed.SetText(demoText + open('Main.py').read())
|
ed.SetText(demoText + open('Main.py').read())
|
||||||
|
@@ -57,7 +57,7 @@ class TestPanel(wxPanel):
|
|||||||
t4.SetInsertionPoint(0)
|
t4.SetInsertionPoint(0)
|
||||||
t4.SetStyle(44, 47, wxTextAttr("RED", "YELLOW"))
|
t4.SetStyle(44, 47, wxTextAttr("RED", "YELLOW"))
|
||||||
points = t4.GetFont().GetPointSize() # get the current size
|
points = t4.GetFont().GetPointSize() # get the current size
|
||||||
f = wxFont(points+3, wxROMAN, wxITALIC, wxBOLD, true)
|
f = wxFont(points+3, wxROMAN, wxITALIC, wxBOLD, True)
|
||||||
t4.SetStyle(63, 77, wxTextAttr("BLUE", wxNullColour, f))
|
t4.SetStyle(63, 77, wxTextAttr("BLUE", wxNullColour, f))
|
||||||
|
|
||||||
l5 = wxStaticText(self, -1, "Test Positions")
|
l5 = wxStaticText(self, -1, "Test Positions")
|
||||||
@@ -86,7 +86,7 @@ class TestPanel(wxPanel):
|
|||||||
border = wxBoxSizer(wxVERTICAL)
|
border = wxBoxSizer(wxVERTICAL)
|
||||||
border.Add(sizer, 0, wxALL, 25)
|
border.Add(sizer, 0, wxALL, 25)
|
||||||
self.SetSizer(border)
|
self.SetSizer(border)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
|
|
||||||
|
|
||||||
def EvtText(self, event):
|
def EvtText(self, event):
|
||||||
|
@@ -25,7 +25,7 @@ class TestPanel( wxPanel ):
|
|||||||
|
|
||||||
|
|
||||||
text2 = wxStaticText( panel, 40, "A 24-hour format wxTimeCtrl:")
|
text2 = wxStaticText( panel, 40, "A 24-hour format wxTimeCtrl:")
|
||||||
self.time24 = wxTimeCtrl( panel, 50, fmt24hr=true, name="24 hour control" )
|
self.time24 = wxTimeCtrl( panel, 50, fmt24hr=True, name="24 hour control" )
|
||||||
spin2 = wxSpinButton( panel, 60, wxDefaultPosition, wxSize(-1,20), 0 )
|
spin2 = wxSpinButton( panel, 60, wxDefaultPosition, wxSize(-1,20), 0 )
|
||||||
self.time24.BindSpinButton( spin2 )
|
self.time24.BindSpinButton( spin2 )
|
||||||
|
|
||||||
@@ -69,10 +69,10 @@ class TestPanel( wxPanel ):
|
|||||||
try:
|
try:
|
||||||
from mx import DateTime
|
from mx import DateTime
|
||||||
except ImportError:
|
except ImportError:
|
||||||
self.radioMx.Enable( false )
|
self.radioMx.Enable( False )
|
||||||
|
|
||||||
|
|
||||||
panel.SetAutoLayout( true )
|
panel.SetAutoLayout( True )
|
||||||
panel.SetSizer( outer_box )
|
panel.SetSizer( outer_box )
|
||||||
outer_box.Fit( panel )
|
outer_box.Fit( panel )
|
||||||
panel.Move( (50,50) )
|
panel.Move( (50,50) )
|
||||||
@@ -137,7 +137,7 @@ Here's the API for wxTimeCtrl:
|
|||||||
<B>value</B> = '12:00:00 AM',
|
<B>value</B> = '12:00:00 AM',
|
||||||
pos = wxDefaultPosition,
|
pos = wxDefaultPosition,
|
||||||
size = wxDefaultSize,
|
size = wxDefaultSize,
|
||||||
<B>fmt24hr</B> = false,
|
<B>fmt24hr</B> = False,
|
||||||
<B>spinButton</B> = None,
|
<B>spinButton</B> = None,
|
||||||
<B>style</B> = wxTE_PROCESS_TAB,
|
<B>style</B> = wxTE_PROCESS_TAB,
|
||||||
name = "time")
|
name = "time")
|
||||||
@@ -152,7 +152,7 @@ Here's the API for wxTimeCtrl:
|
|||||||
if wxDefaultSize is specified.
|
if wxDefaultSize is specified.
|
||||||
<BR>
|
<BR>
|
||||||
<DT><B>fmt24hr</B>
|
<DT><B>fmt24hr</B>
|
||||||
<DD>If true, control will display time in 24 hour time format; if false, it will
|
<DD>If True, control will display time in 24 hour time format; if False, it will
|
||||||
use 12 hour AM/PM format. SetValue() will adjust values accordingly for the
|
use 12 hour AM/PM format. SetValue() will adjust values accordingly for the
|
||||||
control, based on the format specified.
|
control, based on the format specified.
|
||||||
<BR>
|
<BR>
|
||||||
|
@@ -20,7 +20,7 @@ class TestPanel(wxPanel):
|
|||||||
EVT_TOGGLEBUTTON(self, b.GetId(), self.OnToggle)
|
EVT_TOGGLEBUTTON(self, b.GetId(), self.OnToggle)
|
||||||
buttons.Add(b, flag=wxALL, border=5)
|
buttons.Add(b, flag=wxALL, border=5)
|
||||||
|
|
||||||
panel.SetAutoLayout(true)
|
panel.SetAutoLayout(True)
|
||||||
panel.SetSizer(buttons)
|
panel.SetSizer(buttons)
|
||||||
buttons.Fit(panel)
|
buttons.Fit(panel)
|
||||||
panel.Move((50,50))
|
panel.Move((50,50))
|
||||||
|
@@ -101,7 +101,7 @@ class TestToolBar(wxFrame):
|
|||||||
def runTest(frame, nb, log):
|
def runTest(frame, nb, log):
|
||||||
win = TestToolBar(frame, log)
|
win = TestToolBar(frame, log)
|
||||||
frame.otherWin = win
|
frame.otherWin = win
|
||||||
win.Show(true)
|
win.Show(True)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -161,7 +161,7 @@ class TestTreeCtrlPanel(wxPanel):
|
|||||||
self.log.WriteText("OnSelChanged: %s\n" % self.tree.GetItemText(self.item))
|
self.log.WriteText("OnSelChanged: %s\n" % self.tree.GetItemText(self.item))
|
||||||
if wxPlatform == '__WXMSW__':
|
if wxPlatform == '__WXMSW__':
|
||||||
self.log.WriteText("BoundingRect: %s\n" %
|
self.log.WriteText("BoundingRect: %s\n" %
|
||||||
self.tree.GetBoundingRect(self.item, true))
|
self.tree.GetBoundingRect(self.item, True))
|
||||||
#items = self.tree.GetSelections()
|
#items = self.tree.GetSelections()
|
||||||
#print map(self.tree.GetItemText, items)
|
#print map(self.tree.GetItemText, items)
|
||||||
event.Skip()
|
event.Skip()
|
||||||
|
@@ -24,14 +24,14 @@ class MyValidator(wxPyValidator):
|
|||||||
if self.flag == ALPHA_ONLY:
|
if self.flag == ALPHA_ONLY:
|
||||||
for x in val:
|
for x in val:
|
||||||
if x not in string.letters:
|
if x not in string.letters:
|
||||||
return false
|
return False
|
||||||
|
|
||||||
elif self.flag == DIGIT_ONLY:
|
elif self.flag == DIGIT_ONLY:
|
||||||
for x in val:
|
for x in val:
|
||||||
if x not in string.digits:
|
if x not in string.digits:
|
||||||
return false
|
return False
|
||||||
|
|
||||||
return true
|
return True
|
||||||
|
|
||||||
|
|
||||||
def OnChar(self, event):
|
def OnChar(self, event):
|
||||||
@@ -58,7 +58,7 @@ class MyValidator(wxPyValidator):
|
|||||||
class TestValidatorPanel(wxPanel):
|
class TestValidatorPanel(wxPanel):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wxPanel.__init__(self, parent, -1)
|
wxPanel.__init__(self, parent, -1)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
VSPACE = 10
|
VSPACE = 10
|
||||||
|
|
||||||
fgs = wxFlexGridSizer(0, 2)
|
fgs = wxFlexGridSizer(0, 2)
|
||||||
@@ -130,30 +130,30 @@ class TextObjectValidator(wxPyValidator):
|
|||||||
textCtrl.SetBackgroundColour("pink")
|
textCtrl.SetBackgroundColour("pink")
|
||||||
textCtrl.SetFocus()
|
textCtrl.SetFocus()
|
||||||
textCtrl.Refresh()
|
textCtrl.Refresh()
|
||||||
return false
|
return False
|
||||||
else:
|
else:
|
||||||
textCtrl.SetBackgroundColour(
|
textCtrl.SetBackgroundColour(
|
||||||
wxSystemSettings_GetColour(wxSYS_COLOUR_WINDOW))
|
wxSystemSettings_GetColour(wxSYS_COLOUR_WINDOW))
|
||||||
textCtrl.Refresh()
|
textCtrl.Refresh()
|
||||||
return true
|
return True
|
||||||
|
|
||||||
|
|
||||||
def TransferToWindow(self):
|
def TransferToWindow(self):
|
||||||
""" Transfer data from validator to window.
|
""" Transfer data from validator to window.
|
||||||
|
|
||||||
The default implementation returns false, indicating that an error
|
The default implementation returns False, indicating that an error
|
||||||
occurred. We simply return true, as we don't do any data transfer.
|
occurred. We simply return True, as we don't do any data transfer.
|
||||||
"""
|
"""
|
||||||
return true # Prevent wxDialog from complaining.
|
return True # Prevent wxDialog from complaining.
|
||||||
|
|
||||||
|
|
||||||
def TransferFromWindow(self):
|
def TransferFromWindow(self):
|
||||||
""" Transfer data from window to validator.
|
""" Transfer data from window to validator.
|
||||||
|
|
||||||
The default implementation returns false, indicating that an error
|
The default implementation returns False, indicating that an error
|
||||||
occurred. We simply return true, as we don't do any data transfer.
|
occurred. We simply return True, as we don't do any data transfer.
|
||||||
"""
|
"""
|
||||||
return true # Prevent wxDialog from complaining.
|
return True # Prevent wxDialog from complaining.
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ class TestValidateDialog(wxDialog):
|
|||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wxDialog.__init__(self, parent, -1, "Validated Dialog")
|
wxDialog.__init__(self, parent, -1, "Validated Dialog")
|
||||||
|
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
VSPACE = 10
|
VSPACE = 10
|
||||||
|
|
||||||
fgs = wxFlexGridSizer(0, 2)
|
fgs = wxFlexGridSizer(0, 2)
|
||||||
|
@@ -51,7 +51,7 @@ class TestPanel(wxPanel):
|
|||||||
sizer.Add(panel, 1, wxEXPAND|wxALL, 5)
|
sizer.Add(panel, 1, wxEXPAND|wxALL, 5)
|
||||||
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
@@ -153,7 +153,7 @@ class TestPanel(wxPanel):
|
|||||||
sizer.Add(panel, 1, wxEXPAND|wxALL, 5)
|
sizer.Add(panel, 1, wxEXPAND|wxALL, 5)
|
||||||
|
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
self.SetAutoLayout(true)
|
self.SetAutoLayout(True)
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
@@ -933,12 +933,6 @@ enum wxHitTest
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define FALSE 0
|
|
||||||
#define false 0
|
|
||||||
#define TRUE 1
|
|
||||||
#define true 1
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -595,14 +595,25 @@ wxPen = wxPyPen
|
|||||||
wxScrollbar = wxScrollBar
|
wxScrollbar = wxScrollBar
|
||||||
wxPoint2D = wxPoint2DDouble
|
wxPoint2D = wxPoint2DDouble
|
||||||
|
|
||||||
|
# Use Python's bool constants if available, make aliases if not
|
||||||
|
try:
|
||||||
|
True
|
||||||
|
except NameError:
|
||||||
|
True = 1==1
|
||||||
|
False = 1==0
|
||||||
|
|
||||||
|
|
||||||
# backwards compatibility
|
# backwards compatibility
|
||||||
wxNoRefBitmap = wxBitmap
|
wxNoRefBitmap = wxBitmap
|
||||||
wxPyDefaultPosition = wxDefaultPosition
|
wxPyDefaultPosition = wxDefaultPosition
|
||||||
wxPyDefaultSize = wxDefaultSize
|
wxPyDefaultSize = wxDefaultSize
|
||||||
NULL = None
|
NULL = None
|
||||||
wxSystemSettings_GetSystemColour = wxSystemSettings_GetColour
|
wxSystemSettings_GetSystemColour = wxSystemSettings_GetColour
|
||||||
wxSystemSettings_GetSystemFont = wxSystemSettings_GetFont
|
wxSystemSettings_GetSystemFont = wxSystemSettings_GetFont
|
||||||
wxSystemSettings_GetSystemMetric = wxSystemSettings_GetMetric
|
wxSystemSettings_GetSystemMetric = wxSystemSettings_GetMetric
|
||||||
|
false = FALSE = False
|
||||||
|
true = TRUE = True
|
||||||
|
|
||||||
|
|
||||||
# workarounds for bad wxRTTI names
|
# workarounds for bad wxRTTI names
|
||||||
__wxPyPtrTypeMap['wxGauge95'] = 'wxGauge'
|
__wxPyPtrTypeMap['wxGauge95'] = 'wxGauge'
|
||||||
@@ -679,8 +690,8 @@ def wxPy_isinstance(obj, klasses):
|
|||||||
import types
|
import types
|
||||||
if sys.version[:3] < "2.2" and type(klasses) in [types.TupleType, types.ListType]:
|
if sys.version[:3] < "2.2" and type(klasses) in [types.TupleType, types.ListType]:
|
||||||
for klass in klasses:
|
for klass in klasses:
|
||||||
if isinstance(obj, klass): return true
|
if isinstance(obj, klass): return True
|
||||||
return false
|
return False
|
||||||
else:
|
else:
|
||||||
return isinstance(obj, klasses)
|
return isinstance(obj, klasses)
|
||||||
|
|
||||||
@@ -770,7 +781,7 @@ class wxPyOnDemandOutputWindow:
|
|||||||
self.text = wxTextCtrl(self.frame, -1, "",
|
self.text = wxTextCtrl(self.frame, -1, "",
|
||||||
style = wxTE_MULTILINE|wxTE_READONLY)
|
style = wxTE_MULTILINE|wxTE_READONLY)
|
||||||
self.frame.SetSize(wxSize(450, 300))
|
self.frame.SetSize(wxSize(450, 300))
|
||||||
self.frame.Show(true)
|
self.frame.Show(True)
|
||||||
EVT_CLOSE(self.frame, self.OnCloseWindow)
|
EVT_CLOSE(self.frame, self.OnCloseWindow)
|
||||||
self.text.AppendText(str)
|
self.text.AppendText(str)
|
||||||
|
|
||||||
@@ -791,7 +802,7 @@ class wxApp(wxPyApp):
|
|||||||
error = 'wxApp.error'
|
error = 'wxApp.error'
|
||||||
outputWindowClass = wxPyOnDemandOutputWindow
|
outputWindowClass = wxPyOnDemandOutputWindow
|
||||||
|
|
||||||
def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=false):
|
def __init__(self, redirect=_defRedirect, filename=None, useBestVisual=False):
|
||||||
wxPyApp.__init__(self)
|
wxPyApp.__init__(self)
|
||||||
self.stdioWin = None
|
self.stdioWin = None
|
||||||
self.saveStdio = (sys.stdout, sys.stderr)
|
self.saveStdio = (sys.stdout, sys.stderr)
|
||||||
@@ -843,7 +854,7 @@ class wxPySimpleApp(wxApp):
|
|||||||
wxApp.__init__(self, flag)
|
wxApp.__init__(self, flag)
|
||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
wxInitAllImageHandlers()
|
wxInitAllImageHandlers()
|
||||||
return true
|
return True
|
||||||
|
|
||||||
|
|
||||||
class wxPyWidgetTester(wxApp):
|
class wxPyWidgetTester(wxApp):
|
||||||
@@ -854,11 +865,11 @@ class wxPyWidgetTester(wxApp):
|
|||||||
def OnInit(self):
|
def OnInit(self):
|
||||||
self.frame = wxFrame(None, -1, "Widget Tester", pos=(0,0), size=self.size)
|
self.frame = wxFrame(None, -1, "Widget Tester", pos=(0,0), size=self.size)
|
||||||
self.SetTopWindow(self.frame)
|
self.SetTopWindow(self.frame)
|
||||||
return true
|
return True
|
||||||
|
|
||||||
def SetWidget(self, widgetClass, *args):
|
def SetWidget(self, widgetClass, *args):
|
||||||
w = apply(widgetClass, (self.frame,) + args)
|
w = apply(widgetClass, (self.frame,) + args)
|
||||||
self.frame.Show(true)
|
self.frame.Show(True)
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# DO NOT hold any other references to this object. This is how we
|
# DO NOT hold any other references to this object. This is how we
|
||||||
|
@@ -276,10 +276,10 @@ class wxPythonRExec (rexec.RExec):
|
|||||||
class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
|
class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
|
||||||
this_exception = 0
|
this_exception = 0
|
||||||
populate_function = populate_wxPyNonFatalErrorDialogWithTraceback
|
populate_function = populate_wxPyNonFatalErrorDialogWithTraceback
|
||||||
no_continue_button = false
|
no_continue_button = False
|
||||||
fatal = false
|
fatal = False
|
||||||
modal = true
|
modal = True
|
||||||
exitjustreturns = false # really only for testing!
|
exitjustreturns = False # really only for testing!
|
||||||
|
|
||||||
def __init__(self, parent, id,
|
def __init__(self, parent, id,
|
||||||
pos=wxPyDefaultPosition,
|
pos=wxPyDefaultPosition,
|
||||||
@@ -293,7 +293,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
|
|||||||
caption="Python error!",
|
caption="Python error!",
|
||||||
versionname=None,
|
versionname=None,
|
||||||
errorname=None,
|
errorname=None,
|
||||||
disable_exit_button=false):
|
disable_exit_button=False):
|
||||||
|
|
||||||
if self.fatal:
|
if self.fatal:
|
||||||
whetherNF = ""
|
whetherNF = ""
|
||||||
@@ -309,7 +309,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
|
|||||||
|
|
||||||
wxDialog.__init__(self, parent, id, title, pos, size, style)
|
wxDialog.__init__(self, parent, id, title, pos, size, style)
|
||||||
|
|
||||||
self.topsizer = self.populate_function( false,true )
|
self.topsizer = self.populate_function( False,True )
|
||||||
|
|
||||||
self.SetProgramName(programname)
|
self.SetProgramName(programname)
|
||||||
self.SetVersion(version)
|
self.SetVersion(version)
|
||||||
@@ -332,10 +332,10 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
|
|||||||
if not disable_mail_button:
|
if not disable_mail_button:
|
||||||
EVT_BUTTON(self, wxPyError_ID_MAIL, self.OnMail)
|
EVT_BUTTON(self, wxPyError_ID_MAIL, self.OnMail)
|
||||||
else:
|
else:
|
||||||
self.GetMailButton().Enable(false)
|
self.GetMailButton().Enable(False)
|
||||||
# disable the entry box for an e-mail address by default (NOT PROPERLY DOCUMENTED)
|
# disable the entry box for an e-mail address by default (NOT PROPERLY DOCUMENTED)
|
||||||
if not hasattr(self,"enable_mail_address_box"):
|
if not hasattr(self,"enable_mail_address_box"):
|
||||||
self.FindWindowById(wxPyError_ID_ADDRESS).Enable(false)
|
self.FindWindowById(wxPyError_ID_ADDRESS).Enable(False)
|
||||||
if not disable_exit_button:
|
if not disable_exit_button:
|
||||||
EVT_BUTTON(self, wxPyError_ID_EXIT, self.OnExit)
|
EVT_BUTTON(self, wxPyError_ID_EXIT, self.OnExit)
|
||||||
|
|
||||||
@@ -415,7 +415,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
|
|||||||
self.sizerAroundText.SetItemMinSize (c,w,h)
|
self.sizerAroundText.SetItemMinSize (c,w,h)
|
||||||
c.SetSize ((w,h))
|
c.SetSize ((w,h))
|
||||||
c.SetSizeHints (w,h,w,h)
|
c.SetSizeHints (w,h,w,h)
|
||||||
c.Refresh()#.SetAutoLayout(FALSE)
|
c.Refresh()#.SetAutoLayout(False)
|
||||||
|
|
||||||
#^ the reason we need the above seems to be to replace the
|
#^ the reason we need the above seems to be to replace the
|
||||||
#faulty GetBestSize of wxTextCtrl...
|
#faulty GetBestSize of wxTextCtrl...
|
||||||
@@ -503,7 +503,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
|
|||||||
if self.modal:
|
if self.modal:
|
||||||
self.ShowModal()
|
self.ShowModal()
|
||||||
else:
|
else:
|
||||||
self.Show(true)
|
self.Show(True)
|
||||||
|
|
||||||
except:
|
except:
|
||||||
if not locals().has_key("c"):
|
if not locals().has_key("c"):
|
||||||
@@ -654,8 +654,8 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
|
|||||||
|
|
||||||
class wxPyFatalErrorDialogWithTraceback(wxPyNonFatalErrorDialogWithTraceback):
|
class wxPyFatalErrorDialogWithTraceback(wxPyNonFatalErrorDialogWithTraceback):
|
||||||
populate_function = populate_wxPyFatalErrorDialogWithTraceback
|
populate_function = populate_wxPyFatalErrorDialogWithTraceback
|
||||||
no_continue_button = true
|
no_continue_button = True
|
||||||
fatal = true
|
fatal = True
|
||||||
|
|
||||||
class wxPyNonFatalErrorDialog(wxPyNonFatalErrorDialogWithTraceback):
|
class wxPyNonFatalErrorDialog(wxPyNonFatalErrorDialogWithTraceback):
|
||||||
populate_function = populate_wxPyNonFatalErrorDialog
|
populate_function = populate_wxPyNonFatalErrorDialog
|
||||||
@@ -719,7 +719,7 @@ def _writehtmlmessage(mailto,subject,html,text=None,parent=None,mailfrom=None):
|
|||||||
|
|
||||||
def _createhtmlmail (html, text, subject, to=None, mailfrom=None):
|
def _createhtmlmail (html, text, subject, to=None, mailfrom=None):
|
||||||
"""Create a mime-message that will render HTML in popular
|
"""Create a mime-message that will render HTML in popular
|
||||||
MUAs, text in better ones (if indeed text is not untrue (e.g. None)
|
MUAs, text in better ones (if indeed text is not unTrue (e.g. None)
|
||||||
"""
|
"""
|
||||||
import MimeWriter, mimetools, cStringIO
|
import MimeWriter, mimetools, cStringIO
|
||||||
|
|
||||||
@@ -849,7 +849,7 @@ def wxPyFatalOrNonFatalError(parent,
|
|||||||
else:
|
else:
|
||||||
populate_function = populate_wxPyNonFatalError
|
populate_function = populate_wxPyNonFatalError
|
||||||
|
|
||||||
sizer = populate_function(dlg,false,true)
|
sizer = populate_function(dlg,False,True)
|
||||||
|
|
||||||
window = dlg.FindWindowById(wxPyError_ID_HTML)
|
window = dlg.FindWindowById(wxPyError_ID_HTML)
|
||||||
window.SetPage(msg)
|
window.SetPage(msg)
|
||||||
@@ -875,5 +875,5 @@ def wxPyFatalOrNonFatalError(parent,
|
|||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
return v
|
return v
|
||||||
else:
|
else:
|
||||||
dlg.Show(true)
|
dlg.Show(True)
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@ getwxPythonImage
|
|||||||
|
|
||||||
PythonBitmaps
|
PythonBitmaps
|
||||||
|
|
||||||
--This takes a single argument. If it tests true,
|
--This takes a single argument. If it tests True,
|
||||||
getPythonPoweredBitmap() is returned, else getwxPythonBitmap() is
|
getPythonPoweredBitmap() is returned, else getwxPythonBitmap() is
|
||||||
returned.
|
returned.
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@ import imageutils
|
|||||||
class wxGenButtonEvent(wxPyCommandEvent):
|
class wxGenButtonEvent(wxPyCommandEvent):
|
||||||
def __init__(self, eventType, ID):
|
def __init__(self, eventType, ID):
|
||||||
wxPyCommandEvent.__init__(self, eventType, ID)
|
wxPyCommandEvent.__init__(self, eventType, ID)
|
||||||
self.isDown = false
|
self.isDown = False
|
||||||
self.theButton = None
|
self.theButton = None
|
||||||
|
|
||||||
def SetIsDown(self, isDown):
|
def SetIsDown(self, isDown):
|
||||||
@@ -65,10 +65,10 @@ class wxGenButton(wxPyControl):
|
|||||||
style = wxNO_BORDER
|
style = wxNO_BORDER
|
||||||
wxPyControl.__init__(self, parent, ID, pos, size, style, validator, name)
|
wxPyControl.__init__(self, parent, ID, pos, size, style, validator, name)
|
||||||
|
|
||||||
self.up = true
|
self.up = True
|
||||||
self.bezelWidth = 2
|
self.bezelWidth = 2
|
||||||
self.hasFocus = false
|
self.hasFocus = False
|
||||||
self.useFocusInd = true
|
self.useFocusInd = True
|
||||||
|
|
||||||
self.SetLabel(label)
|
self.SetLabel(label)
|
||||||
self.SetPosition(pos)
|
self.SetPosition(pos)
|
||||||
@@ -133,7 +133,7 @@ class wxGenButton(wxPyControl):
|
|||||||
return self.IsShown() and self.IsEnabled()
|
return self.IsShown() and self.IsEnabled()
|
||||||
|
|
||||||
|
|
||||||
def Enable(self, enable=true):
|
def Enable(self, enable=True):
|
||||||
wxPyControl.Enable(self, enable)
|
wxPyControl.Enable(self, enable)
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ class wxGenButton(wxPyControl):
|
|||||||
def _GetLabelSize(self):
|
def _GetLabelSize(self):
|
||||||
""" used internally """
|
""" used internally """
|
||||||
w, h = self.GetTextExtent(self.GetLabel())
|
w, h = self.GetTextExtent(self.GetLabel())
|
||||||
return w, h, true
|
return w, h, True
|
||||||
|
|
||||||
|
|
||||||
def Notify(self):
|
def Notify(self):
|
||||||
@@ -277,7 +277,7 @@ class wxGenButton(wxPyControl):
|
|||||||
def OnLeftDown(self, event):
|
def OnLeftDown(self, event):
|
||||||
if not self.IsEnabled():
|
if not self.IsEnabled():
|
||||||
return
|
return
|
||||||
self.up = false
|
self.up = False
|
||||||
self.CaptureMouse()
|
self.CaptureMouse()
|
||||||
self.SetFocus()
|
self.SetFocus()
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
@@ -291,7 +291,7 @@ class wxGenButton(wxPyControl):
|
|||||||
self.ReleaseMouse()
|
self.ReleaseMouse()
|
||||||
if not self.up: # if the button was down when the mouse was released...
|
if not self.up: # if the button was down when the mouse was released...
|
||||||
self.Notify()
|
self.Notify()
|
||||||
self.up = true
|
self.up = True
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
@@ -303,18 +303,18 @@ class wxGenButton(wxPyControl):
|
|||||||
x,y = event.GetPositionTuple()
|
x,y = event.GetPositionTuple()
|
||||||
w,h = self.GetClientSizeTuple()
|
w,h = self.GetClientSizeTuple()
|
||||||
if self.up and x<w and x>=0 and y<h and y>=0:
|
if self.up and x<w and x>=0 and y<h and y>=0:
|
||||||
self.up = false
|
self.up = False
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
return
|
return
|
||||||
if not self.up and (x<0 or y<0 or x>=w or y>=h):
|
if not self.up and (x<0 or y<0 or x>=w or y>=h):
|
||||||
self.up = true
|
self.up = True
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
return
|
return
|
||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
|
|
||||||
def OnGainFocus(self, event):
|
def OnGainFocus(self, event):
|
||||||
self.hasFocus = true
|
self.hasFocus = True
|
||||||
dc = wxClientDC(self)
|
dc = wxClientDC(self)
|
||||||
w, h = self.GetClientSizeTuple()
|
w, h = self.GetClientSizeTuple()
|
||||||
if self.useFocusInd:
|
if self.useFocusInd:
|
||||||
@@ -322,7 +322,7 @@ class wxGenButton(wxPyControl):
|
|||||||
|
|
||||||
|
|
||||||
def OnLoseFocus(self, event):
|
def OnLoseFocus(self, event):
|
||||||
self.hasFocus = false
|
self.hasFocus = False
|
||||||
dc = wxClientDC(self)
|
dc = wxClientDC(self)
|
||||||
w, h = self.GetClientSizeTuple()
|
w, h = self.GetClientSizeTuple()
|
||||||
if self.useFocusInd:
|
if self.useFocusInd:
|
||||||
@@ -331,14 +331,14 @@ class wxGenButton(wxPyControl):
|
|||||||
|
|
||||||
def OnKeyDown(self, event):
|
def OnKeyDown(self, event):
|
||||||
if self.hasFocus and event.KeyCode() == ord(" "):
|
if self.hasFocus and event.KeyCode() == ord(" "):
|
||||||
self.up = false
|
self.up = False
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
|
|
||||||
def OnKeyUp(self, event):
|
def OnKeyUp(self, event):
|
||||||
if self.hasFocus and event.KeyCode() == ord(" "):
|
if self.hasFocus and event.KeyCode() == ord(" "):
|
||||||
self.up = true
|
self.up = True
|
||||||
self.Notify()
|
self.Notify()
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
event.Skip()
|
event.Skip()
|
||||||
@@ -375,17 +375,17 @@ class wxGenBitmapButton(wxGenButton):
|
|||||||
def SetBitmapFocus(self, bitmap):
|
def SetBitmapFocus(self, bitmap):
|
||||||
"""Set bitmap to display when the button has the focus"""
|
"""Set bitmap to display when the button has the focus"""
|
||||||
self.bmpFocus = bitmap
|
self.bmpFocus = bitmap
|
||||||
self.SetUseFocusIndicator(false)
|
self.SetUseFocusIndicator(False)
|
||||||
|
|
||||||
def SetBitmapSelected(self, bitmap):
|
def SetBitmapSelected(self, bitmap):
|
||||||
"""Set bitmap to display when the button is selected (pressed down)"""
|
"""Set bitmap to display when the button is selected (pressed down)"""
|
||||||
self.bmpSelected = bitmap
|
self.bmpSelected = bitmap
|
||||||
|
|
||||||
def SetBitmapLabel(self, bitmap, createOthers=true):
|
def SetBitmapLabel(self, bitmap, createOthers=True):
|
||||||
"""
|
"""
|
||||||
Set the bitmap to display normally.
|
Set the bitmap to display normally.
|
||||||
This is the only one that is required. If
|
This is the only one that is required. If
|
||||||
createOthers is true, then the other bitmaps
|
createOthers is True, then the other bitmaps
|
||||||
will be generated on the fly. Currently,
|
will be generated on the fly. Currently,
|
||||||
only the disabled bitmap is generated.
|
only the disabled bitmap is generated.
|
||||||
"""
|
"""
|
||||||
@@ -399,8 +399,8 @@ class wxGenBitmapButton(wxGenButton):
|
|||||||
def _GetLabelSize(self):
|
def _GetLabelSize(self):
|
||||||
""" used internally """
|
""" used internally """
|
||||||
if not self.bmpLabel:
|
if not self.bmpLabel:
|
||||||
return -1, -1, false
|
return -1, -1, False
|
||||||
return self.bmpLabel.GetWidth()+2, self.bmpLabel.GetHeight()+2, false
|
return self.bmpLabel.GetWidth()+2, self.bmpLabel.GetHeight()+2, False
|
||||||
|
|
||||||
def DrawLabel(self, dc, width, height, dw=0, dy=0):
|
def DrawLabel(self, dc, width, height, dw=0, dy=0):
|
||||||
bmp = self.bmpLabel
|
bmp = self.bmpLabel
|
||||||
@@ -433,7 +433,7 @@ class wxGenBitmapTextButton(wxGenBitmapButton): # generic bitmapped button w
|
|||||||
""" used internally """
|
""" used internally """
|
||||||
w, h = self.GetTextExtent(self.GetLabel())
|
w, h = self.GetTextExtent(self.GetLabel())
|
||||||
if not self.bmpLabel:
|
if not self.bmpLabel:
|
||||||
return w, h, true # if there isn't a bitmap use the size of the text
|
return w, h, True # if there isn't a bitmap use the size of the text
|
||||||
|
|
||||||
w_bmp = self.bmpLabel.GetWidth()+2
|
w_bmp = self.bmpLabel.GetWidth()+2
|
||||||
h_bmp = self.bmpLabel.GetHeight()+2
|
h_bmp = self.bmpLabel.GetHeight()+2
|
||||||
@@ -442,7 +442,7 @@ class wxGenBitmapTextButton(wxGenBitmapButton): # generic bitmapped button w
|
|||||||
height = h_bmp
|
height = h_bmp
|
||||||
else:
|
else:
|
||||||
height = h
|
height = h
|
||||||
return width, height, true
|
return width, height, True
|
||||||
|
|
||||||
|
|
||||||
def DrawLabel(self, dc, width, height, dw=0, dy=0):
|
def DrawLabel(self, dc, width, height, dw=0, dy=0):
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user