Ensure that runTest is not modal, even when a required module is not
installed. Create the code page small and hide it to reduce flicker, it will later be shown and sized correctly when put into the notebook. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
3801d366cb
commit
2e839e966d
@ -21,16 +21,6 @@ NOTE: The Numeric module is substantially faster than numarray for this
|
||||
purpose, if you have lot's of objects
|
||||
"""
|
||||
|
||||
import wx
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wx.MessageDialog(frame, errorText, 'Sorry', wx.OK |
|
||||
wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
overview = ""
|
||||
|
||||
else:
|
||||
StartUpDemo = "all"
|
||||
if __name__ == "__main__": # parse options if run stand-alone
|
||||
# check options:
|
||||
@ -73,17 +63,23 @@ else:
|
||||
|
||||
|
||||
def OnButton(self, evt):
|
||||
if not haveNumeric:
|
||||
dlg = wx.MessageDialog(self, errorText, 'Sorry', wx.OK |
|
||||
wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
else:
|
||||
win = DrawFrame(None, -1, "FloatCanvas Drawing Window",wx.DefaultPosition,(500,500))
|
||||
win.Show(True)
|
||||
win.DrawTest()
|
||||
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
if haveNumeric:
|
||||
|
||||
try:
|
||||
from floatcanvas import NavCanvas, FloatCanvas
|
||||
@ -1344,7 +1340,15 @@ else:
|
||||
else:
|
||||
return Shorelines
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
## for the wxPython demo:
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = TestPanel(nb, log)
|
||||
return win
|
||||
|
||||
|
||||
if haveNumeric:
|
||||
try:
|
||||
import floatcanvas
|
||||
except ImportError: # if it's not there locally, try the wxPython lib.
|
||||
@ -1352,6 +1356,12 @@ else:
|
||||
|
||||
overview = floatcanvas.__doc__
|
||||
|
||||
else:
|
||||
overview = ""
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not haveNumeric:
|
||||
print errorText
|
||||
|
@ -18,26 +18,7 @@ except ImportError:
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
if not haveGLCanvas:
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wx.MessageDialog(frame, 'The GLCanvas class has not been included with this build of wxPython!',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
elif not haveOpenGL:
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wx.MessageDialog(frame,
|
||||
'The OpenGL package was not found. You can get it at\n'
|
||||
'http://PyOpenGL.sourceforge.net/',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
|
||||
|
||||
else:
|
||||
buttonDefs = {
|
||||
wx.NewId() : ('CubeCanvas', 'Cube'),
|
||||
wx.NewId() : ('ConeCanvas', 'Cone'),
|
||||
@ -69,6 +50,22 @@ else:
|
||||
|
||||
|
||||
def OnButton(self, evt):
|
||||
if not haveGLCanvas:
|
||||
dlg = wx.MessageDialog(self,
|
||||
'The GLCanvas class has not been included with this build of wxPython!',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
elif not haveOpenGL:
|
||||
dlg = wx.MessageDialog(self,
|
||||
'The OpenGL package was not found. You can get it at\n'
|
||||
'http://PyOpenGL.sourceforge.net/',
|
||||
'Sorry', wx.OK | wx.ICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
else:
|
||||
canvasClassName = buttonDefs[evt.GetId()][0]
|
||||
canvasClass = eval(canvasClassName)
|
||||
frame = wx.Frame(None, -1, canvasClassName, size=(400,400))
|
||||
@ -76,14 +73,6 @@ else:
|
||||
frame.Show(True)
|
||||
|
||||
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = ButtonPanel(nb, log)
|
||||
return win
|
||||
|
||||
|
||||
|
||||
|
||||
class MyCanvasBase(glcanvas.GLCanvas):
|
||||
def __init__(self, parent):
|
||||
glcanvas.GLCanvas.__init__(self, parent, -1)
|
||||
@ -256,6 +245,13 @@ else:
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
win = ButtonPanel(nb, log)
|
||||
return win
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overview = """\
|
||||
|
@ -273,7 +273,7 @@ try:
|
||||
|
||||
class DemoCodeEditor(PythonSTC):
|
||||
def __init__(self, parent):
|
||||
PythonSTC.__init__(self, parent, -1, wx.BORDER_NONE)
|
||||
PythonSTC.__init__(self, parent, -1, style=wx.BORDER_NONE)
|
||||
self.SetUpEditor()
|
||||
|
||||
# Some methods to make it compatible with how the wxTextCtrl is used
|
||||
@ -443,8 +443,8 @@ try:
|
||||
except ImportError:
|
||||
class DemoCodeEditor(wx.TextCtrl):
|
||||
def __init__(self, parent):
|
||||
wx.TextCtrl.__init__(self, parent, -1, style = wx.TE_MULTILINE |
|
||||
wx.HSCROLL | wx.TE_RICH2 | wx.TE_NOHIDESEL)
|
||||
wx.TextCtrl.__init__(self, parent, -1, style =
|
||||
wx.TE_MULTILINE | wx.HSCROLL | wx.TE_RICH2 | wx.TE_NOHIDESEL)
|
||||
|
||||
def RegisterModifiedEvent(self, eventHandler):
|
||||
self.Bind(wx.EVT_TEXT, eventHandler)
|
||||
@ -482,7 +482,8 @@ modDefault = modOriginal
|
||||
class DemoCodePanel(wx.Panel):
|
||||
"""Panel for the 'Demo Code' tab"""
|
||||
def __init__(self, parent, mainFrame):
|
||||
wx.Panel.__init__(self, parent)
|
||||
wx.Panel.__init__(self, parent, size=(1,1))
|
||||
self.Hide()
|
||||
self.mainFrame = mainFrame
|
||||
self.editor = DemoCodeEditor(self)
|
||||
self.editor.RegisterModifiedEvent(self.OnCodeModified)
|
||||
|
@ -42,9 +42,10 @@ class PythonSTC(stc.StyledTextCtrl):
|
||||
|
||||
fold_symbols = 2
|
||||
|
||||
def __init__(self, parent, ID, style=0):
|
||||
stc.StyledTextCtrl.__init__(self, parent, ID,
|
||||
style = style|wx.NO_FULL_REPAINT_ON_RESIZE)
|
||||
def __init__(self, parent, ID,
|
||||
pos=wx.DefaultPosition, size=wx.DefaultSize,
|
||||
style=0):
|
||||
stc.StyledTextCtrl.__init__(self, parent, ID, pos, size, style)
|
||||
|
||||
self.CmdKeyAssign(ord('B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN)
|
||||
self.CmdKeyAssign(ord('N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT)
|
||||
|
Loading…
Reference in New Issue
Block a user