Fix sample so it works correctly when NUmeric is not installed.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@23913 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,8 +1,30 @@
|
||||
#!/usr/bin/env python2.2
|
||||
|
||||
from wxPython.wx import *
|
||||
|
||||
|
||||
## Stuff to integrate FloatCanvas into wxPython Demo
|
||||
try:
|
||||
import Numeric
|
||||
haveNumeric = True
|
||||
except ImportError:
|
||||
haveNumeric = False
|
||||
|
||||
|
||||
if not haveNumeric:
|
||||
errorText = """\
|
||||
The FloatCanvas requires the Numeric module:
|
||||
You can get it at:
|
||||
http://sourceforge.net/projects/numpy
|
||||
"""
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wxMessageDialog(frame, errorText,
|
||||
'Sorry', wxOK | wxICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
overview = ""
|
||||
|
||||
else:
|
||||
def runTest(frame, nb, log):
|
||||
"""
|
||||
This method is used by the wxPython Demo Framework for integrating
|
||||
@@ -11,17 +33,10 @@ try:
|
||||
win = DrawFrame(NULL, -1, "FloatCanvas Drawing Window",wxDefaultPosition,wxSize(500,500))
|
||||
frame.otherWin = win
|
||||
win.Show(True)
|
||||
except ImportError:
|
||||
def runTest(frame, nb, log):
|
||||
dlg = wxMessageDialog(frame, ('The FloatCanvas requires the Numeric module:\n'
|
||||
'You can get it at:\n'
|
||||
'http://sourceforge.net/projects/numpy'),
|
||||
'Sorry', wxOK | wxICON_INFORMATION)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
|
||||
from wxPython.lib import floatcanvas
|
||||
from wxPython.wx import *
|
||||
import wxPython.lib.colourdb
|
||||
|
||||
ID_ABOUT_MENU = wxNewId()
|
||||
@@ -416,8 +431,12 @@ def Read_MapGen(filename,stats = 0,AllLines=0):
|
||||
overview = floatcanvas.FloatCanvas.__doc__
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not haveNumeric:
|
||||
print errorText
|
||||
else:
|
||||
app = DemoApp(0)
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user