There is no way to have a Python script as-is in an XML file. The XML parsers can't handle it. However, you can have your script import a module, which is stored as a py file. I believe Ken Moreland from Sandia implemented support for adding modules to plugins.
As for displaying only the tunable parameters of a Python filter, this is not yet implemented but it is planned. Custom filters or plugins will allow the developer to specify a list of parameters for the programmable filter. Hopefully in 3.8. You can do this currently but you have to create a plugin with a custom inspector panel. -berk On Fri, May 29, 2009 at 8:39 AM, David Doria <[email protected]> wrote: > I am looking at the HelixSource xml example. With something like this: > <StringVectorProperty > name="NumberOfRounds" > command="SetParameter" > number_of_elements="2" > default_values_delimiter=";" > default_values="rounds;3"> > </StringVectorProperty> > > It is displaying a label with a description of the property, a textbox with > the name of the property, and another textbox with the value of the > property. Is there anyway to skip the textbox with the name of the property > (because it doesn't really make sense for the user to change this - so why > allow it?) > > Also, the script itself seems to be set like this: > <StringVectorProperty > name="Script" > command="SetScript" > number_of_elements="1" > default_values="import math;
pdo = > self.GetPolyDataOutput()

newPts = vtk.vtkPoints()
for i in > range(0, numPts):
 x = i*float(length)/float(numPts)
 y = > math.sin(i*rounds*2*math.pi/numPts)
 z = > math.cos(i*rounds*2*math.pi/numPts)
 newPts.InsertPoint(i, > x,y,z)

pdo.SetPoints(newPts)
aPolyLine = > vtk.vtkPolyLine()

aPolyLine.GetPointIds().SetNumberOfIds(numPts)
for > i in range(0,numPts):
 aPolyLine.GetPointIds().SetId(i, > i)

pdo.Allocate(1, > 1)
pdo.InsertNextCell(aPolyLine.GetCellType(), > aPolyLine.GetPointIds())
"> > </StringVectorProperty> > > That is a pretty cryptic way to have to write code - is there a way to take > a normal looking script: > import math > pdo = self.GetPolyDataOutput() > newPts = vtk.vtkPoints() > etc. > > and point the xml to it - so you can edit the script in a .py file and the > xml just points to that file? This also kind of stems from the first > question - but I also would like to NOT display the script in the GUI - only > the tunable parameters - is that possible? > > Thanks, > > David > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the ParaView Wiki at: > http://paraview.org/Wiki/ParaView > > Follow this link to subscribe/unsubscribe: > http://www.paraview.org/mailman/listinfo/paraview > > _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
