2 < #==============================================================================
5 < # Module: $RCSfile: servermanager.diff,v $
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()
130 < try: isRep = rep.Input == aProxy
133 > try: isRep = rep.Input.IsSame(aProxy)
135 < """Turn on/off printing of progress (by default, it is on). You can
136 < always turn progress off and add your own observer to the process
137 < module to handle progress in a custom way. See _printProgress for
138 < an example event observer."""
139 < global progressObserverTag
141 < # If value is true and progress printing is currently off...
142 < if value and not GetProgressPrintingIsEnabled():
144 < raise RuntimeError("Printing progress in the GUI is not supported.")
145 < progressObserverTag = vtkProcessModule.GetProcessModule().AddObserver(\
146 < "ProgressEvent", _printProgress)
148 < # If value is false and progress printing is currently on...
149 < elif GetProgressPrintingIsEnabled():
150 < vtkProcessModule.GetProcessModule().RemoveObserver(progressObserverTag)
151 < progressObserverTag = None
153 > """Is not supported because of not supported observers"""
156 < if paraview.compatibility.GetVersion() >= 3.5:
157 < if smproxy.GetXMLLabel():
158 < xmlName = smproxy.GetXMLLabel()
160 > if smproxy.GetXMLLabel():
161 > xmlName = smproxy.GetXMLLabel()
163 < if paraview.compatibility.GetVersion() >= 3.5:
164 < return self.GetPropertyValue(propName)
166 < return self.GetProperty(propName)
168 > return self.GetPropertyValue(propName)
170 < return paraview.make_name_valid(name)
172 > """Make a string into a valid Python variable name. Return None if
173 > the name contains parentheses."""
174 > if not name or '(' in name or ')' in name:
177 > valid_chars = "_%s%s" % (string.ascii_letters, string.digits)
178 > name = str().join([c for c in name if c in valid_chars])
179 > if not name[0].isalpha():
183 < if paraview.compatibility.GetVersion() >= 3.5 and\
184 < proto.GetXMLLabel():
186 > if proto.GetXMLLabel():
188 < if paraview.compatibility.GetVersion() >= 3.5:
189 < if (prop.GetInformationOnly() and propName != "TimestepValues" ) \
190 < or prop.GetIsInternal():
193 > if (prop.GetInformationOnly() and propName != "TimestepValues" ) or prop.GetIsInternal():
196 < if paraview.compatibility.GetVersion() >= 3.5:
197 < names = [iter.PropertyLabel]
199 > names = [iter.PropertyLabel]
201 < if paraview.compatibility.GetVersion() <= 3.4:
202 < ss = sources.SphereSource(Radius=2, ThetaResolution=32)
203 < shr = filters.ShrinkFilter(Input=OutputPort(ss,0))
204 < cs = sources.ConeSource()
205 < app = filters.Append()
207 < ss = sources.Sphere(Radius=2, ThetaResolution=32)
208 < shr = filters.Shrink(Input=OutputPort(ss,0))
209 < cs = sources.Cone()
210 < app = filters.AppendDatasets()
212 > ss = sources.Sphere(Radius=2, ThetaResolution=32)
213 > shr = filters.Shrink(Input=OutputPort(ss,0))
214 > cs = sources.Cone()
215 > app = filters.AppendDatasets()
217 < if paraview.compatibility.GetVersion() <= 3.4:
218 < arraySelection = reader.PointResultArrayStatus
220 < arraySelection = reader.PointVariables
222 > arraySelection = reader.PointVariables
224 < if paraview.compatibility.GetVersion() <= 3.4:
225 < print "Range:", ai.Range(j)
227 < print "Range:", ai.GetRange(j)
229 > print "Range:", ai.GetRange(j)
231 < if paraview.compatibility.GetVersion() <= 3.4:
232 < source = sources.RTAnalyticSource()
234 < source = sources.Wavelet()
236 > source = sources.Wavelet()
238 < if paraview.compatibility.GetVersion() <= 3.4:
239 < probe = filters.Probe(Input=source)
241 < line = sources.LineSource(Resolution=60)
243 < probe = filters.ResampleWithDataset(Input=source)
245 < line = sources.Line(Resolution=60)
247 > probe = filters.ResampleWithDataset(Input=source)
249 > line = sources.Line(Resolution=60)
251 < if paraview.compatibility.GetVersion() <= 3.4:
252 < sphere = sources.SphereSource()
254 < sphere = sources.Sphere()
256 > sphere = sources.Sphere()
258 < if hasattr(sys, "ps1"):
259 < # session is interactive.
260 < print vtkSMProxyManager.GetParaViewSourceVersion();
262 > # Definitions for working in SALOME GUI mode
263 > aParams = myParavis.GetConnectionParameters()
264 > ActiveConnection = Connection(aParams[0])
265 > ActiveConnection.SetHost(aParams[1], aParams[2], aParams[3], aParams[4], aParams[5])
266 > ToggleProgressPrinting()
269 > print vtkSMProxyManager.GetParaViewSourceVersion();