2 < #==============================================================================
7 < # Copyright (c) Kitware, Inc.
8 < # All rights reserved.
9 < # See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
11 < # This software is distributed WITHOUT ANY WARRANTY without even
12 < # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 < # PURPOSE. See the above copyright notice for more information.
15 < #==============================================================================
16 < import paraview, re, os, new, sys, vtk
18 < if not paraview.compatibility.minor:
19 < paraview.compatibility.major = 3
20 < if not paraview.compatibility.major:
21 < paraview.compatibility.minor = 5
23 < if os.name == "posix":
24 < from libvtkPVServerCommonPython import *
25 < from libvtkPVServerManagerPython import *
27 < from vtkPVServerCommonPython import *
28 < from vtkPVServerManagerPython import *
33 > import re, os, new, sys
34 > from paravis import *
38 < if paraview.compatibility.GetVersion() >= 3.5 and \
39 < smproperty.IsA("vtkSMStringVectorProperty"):
41 > if smproperty.IsA("vtkSMStringVectorProperty"):
43 < if al and al.IsA("vtkSMArraySelectionDomain") and \
44 < smproperty.GetRepeatable():
46 > if al and al.IsA("vtkSMArraySelectionDomain") and smproperty.GetRepeatable():
48 < if smproperty.IsA("vtkSMIntVectorProperty") and \
49 < smproperty.GetDomain("enum"):
51 > if smproperty.IsA("vtkSMIntVectorProperty") and smproperty.GetDomain("enum"):
53 < return self.SMProxy == other.SMProxy
54 < return self.SMProxy == other
56 > ## VSV using IsSame instead
57 > return self.SMProxy.IsSame(other.SMProxy)
58 > return self.SMProxy.IsSame(other)
60 < if not c.HasObserver("ModifiedEvent"):
61 < self.ObserverTag =c.AddObserver("ModifiedEvent", \
62 < _makeUpdateCameraMethod(weakref.ref(self)))
65 > # VSV: Observers are not supported
66 > ## if not c.HasObserver("ModifiedEvent"):
67 > ## self.ObserverTag =c.AddObserver("ModifiedEvent", _makeUpdateCameraMethod(weakref.ref(self)))
68 > ## self.Observed = c
70 < if paraview.compatibility.GetVersion() >= 3.5:
71 < def FileNameChanged(self):
72 < "Called when the filename changes. Selects all variables."
73 < SourceProxy.FileNameChanged(self)
74 < self.SelectAllVariables()
76 < def SelectAllVariables(self):
77 < "Select all available variables for reading."
78 < for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables',
79 < 'ElementVariables', 'GlobalVariables'):
80 < f = getattr(self, prop)
83 < def DeselectAllVariables(self):
84 < "Deselects all variables."
85 < for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables',
86 < 'ElementVariables', 'GlobalVariables'):
87 < f = getattr(self, prop)
90 > def FileNameChanged(self):
91 > "Called when the filename changes. Selects all variables."
92 > SourceProxy.FileNameChanged(self)
93 > self.SelectAllVariables()
95 > def SelectAllVariables(self):
96 > "Select all available variables for reading."
97 > for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables',
98 > 'ElementVariables', 'GlobalVariables'):
99 > f = getattr(self, prop)
102 > def DeselectAllVariables(self):
103 > "Deselects all variables."
104 > for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables',
105 > 'ElementVariables', 'GlobalVariables'):
106 > f = getattr(self, prop)
112 > if proxy.IsSame(px):
114 < return vtk.vtkDataObjectTypes.GetClassNameFromTypeId(self.GetDataSetType())
116 > return vtkDataObjectTypes.GetClassNameFromTypeId(self.GetDataSetType())
118 < if paraview.compatibility.GetVersion() <= 3.4:
119 < def Range(self, component=0):
120 < return self.GetRange(component)
122 < collection = vtk.vtkCollection()
124 > collection = vtkCollection()
126 < """Creates a new self connection.Internal method, use Connect() instead."""
128 > """Initialises self connection.Internal method, use Connect() instead."""
129 > print "Connect to self"
135 < try: isRep = rep.Input == aProxy
138 > try: isRep = rep.Input.IsSame(aProxy)
140 < global progressObserverTag
143 > #vsv global progressObserverTag
146 < raise RuntimeError, "Printing progress in the GUI is not supported."
147 < if progressObserverTag:
148 < vtkProcessModule.GetProcessModule().RemoveObserver(progressObserverTag)
149 < progressObserverTag = None
151 < progressObserverTag = vtkProcessModule.GetProcessModule().AddObserver(\
152 < "ProgressEvent", _printProgress)
155 > #vsv raise RuntimeError, "Printing progress in the GUI is not supported."
156 > #vsv if progressObserverTag:
157 > #vsv vtkProcessModule.GetProcessModule().RemoveObserver(progressObserverTag)
158 > #vsv progressObserverTag = None
159 > #VSV Observer is not supported
161 > # progressObserverTag = vtkProcessModule.GetProcessModule().AddObserver("ProgressEvent", _printProgress)
163 < """Although not required, this can be called at exit to cleanup."""
164 < global progressObserverTag
165 < # Make sure to remove the observer
166 < if progressObserverTag:
167 < ToggleProgressPrinting()
168 < vtkInitializationHelper.Finalize()
170 > """Although not required, this can be called at exit to cleanup."""
171 > global progressObserverTag
172 > # Make sure to remove the observer
173 > if progressObserverTag:
174 > ToggleProgressPrinting()
175 > vtkInitializationHelper.Finalize()
177 < if paraview.compatibility.GetVersion() >= 3.5:
178 < if smproxy.GetXMLLabel():
179 < xmlName = smproxy.GetXMLLabel()
181 > if smproxy.GetXMLLabel():
182 > xmlName = smproxy.GetXMLLabel()
184 < if paraview.compatibility.GetVersion() >= 3.5:
185 < return self.GetPropertyValue(propName)
187 < return self.GetProperty(propName)
189 > return self.GetPropertyValue(propName)
191 < return paraview.make_name_valid(name)
193 > "Make a string into a valid Python variable name"
196 > if name.find('(') >= 0 or name.find(')') >=0:
198 > name = name.replace(' ','')
199 > name = name.replace('-','')
200 > name = name.replace(':','')
201 > name = name.replace('.','')
202 > if not name[0].isalpha():
206 < if paraview.compatibility.GetVersion() >= 3.5:
207 < if proto.GetXMLLabel():
208 < pname = proto.GetXMLLabel()
212 > if proto.GetXMLLabel():
213 > pname = proto.GetXMLLabel()
215 < if paraview.compatibility.GetVersion() >= 3.5:
216 < if (prop.GetInformationOnly() and propName != "TimestepValues" ) \
217 < or prop.GetIsInternal():
220 > if (prop.GetInformationOnly() and propName != "TimestepValues" ) or prop.GetIsInternal():
223 < if paraview.compatibility.GetVersion() >= 3.5:
224 < names = [iter.PropertyLabel]
226 > names = [iter.PropertyLabel]
228 < if proto.GetDocumentation() and \
229 < proto.GetDocumentation().GetDescription():
231 > if proto.GetDocumentation() and proto.GetDocumentation().GetDescription():
234 < doc = Proxy.__doc__
237 > doc = Proxy.__doc__
239 < if paraview.compatibility.GetVersion() <= 3.4:
240 < ss = sources.SphereSource(Radius=2, ThetaResolution=32)
241 < shr = filters.ShrinkFilter(Input=OutputPort(ss,0))
242 < cs = sources.ConeSource()
243 < app = filters.Append()
245 < ss = sources.Sphere(Radius=2, ThetaResolution=32)
246 < shr = filters.Shrink(Input=OutputPort(ss,0))
247 < cs = sources.Cone()
248 < app = filters.AppendDatasets()
250 > ss = sources.Sphere(Radius=2, ThetaResolution=32)
251 > shr = filters.Shrink(Input=OutputPort(ss,0))
252 > cs = sources.Cone()
253 > app = filters.AppendDatasets()
255 < if paraview.compatibility.GetVersion() <= 3.4:
256 < arraySelection = reader.PointResultArrayStatus
258 < arraySelection = reader.PointVariables
260 > arraySelection = reader.PointVariables
262 < if paraview.compatibility.GetVersion() <= 3.4:
263 < print "Range:", ai.Range(j)
265 < print "Range:", ai.GetRange(j)
267 > print "Range:", ai.GetRange(j)
269 < if paraview.compatibility.GetVersion() <= 3.4:
270 < source = sources.RTAnalyticSource()
272 < source = sources.Wavelet()
274 > source = sources.Wavelet()
276 < if paraview.compatibility.GetVersion() <= 3.4:
277 < probe = filters.Probe(Input=source)
279 < line = sources.LineSource(Resolution=60)
281 < probe = filters.ResampleWithDataset(Input=source)
283 < line = sources.Line(Resolution=60)
285 > probe = filters.ResampleWithDataset(Input=source)
287 > line = sources.Line(Resolution=60)
289 < if paraview.compatibility.GetVersion() <= 3.4:
290 < sphere = sources.SphereSource()
292 < sphere = sources.Sphere()
294 > sphere = sources.Sphere()
296 > # Definitions for working in SALOME GUI mode
297 > aParams = myParavis.GetConnectionParameters()
298 > ActiveConnection = Connection(aParams[0])
299 > ActiveConnection.SetHost(aParams[1], aParams[2], aParams[3], aParams[4], aParams[5])
300 > ToggleProgressPrinting()