]> SALOME platform Git repositories - modules/paravis.git/blob - src/PV_SWIG/servermanager.diff
Salome HOME
Merge from BR_PARAVIS_DEV 29Dec09
[modules/paravis.git] / src / PV_SWIG / servermanager.diff
1 29,55c29,35
2 < #==============================================================================
3 < #
4 < #  Program:   ParaView
5 < #  Module:    $RCSfile$
6 < #
7 < #  Copyright (c) Kitware, Inc.
8 < #  All rights reserved.
9 < #  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
10 < #
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.
14 < #
15 < #==============================================================================
16 < import paraview, re, os, new, sys, vtk
17
18 < if not paraview.compatibility.minor:
19 <     paraview.compatibility.major = 3
20 < if not paraview.compatibility.major:
21 <     paraview.compatibility.minor = 5
22
23 < if os.name == "posix":
24 <     from libvtkPVServerCommonPython import *
25 <     from libvtkPVServerManagerPython import *
26 < else:
27 <     from vtkPVServerCommonPython import *
28 <     from vtkPVServerManagerPython import *
29 ---
30
31
32
33 > import re, os, new, sys
34 > from paravis import *
35
36
37 63,64c43
38 <     if paraview.compatibility.GetVersion() >= 3.5 and \
39 <       smproperty.IsA("vtkSMStringVectorProperty"):
40 ---
41 >     if smproperty.IsA("vtkSMStringVectorProperty"):
42 66,67c45
43 <         if  al and al.IsA("vtkSMArraySelectionDomain") and \
44 <             smproperty.GetRepeatable():
45 ---
46 >         if  al and al.IsA("vtkSMArraySelectionDomain") and smproperty.GetRepeatable():
47 87,88c65
48 <         if smproperty.IsA("vtkSMIntVectorProperty") and \
49 <           smproperty.GetDomain("enum"):
50 ---
51 >         if smproperty.IsA("vtkSMIntVectorProperty") and smproperty.GetDomain("enum"):
52 237,238c214,216
53 <             return self.SMProxy == other.SMProxy
54 <         return self.SMProxy == other
55 ---
56 >             ## VSV using IsSame instead
57 >             return self.SMProxy.IsSame(other.SMProxy)
58 >         return self.SMProxy.IsSame(other)
59 333,336c311,314
60 <         if not c.HasObserver("ModifiedEvent"):
61 <             self.ObserverTag =c.AddObserver("ModifiedEvent", \
62 <                               _makeUpdateCameraMethod(weakref.ref(self)))
63 <             self.Observed = c
64 ---
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
69 439,457c417,434
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()
75
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)
81 <                 f.SelectAll()
82
83 <         def DeselectAllVariables(self):
84 <             "Deselects all variables."
85 <             for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables',
86 <                 'ElementVariables', 'GlobalVariables'):
87 <                 f = getattr(self, prop)
88 <                 f.DeselectAll()
89 ---
90 >     def FileNameChanged(self):
91 >         "Called when the filename changes. Selects all variables."
92 >         SourceProxy.FileNameChanged(self)
93 >         self.SelectAllVariables()
94
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)
100 >             f.SelectAll()
101
102 >     def DeselectAllVariables(self):
103 >         "Deselects all variables."
104 >         for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables',
105 >                      'ElementVariables', 'GlobalVariables'):
106 >             f = getattr(self, prop)
107 >             f.DeselectAll()
108 1040c1017,1018
109 <             if proxy == px:
110 ---
111 >             ## VSV: ==
112 >             if proxy.IsSame(px):
113 1217c1195
114 <         return vtk.vtkDataObjectTypes.GetClassNameFromTypeId(self.GetDataSetType())
115 ---
116 >         return vtkDataObjectTypes.GetClassNameFromTypeId(self.GetDataSetType())
117 1259,1261d1236
118 <     if paraview.compatibility.GetVersion() <= 3.4:
119 <        def Range(self, component=0):
120 <            return self.GetRange(component)
121 1521c1496
122 <         collection = vtk.vtkCollection()
123 ---
124 >         collection = vtkCollection()
125 1844c1819,1820
126 <     """Creates a new self connection.Internal method, use Connect() instead."""
127 ---
128 >     """Initialises self connection.Internal method, use Connect() instead."""
129 >     print "Connect to self"
130 1909c1885
131
132 ---
133 >        
134 2015c1991,1992
135 <         try: isRep = rep.Input == aProxy
136 ---
137 >         #VSV: ==
138 >         try: isRep = rep.Input.IsSame(aProxy)
139 2261c2238,2239
140 <     global progressObserverTag
141 ---
142 >     pass
143 >     #vsv global progressObserverTag
144 2263,2270c2241,2248
145 <     if fromGUI:
146 <         raise RuntimeError, "Printing progress in the GUI is not supported."
147 <     if progressObserverTag:
148 <         vtkProcessModule.GetProcessModule().RemoveObserver(progressObserverTag)
149 <         progressObserverTag = None
150 <     else:
151 <         progressObserverTag = vtkProcessModule.GetProcessModule().AddObserver(\
152 <              "ProgressEvent", _printProgress)
153 ---
154 >     #vsv if fromGUI:
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
160 >     #else:
161 >     #    progressObserverTag = vtkProcessModule.GetProcessModule().AddObserver("ProgressEvent", _printProgress)
162 2273,2278c2251,2256
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()
169 ---
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()
176 2293,2295c2271,2272
177 <     if paraview.compatibility.GetVersion() >= 3.5:
178 <         if smproxy.GetXMLLabel():
179 <             xmlName = smproxy.GetXMLLabel()
180 ---
181 >     if smproxy.GetXMLLabel():
182 >         xmlName = smproxy.GetXMLLabel()
183 2335,2338c2312
184 <         if paraview.compatibility.GetVersion() >= 3.5:
185 <             return self.GetPropertyValue(propName)
186 <         else:
187 <             return self.GetProperty(propName)
188 ---
189 >         return self.GetPropertyValue(propName)
190 2447c2421,2432
191 <     return paraview.make_name_valid(name)
192 ---
193 >     "Make a string into a valid Python variable name"
194 >     if not name:
195 >         return None
196 >     if name.find('(') >= 0 or name.find(')') >=0:
197 >         return None
198 >     name = name.replace(' ','')
199 >     name = name.replace('-','')
200 >     name = name.replace(':','')
201 >     name = name.replace('.','')
202 >     if not name[0].isalpha():
203 >         name = 'a' + name
204 >     return name
205 2465,2469c2450,2451
206 <         if paraview.compatibility.GetVersion() >= 3.5:
207 <             if proto.GetXMLLabel():
208 <                 pname = proto.GetXMLLabel()
209 <         else:
210 <             pname = proxyName
211 ---
212 >         if proto.GetXMLLabel():
213 >             pname = proto.GetXMLLabel()
214 2483,2486c2465,2466
215 <             if paraview.compatibility.GetVersion() >= 3.5:
216 <                 if (prop.GetInformationOnly() and propName != "TimestepValues" ) \
217 <                   or prop.GetIsInternal():
218 <                     continue
219 ---
220 >             if (prop.GetInformationOnly() and propName != "TimestepValues" ) or prop.GetIsInternal():
221 >                 continue
222 2488,2489c2468
223 <             if paraview.compatibility.GetVersion() >= 3.5:
224 <                 names = [iter.PropertyLabel]
225 ---
226 >             names = [iter.PropertyLabel]
227 2502,2503c2481
228 <         if proto.GetDocumentation() and \
229 <            proto.GetDocumentation().GetDescription():
230 ---
231 >         if proto.GetDocumentation() and proto.GetDocumentation().GetDescription():
232 2505,2506c2483,2484
233 <         else:
234 <             doc = Proxy.__doc__
235 ---
236 >         #else:
237 >         doc = Proxy.__doc__
238 2616,2625c2594,2597
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()
244 <     else:
245 <         ss = sources.Sphere(Radius=2, ThetaResolution=32)
246 <         shr = filters.Shrink(Input=OutputPort(ss,0))
247 <         cs = sources.Cone()
248 <         app = filters.AppendDatasets()
249 ---
250 >     ss = sources.Sphere(Radius=2, ThetaResolution=32)
251 >     shr = filters.Shrink(Input=OutputPort(ss,0))
252 >     cs = sources.Cone()
253 >     app = filters.AppendDatasets()
254 2646,2649c2618
255 <     if paraview.compatibility.GetVersion() <= 3.4:
256 <         arraySelection = reader.PointResultArrayStatus
257 <     else:
258 <         arraySelection = reader.PointVariables
259 ---
260 >     arraySelection = reader.PointVariables
261 2683,2686c2652
262 <             if paraview.compatibility.GetVersion() <= 3.4:
263 <                 print "Range:", ai.Range(j)
264 <             else:
265 <                 print "Range:", ai.GetRange(j)
266 ---
267 >             print "Range:", ai.GetRange(j)
268 2717,2720c2683
269 <     if paraview.compatibility.GetVersion() <= 3.4:
270 <         source = sources.RTAnalyticSource()
271 <     else:
272 <         source = sources.Wavelet()
273 ---
274 >     source = sources.Wavelet()
275 2751,2758c2714,2716
276 <     if paraview.compatibility.GetVersion() <= 3.4:
277 <         probe = filters.Probe(Input=source)
278 <         # with a line
279 <         line = sources.LineSource(Resolution=60)
280 <     else:
281 <         probe = filters.ResampleWithDataset(Input=source)
282 <         # with a line
283 <         line = sources.Line(Resolution=60)
284 ---
285 >     probe = filters.ResampleWithDataset(Input=source)
286 >     # with a line
287 >     line = sources.Line(Resolution=60)
288 2802,2805c2760
289 <     if paraview.compatibility.GetVersion() <= 3.4:
290 <         sphere = sources.SphereSource()
291 <     else:
292 <         sphere = sources.Sphere()
293 ---
294 >     sphere = sources.Sphere()
295 2871a2827,2833
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()
301 > fromGUI = True
302
303 2872a2835
304