]> SALOME platform Git repositories - modules/paravis.git/blob - src/PV_SWIG/servermanager.diff
Salome HOME
Merge from BR_PARAVIS_LOT1_2 24/02/2010
[modules/paravis.git] / src / PV_SWIG / servermanager.diff
1 29,55c29,35
2 < #==============================================================================
3 < #
4 < #  Program:   ParaView
5 < #  Module:    $RCSfile: servermanager.diff,v $
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 1909c1884
126
127 ---
128 >        
129 2020c1995,1996
130 <         try: isRep = rep.Input == aProxy
131 ---
132 >         #VSV: ==
133 >         try: isRep = rep.Input.IsSame(aProxy)
134 2265,2281c2241,2242
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
140
141 <     # If value is true and progress printing is currently off...
142 <     if value and not GetProgressPrintingIsEnabled():
143 <         if fromGUI:
144 <             raise RuntimeError("Printing progress in the GUI is not supported.")
145 <         progressObserverTag = vtkProcessModule.GetProcessModule().AddObserver(\
146 <             "ProgressEvent", _printProgress)
147
148 <     # If value is false and progress printing is currently on...
149 <     elif GetProgressPrintingIsEnabled():
150 <         vtkProcessModule.GetProcessModule().RemoveObserver(progressObserverTag)
151 <         progressObserverTag = None
152 ---
153 >     """Is not supported because of not supported observers"""
154 >     pass
155 2308,2310c2269,2270
156 <     if paraview.compatibility.GetVersion() >= 3.5:
157 <         if smproxy.GetXMLLabel():
158 <             xmlName = smproxy.GetXMLLabel()
159 ---
160 >     if smproxy.GetXMLLabel():
161 >         xmlName = smproxy.GetXMLLabel()
162 2350,2353c2310
163 <         if paraview.compatibility.GetVersion() >= 3.5:
164 <             return self.GetPropertyValue(propName)
165 <         else:
166 <             return self.GetProperty(propName)
167 ---
168 >         return self.GetPropertyValue(propName)
169 2471c2428,2437
170 <     return paraview.make_name_valid(name)
171 ---
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:
175 >         return None
176 >     import string
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():
180 >         name = 'a' + name
181 >     return name
182 2490,2491c2456
183 <         if paraview.compatibility.GetVersion() >= 3.5 and\
184 <            proto.GetXMLLabel():
185 ---
186 >         if proto.GetXMLLabel():
187 2506,2509c2471,2472
188 <             if paraview.compatibility.GetVersion() >= 3.5:
189 <                 if (prop.GetInformationOnly() and propName != "TimestepValues" ) \
190 <                   or prop.GetIsInternal():
191 <                     continue
192 ---
193 >             if (prop.GetInformationOnly() and propName != "TimestepValues" ) or prop.GetIsInternal():
194 >                 continue
195 2511,2512c2474
196 <             if paraview.compatibility.GetVersion() >= 3.5:
197 <                 names = [iter.PropertyLabel]
198 ---
199 >             names = [iter.PropertyLabel]
200 2641,2650c2603,2606
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()
206 <     else:
207 <         ss = sources.Sphere(Radius=2, ThetaResolution=32)
208 <         shr = filters.Shrink(Input=OutputPort(ss,0))
209 <         cs = sources.Cone()
210 <         app = filters.AppendDatasets()
211 ---
212 >     ss = sources.Sphere(Radius=2, ThetaResolution=32)
213 >     shr = filters.Shrink(Input=OutputPort(ss,0))
214 >     cs = sources.Cone()
215 >     app = filters.AppendDatasets()
216 2671,2674c2627
217 <     if paraview.compatibility.GetVersion() <= 3.4:
218 <         arraySelection = reader.PointResultArrayStatus
219 <     else:
220 <         arraySelection = reader.PointVariables
221 ---
222 >     arraySelection = reader.PointVariables
223 2708,2711c2661
224 <             if paraview.compatibility.GetVersion() <= 3.4:
225 <                 print "Range:", ai.Range(j)
226 <             else:
227 <                 print "Range:", ai.GetRange(j)
228 ---
229 >             print "Range:", ai.GetRange(j)
230 2742,2745c2692
231 <     if paraview.compatibility.GetVersion() <= 3.4:
232 <         source = sources.RTAnalyticSource()
233 <     else:
234 <         source = sources.Wavelet()
235 ---
236 >     source = sources.Wavelet()
237 2776,2783c2723,2725
238 <     if paraview.compatibility.GetVersion() <= 3.4:
239 <         probe = filters.Probe(Input=source)
240 <         # with a line
241 <         line = sources.LineSource(Resolution=60)
242 <     else:
243 <         probe = filters.ResampleWithDataset(Input=source)
244 <         # with a line
245 <         line = sources.Line(Resolution=60)
246 ---
247 >     probe = filters.ResampleWithDataset(Input=source)
248 >     # with a line
249 >     line = sources.Line(Resolution=60)
250 2827,2830c2769
251 <     if paraview.compatibility.GetVersion() <= 3.4:
252 <         sphere = sources.SphereSource()
253 <     else:
254 <         sphere = sources.Sphere()
255 ---
256 >     sphere = sources.Sphere()
257 2897,2899c2836,2844
258 < if hasattr(sys, "ps1"):
259 <     # session is interactive.
260 <     print vtkSMProxyManager.GetParaViewSourceVersion();
261 ---
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()
267 > fromGUI = True
268
269 > print vtkSMProxyManager.GetParaViewSourceVersion();
270