updated wxMVCTree, VTK, and the demo
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -21,6 +21,8 @@ _useSplitter = true
|
||||
_useNestedSplitter = true
|
||||
|
||||
_treeList = [
|
||||
('New since last release', ['wxMVCTree', 'wxVTKRenderWindow']),
|
||||
|
||||
('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
|
||||
|
||||
('Non-Managed Windows', ['wxGrid', 'wxSashWindow',
|
||||
@@ -47,7 +49,7 @@ _treeList = [
|
||||
|
||||
('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog',
|
||||
'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar',
|
||||
'PyShell', 'wxCalendar']),
|
||||
'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow']),
|
||||
|
||||
('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),
|
||||
|
||||
|
61
utils/wxPython/demo/wxMVCTree.py
Normal file
61
utils/wxPython/demo/wxMVCTree.py
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
import sys, os
|
||||
from wxPython.wx import *
|
||||
from wxPython.lib.mvctree import *
|
||||
|
||||
|
||||
logger = None
|
||||
def selchanging(evt):
|
||||
logger.write("SelChanging!\n")
|
||||
|
||||
def selchanged(evt):
|
||||
logger.write("SelChange!\n")
|
||||
logger.write(str(evt.node))
|
||||
def expanded(evt):
|
||||
logger.write("Expanded\n")
|
||||
def closed(evt):
|
||||
logger.write("Closed!\n")
|
||||
def key(evt):
|
||||
logger.write("Key\n")
|
||||
def add(evt):
|
||||
logger.write("Add\n")
|
||||
def delitem(evt):
|
||||
logger.write("Delete\n")
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
#f = wxFrame(frame, -1, "wxMVCTree", wxPoint(0,0), wxSize(200,500))
|
||||
global logger
|
||||
logger = log
|
||||
p = wxMVCTree(nb, -1)
|
||||
p.SetAssumeChildren(true)
|
||||
p.SetModel(LateFSTreeModel(os.path.normpath(os.getcwd() + os.sep +'..')))
|
||||
#Uncomment this to enable live filename editing!
|
||||
# p.AddEditor(FileEditor(p))
|
||||
p.SetMultiSelect(true)
|
||||
EVT_MVCTREE_SEL_CHANGING(p, p.GetId(), selchanging)
|
||||
EVT_MVCTREE_SEL_CHANGED(p, p.GetId(), selchanged)
|
||||
EVT_MVCTREE_ITEM_EXPANDED(p, p.GetId(), expanded)
|
||||
EVT_MVCTREE_ITEM_COLLAPSED(p, p.GetId(), closed)
|
||||
EVT_MVCTREE_ADD_ITEM(p, p.GetId(), add)
|
||||
EVT_MVCTREE_DELETE_ITEM(p, p.GetId(), delitem)
|
||||
EVT_MVCTREE_KEY_DOWN(p, p.GetId(), key)
|
||||
return p
|
||||
|
||||
overview = """\
|
||||
wxMVCTree is a control which handles hierarchical data. It is constructed in model-view-controller architecture, so the display of that data, and the content of the data can be changed greatly without affecting the other parts.
|
||||
|
||||
Multiple selections are possible by holding down the Ctrl key.
|
||||
|
||||
This demo shows the wxPython directory structure. The interesting part is that the tree model is late-bound to the filesystem, so the filenames are not retrieved until the directory is expanded. In mvctree.py are models for generic data, and both the early and late-bound filesystem models.
|
||||
|
||||
There is also support for editing, though it's not enabled in this demo, to avoid accidentally renaming files!
|
||||
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
60
utils/wxPython/demo/wxVTKRenderWindow.py
Normal file
60
utils/wxPython/demo/wxVTKRenderWindow.py
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
from wxPython.wx import *
|
||||
try:
|
||||
from wxPython.lib import vtk
|
||||
haveVTK = true
|
||||
except ImportError:
|
||||
haveVTK = false
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
def runTest(frame, nb, log):
|
||||
if haveVTK:
|
||||
win = vtk.wxVTKRenderWindow(nb, -1)
|
||||
|
||||
# Get the render window
|
||||
renWin = win.GetRenderWindow()
|
||||
|
||||
# Next, do the VTK stuff
|
||||
ren = vtk.vtkRenderer()
|
||||
renWin.AddRenderer(ren)
|
||||
cone = vtk.vtkConeSource()
|
||||
cone.SetResolution(80)
|
||||
coneMapper = vtk.vtkPolyDataMapper()
|
||||
coneMapper.SetInput(cone.GetOutput())
|
||||
coneActor = vtk.vtkActor()
|
||||
coneActor.SetMapper(coneMapper)
|
||||
ren.AddActor(coneActor)
|
||||
coneMapper.GetLookupTable().Build()
|
||||
|
||||
# Create a scalar bar
|
||||
scalarBar = vtk.vtkScalarBarActor()
|
||||
scalarBar.SetLookupTable(coneMapper.GetLookupTable())
|
||||
scalarBar.SetTitle("Temperature")
|
||||
scalarBar.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport()
|
||||
scalarBar.GetPositionCoordinate().SetValue(0.1, 0.01)
|
||||
scalarBar.SetOrientationToHorizontal()
|
||||
scalarBar.SetWidth(0.8)
|
||||
scalarBar.SetHeight(0.17)
|
||||
ren.AddActor2D(scalarBar)
|
||||
|
||||
return win
|
||||
|
||||
|
||||
else:
|
||||
wxMessageBox("Unable to import VTK, which is a required component "
|
||||
"of this demo. You need to download and install the "
|
||||
"Python extension module for VTK from http://www.kitware.com/",
|
||||
"Import Error")
|
||||
return None
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
overview = """\
|
||||
wxVTKRenderWindow is a wrapper around the vtkRenderWindow from the
|
||||
VTK Visualization Toolkit. The VTK Python extensions are required,
|
||||
they can be obtained from http://www.kitware.com/ where you can also
|
||||
find some nifty pictures and stuff.
|
||||
|
||||
"""
|
Reference in New Issue
Block a user