Salome HOME
Merge branch 'V7_5_BR'
[modules/paravis.git] / src / PV_SWIG / servermanager.diff
1 0a1,19
2 > # Copyright (C) 2010-2014  CEA/DEN, EDF R&D
3 > #
4 > # This library is free software; you can redistribute it and/or
5 > # modify it under the terms of the GNU Lesser General Public
6 > # License as published by the Free Software Foundation; either
7 > # version 2.1 of the License, or (at your option) any later version.
8 > #
9 > # This library is distributed in the hope that it will be useful,
10 > # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 > # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 > # Lesser General Public License for more details.
13 > #
14 > # You should have received a copy of the GNU Lesser General Public
15 > # License along with this library; if not, write to the Free Software
16 > # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 > #
18 > # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 > #
20
21 29,43d47
22 < #==============================================================================
23 < #
24 < #  Program:   ParaView
25 < #  Module:    servermanager.py
26 < #
27 < #  Copyright (c) Kitware, Inc.
28 < #  All rights reserved.
29 < #  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
30 < #
31 < #     This software is distributed WITHOUT ANY WARRANTY without even
32 < #     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
33 < #     PURPOSE.  See the above copyright notice for more information.
34 < #
35 < #==============================================================================
36 < import paraview, re, os, os.path, new, sys, vtk
37 45,53c49,54
38 < if not paraview.compatibility.minor:
39 <     paraview.compatibility.major = 3
40 < if not paraview.compatibility.major:
41 <     paraview.compatibility.minor = 5
42
43 < from vtkPVClientServerCorePython import *
44 < from vtkPVServerImplementationPython import *
45 < from vtkPVServerManagerPython import *
46 < from vtkPVCommonPython import *
47 ---
48
49
50 > import re, os, new, sys
51 > from paravis import *
52
53
54 61,62c62
55 <     if paraview.compatibility.GetVersion() >= 3.5 and \
56 <       smproperty.IsA("vtkSMStringVectorProperty"):
57 ---
58 >     if smproperty.IsA("vtkSMStringVectorProperty"):
59 251,252c251,253
60 <             return self.SMProxy == other.SMProxy
61 <         return self.SMProxy == other
62 ---
63 >             ## VSV using IsSame instead ==
64 >             return self.SMProxy.IsSame(other.SMProxy)
65 >         return self.SMProxy.IsSame(other)
66 347,350c348,351
67 <         if not c.HasObserver("ModifiedEvent"):
68 <             self.ObserverTag =c.AddObserver("ModifiedEvent", \
69 <                               _makeUpdateCameraMethod(weakref.ref(self)))
70 <             self.Observed = c
71 ---
72 >         # VSV: Observers are not supported
73 > ##         if not c.HasObserver("ModifiedEvent"):
74 > ##             self.ObserverTag =c.AddObserver("ModifiedEvent", _makeUpdateCameraMethod(weakref.ref(self)))
75 > ##             self.Observed = c
76 454,472c455,472
77 <     if paraview.compatibility.GetVersion() >= 3.5:
78 <         def FileNameChanged(self):
79 <             "Called when the filename changes. Selects all variables."
80 <             SourceProxy.FileNameChanged(self)
81 <             self.SelectAllVariables()
82
83 <         def SelectAllVariables(self):
84 <             "Select all available variables for reading."
85 <             for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables',
86 <                 'ElementVariables', 'GlobalVariables'):
87 <                 f = getattr(self, prop)
88 <                 f.SelectAll()
89
90 <         def DeselectAllVariables(self):
91 <             "Deselects all variables."
92 <             for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables',
93 <                 'ElementVariables', 'GlobalVariables'):
94 <                 f = getattr(self, prop)
95 <                 f.DeselectAll()
96 ---
97 >     def FileNameChanged(self):
98 >         "Called when the filename changes. Selects all variables."
99 >         SourceProxy.FileNameChanged(self)
100 >         self.SelectAllVariables()
101
102 >     def SelectAllVariables(self):
103 >         "Select all available variables for reading."
104 >         for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables',
105 >                      'ElementVariables', 'GlobalVariables'):
106 >             f = getattr(self, prop)
107 >             f.SelectAll()
108
109 >     def DeselectAllVariables(self):
110 >         "Deselects all variables."
111 >         for prop in ('PointVariables', 'EdgeVariables', 'FaceVariables',
112 >                      'ElementVariables', 'GlobalVariables'):
113 >             f = getattr(self, prop)
114 >             f.DeselectAll()
115 1110c1110,1111
116 <             if proxy == px:
117 ---
118 >             ## VSV: ==
119 >             if proxy.IsSame(px):
120 1329,1332d1329
121 <     if paraview.compatibility.GetVersion() <= 3.4:
122 <        def Range(self, component=0):
123 <            return self.GetRange(component)
124
125 1526c1523
126 <         aProxy = self.SMProxyManager.NewProxy(group, name)
127 ---
128 >         aProxy = self.SMProxyManager.NewProxy(group, name, "NULL")
129 1838a1836
130 >         # VTN: Observers are not supported
131 1840c1838
132 <         self.DefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2000, _update_definitions)
133 ---
134 > ##        self.DefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2000, _update_definitions)
135 1842c1840
136 <         self.CustomDefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2001, _update_definitions)
137 ---
138 > ##        self.CustomDefinitionObserverTag = self.Session.GetProxyDefinitionManager().AddObserver(2001, _update_definitions)
139 2056c2054,2055
140 <         try: isRep = rep.Input == aProxy
141 ---
142 >         #VSV: ==
143 >         try: isRep = rep.Input.IsSame(aProxy)
144 2287,2303c2286,2287
145 <     """Turn on/off printing of progress (by default, it is on). You can
146 <     always turn progress off and add your own observer to the process
147 <     module to handle progress in a custom way. See _printProgress for
148 <     an example event observer."""
149 <     global progressObserverTag
150
151 <     # If value is true and progress printing is currently off...
152 <     if value and not GetProgressPrintingIsEnabled():
153 <         if fromGUI:
154 <             raise RuntimeError("Printing progress in the GUI is not supported.")
155 <         progressObserverTag = vtkProcessModule.GetProcessModule().AddObserver(\
156 <             "ProgressEvent", _printProgress)
157
158 <     # If value is false and progress printing is currently on...
159 <     elif GetProgressPrintingIsEnabled():
160 <         vtkProcessModule.GetProcessModule().RemoveObserver(progressObserverTag)
161 <         progressObserverTag = None
162 ---
163 >     """Is not supported because of not supported observers"""
164 >     pass
165 2330,2332c2314,2315
166 <     if paraview.compatibility.GetVersion() >= 3.5:
167 <         if smproxy.GetXMLLabel():
168 <             xmlName = smproxy.GetXMLLabel()
169 ---
170 >     if smproxy.GetXMLLabel():
171 >         xmlName = smproxy.GetXMLLabel()
172 2375,2378c2358
173 <         if paraview.compatibility.GetVersion() >= 3.5:
174 <             return self.GetPropertyValue(propName)
175 <         else:
176 <             return self.GetProperty(propName)
177 ---
178 >         return self.GetPropertyValue(propName)
179 2494c2474,2482
180 <     return paraview.make_name_valid(name)
181 ---
182 >     """Make a string into a valid Python variable name."""
183 >     if not name:
184 >         return None
185 >     import string
186 >     valid_chars = "_%s%s" % (string.ascii_letters, string.digits)
187 >     name = str().join([c for c in name if c in valid_chars])
188 >     if not name[0].isalpha():
189 >         name = 'a' + name
190 >     return name
191 2520,2521c2508
192 <         if paraview.compatibility.GetVersion() >= 3.5 and\
193 <            proto.GetXMLLabel():
194 ---
195 >         if proto.GetXMLLabel():
196 2536,2539c2523,2525
197 <             if paraview.compatibility.GetVersion() >= 3.5:
198 <                 if (prop.GetInformationOnly() and propName != "TimestepValues" ) \
199 <                   or prop.GetIsInternal():
200 <                     continue
201 ---
202 >             if (prop.GetInformationOnly() and propName != "TimestepValues" ) \
203 >                    or prop.GetIsInternal():
204 >                 continue
205 2541,2542c2527
206 <             if paraview.compatibility.GetVersion() >= 3.5:
207 <                 names = [iter.PropertyLabel]
208 ---
209 >             names = [iter.PropertyLabel]
210 2681,2690c2666,2669
211 <     if paraview.compatibility.GetVersion() <= 3.4:
212 <         ss = sources.SphereSource(Radius=2, ThetaResolution=32)
213 <         shr = filters.ShrinkFilter(Input=OutputPort(ss,0))
214 <         cs = sources.ConeSource()
215 <         app = filters.Append()
216 <     else:
217 <         ss = sources.Sphere(Radius=2, ThetaResolution=32)
218 <         shr = filters.Shrink(Input=OutputPort(ss,0))
219 <         cs = sources.Cone()
220 <         app = filters.AppendDatasets()
221 ---
222 >     ss = sources.Sphere(Radius=2, ThetaResolution=32)
223 >     shr = filters.Shrink(Input=OutputPort(ss,0))
224 >     cs = sources.Cone()
225 >     app = filters.AppendDatasets()
226 2711,2714c2690
227 <     if paraview.compatibility.GetVersion() <= 3.4:
228 <         arraySelection = reader.PointResultArrayStatus
229 <     else:
230 <         arraySelection = reader.PointVariables
231 ---
232 >     arraySelection = reader.PointVariables
233 2748,2751c2724
234 <             if paraview.compatibility.GetVersion() <= 3.4:
235 <                 print "Range:", ai.Range(j)
236 <             else:
237 <                 print "Range:", ai.GetRange(j)
238 ---
239 >             print "Range:", ai.GetRange(j)
240 2782,2785c2755
241 <     if paraview.compatibility.GetVersion() <= 3.4:
242 <         source = sources.RTAnalyticSource()
243 <     else:
244 <         source = sources.Wavelet()
245 ---
246 >     source = sources.Wavelet()
247 2816,2823c2786,2788
248 <     if paraview.compatibility.GetVersion() <= 3.4:
249 <         probe = filters.Probe(Input=source)
250 <         # with a line
251 <         line = sources.LineSource(Resolution=60)
252 <     else:
253 <         probe = filters.ResampleWithDataset(Input=source)
254 <         # with a line
255 <         line = sources.Line(Resolution=60)
256 ---
257 >     probe = filters.ResampleWithDataset(Input=source)
258 >     # with a line
259 >     line = sources.Line(Resolution=60)
260 2867,2870c2832
261 <     if paraview.compatibility.GetVersion() <= 3.4:
262 <         sphere = sources.SphereSource()
263 <     else:
264 <         sphere = sources.Sphere()
265 ---
266 >     sphere = sources.Sphere()
267 2960,2965c2922,2927
268 <     pvoptions = None
269 <     if paraview.options.batch:
270 <       pvoptions = vtkPVOptions();
271 <       pvoptions.SetProcessType(0x40)
272 <       if paraview.options.symmetric:
273 <         pvoptions.SetSymmetricMPIMode(True)
274 ---
275 > #    pvoptions = None Not applicable for SALOME Python console
276 > #    if paraview.options.batch:
277 > #      pvoptions = vtkPVOptions();
278 > #      pvoptions.SetProcessType(0x40)
279 > #      if paraview.options.symmetric:
280 > #        pvoptions.SetSymmetricMPIMode(True)
281 2994,2995c2956,2957
282
283 <     if not paraview.fromFilter:
284 ---
285 >     ## VSV fromFilter is alwais False for SALOME because it can't be changed from ParaView code
286 >     #if not paraview.fromFilter:
287 2998,2999c2960,2963
288 <         connection.AttachDefinitionUpdater()
289 <         pass
290 ---
291 > #    global _defUpdater
292 > #    _defUpdater = __DefinitionUpdater()
293 >     connection.AttachDefinitionUpdater()
294 >     pass
295 3008a2973,2982
296 > # Definitions for working in SALOME GUI mode
297 > #aParams = myParavis.GetConnectionParameters()
298 > #ActiveConnection = Connect()
299 > ##Connection(aParams[0])
300 > #ActiveConnection.SetHost(aParams[1], aParams[2], aParams[3], aParams[4], aParams[5])
301 > #ToggleProgressPrinting()
302 > #fromGUI = True
303
304 > InitFromGUI()
305