diff --git a/Adaptors/Python/cp_pythonadaptorscript.py b/Adaptors/Python/cp_pythonadaptorscript.py index 0f021d745c2..71086cdf9cd 100644 --- a/Adaptors/Python/cp_pythonadaptorscript.py +++ b/Adaptors/Python/cp_pythonadaptorscript.py @@ -45,7 +45,7 @@ def DoCoProcessing(datadescription): for view in range(len(renderviews)): fname = imagefilename.replace("%v", str(view)) fname = fname.replace("%t", str(timestep)) - WriteImage(fname, renderviews[view]) + SaveScreenshot(fname, renderviews[view]) # explicitly delete the proxies -- we do it this way to avoid problems with prototypes tobedeleted = GetProxiesToDelete() diff --git a/Clients/ParaView/Testing/Python/StructuredGridVolumeRendering.py b/Clients/ParaView/Testing/Python/StructuredGridVolumeRendering.py index bbdc61643d2..3f204e52f1a 100644 --- a/Clients/ParaView/Testing/Python/StructuredGridVolumeRendering.py +++ b/Clients/ParaView/Testing/Python/StructuredGridVolumeRendering.py @@ -32,7 +32,7 @@ SetActiveView(view) Render() imageFile = os.path.splitext(os.path.basename(smtesting.StateXMLFileName))[0] - WriteImage('%s/../../%s.png'%(smtesting.TempDir, imageFile)) + SaveScreenshot('%s/../../%s.png'%(smtesting.TempDir, imageFile)) if not smtesting.DoRegressionTesting(view.SMProxy): raise smtesting.TestError ('Test failed.') diff --git a/Clients/PythonCatalyst/Testing/Legacy/PythonScriptTest.py b/Clients/PythonCatalyst/Testing/Legacy/PythonScriptTest.py index d69986fb94b..addb95c3837 100644 --- a/Clients/PythonCatalyst/Testing/Legacy/PythonScriptTest.py +++ b/Clients/PythonCatalyst/Testing/Legacy/PythonScriptTest.py @@ -41,7 +41,7 @@ def DoCoProcessing(datadescription): DataRepresentation2.EdgeColor = [0.0, 0.0, 0.50000762951094835] fname = 'CPGrid' + str(timestep) + '.png' - WriteImage(fname) + SaveScreenshot(fname) DataRepresentation2 = Show(trivialproducer) DataRepresentation2.LookupTable = MakeBlueToRedLT(2702, 3202) @@ -55,7 +55,7 @@ def DoCoProcessing(datadescription): RenderView1.CameraParallelScale = 13.743685418725535 fname = 'CPPressure' + str(timestep) + '.png' - WriteImage(fname) + SaveScreenshot(fname) def RequestDataDescription(datadescription): diff --git a/Documentation/release/dev/deprecated-python-API-removal.md b/Documentation/release/dev/deprecated-python-API-removal.md new file mode 100644 index 00000000000..95814e2e035 --- /dev/null +++ b/Documentation/release/dev/deprecated-python-API-removal.md @@ -0,0 +1,17 @@ +## Deprecated python API removal + +Several deprecated python API that have been around for a few years are now gone. +This include : + +- `paraview.simple.CreateScalarBar()`, replaced by `paraview.simple.GetScalarBar()`. +- `paraview.simple.WriteAnimation()`, replaced by `paraview.simple.SaveAnimation()`. +- `paraview.simple.WriteImage()`, replaced by `paraview.simple.SaveScreenshot()`. +- `paraview.simple.ImportCinema()`, no longer supported since 5.9. +- `paraview.compatibility.GetVersion().GetVersion()`, because of float comparison issue. + +Other deprecated behaviors have been removed : + +- `paraview.compatibility.GetVersion()` cannot be compared with float values anymore. +- In `paraview.simple.CreateView()`, removed support for positional argument `detachedFromLayout`. +- In `paraview.simple.SaveScreenshot()`, removed support for optional argument `ImageQuality`. +- In `paraview.simple.SaveAnimation()`, removed support for optional argument `DisconnectAndSave` and `ImageQuality`. diff --git a/Plugins/pvblot/blotish.py b/Plugins/pvblot/blotish.py index 5389935de0d..1daf830b578 100644 --- a/Plugins/pvblot/blotish.py +++ b/Plugins/pvblot/blotish.py @@ -173,7 +173,7 @@ def _getReader(self): self._block_id_variable = "Part Index" self._block_id_field = "POINT_DATA" self._block_id_offset = 0 - + else: self._reader = paraview.simple.ExodusIIReader(FileName=self.filename) self._reader.add_attribute("DatabaseType", EXODUS) @@ -289,7 +289,7 @@ def _rebuildSpectrumLookupTable(self, lt): import paraview.vtk # Find a good range for the data. range = self.currentVariableInfo.GetRange(self.currentVariableComponent) - + if self.currentVariableComponent == -1: lt.VectorMode = "Magnitude" else: @@ -802,7 +802,7 @@ def _tplot_plot(io_helper=None): if state.diskwrite: fname = state.get_next_screenshot_filename("tplot_overlay") - paraview.simple.WriteImage(fname, state.tplot.view) + paraview.simple.SaveScreenshot(fname, state.tplot.view) return @@ -813,7 +813,7 @@ def _tplot_plot(io_helper=None): if state.diskwrite: fname = state.get_next_screenshot_filename("tplot_curve%02d"%i) - paraview.simple.WriteImage(fname, state.tplot.view) + paraview.simple.SaveScreenshot(fname, state.tplot.view) if interactive and i < nCurves-1: yield "Enter 'Q' to quit, '' to continue. " @@ -824,7 +824,7 @@ def _tplot_plot(io_helper=None): def _tplot_reset(): state.tplot.reset() - + def _detour_reset(): wireframe() @@ -921,7 +921,7 @@ def alltimes(): def show(name=""): """Show the given parameter name""" - + name = name.lower() if name in ["tmin", "tmax", "nintv", "zintv", "times", "steps"]: sel = state.time_selection @@ -947,7 +947,7 @@ def _detour_plot(io_helper=None): paraview.simple.Render(view) if state.diskwrite: - paraview.simple.WriteImage(state.get_next_screenshot_filename("detour"), view) + paraview.simple.SaveScreenshot(state.get_next_screenshot_filename("detour"), view) if interactive and stepIdx != nSteps-1: yield ("Time %f: Enter 'C' to complete, 'Q' to quit, '' to continue. " % t) @@ -958,7 +958,7 @@ def _detour_plot(io_helper=None): interactive = False def autoplot(flag): - """ + """ Turn autoplot on or off. The flag should be 0 (off) or 1 (on). When autoplot is on, then a command that changes the state of the plot automatically renders the last time step with the new features. @@ -1099,5 +1099,3 @@ def _maybe_convert(token, number_class): try: num = number_list_parser.convert_to_number_class(token, number_class) except number_list_parser.Error, err: raise BlotishError(err) return num - - diff --git a/Plugins/pvblot/tplot.py b/Plugins/pvblot/tplot.py index 0624f18e840..a4d1b1513d4 100644 --- a/Plugins/pvblot/tplot.py +++ b/Plugins/pvblot/tplot.py @@ -47,7 +47,7 @@ def __init__(self): def __del__(self): self.reset() - + def reset(self): self._curves = [] @@ -182,8 +182,8 @@ def plot(self, curve_index=0): curves_to_plot = self._curves elif curve_index < len(self._curves): curves_to_plot = [self._curves[curve_index]] - else: return - + else: return + view = self.view view.Representations = [] @@ -330,9 +330,9 @@ def get_series_label(self): else: return "%s %s %s" % (self.var.decorated_name, self.var.type_name, - self.id) + self.id) + - def _get_field_type_for_variable(var): if var.type == NODE_VARIABLE: return "POINT" diff --git a/Remoting/Application/Testing/Python/ColorAttributeTypeBackwardsCompatibility.py b/Remoting/Application/Testing/Python/ColorAttributeTypeBackwardsCompatibility.py index caa27a49a0b..a5f48710249 100644 --- a/Remoting/Application/Testing/Python/ColorAttributeTypeBackwardsCompatibility.py +++ b/Remoting/Application/Testing/Python/ColorAttributeTypeBackwardsCompatibility.py @@ -4,15 +4,15 @@ # This test tests backwards compatibility for ColorArrayName and ColorAttributeType # properties. -assert (paraview.compatibility.GetVersion().GetVersion() == None),\ +assert (bool(paraview.compatibility.GetVersion()) == False),\ "ParaView modules should never force backwards compatibility to any version" -assert ((paraview.compatibility.GetVersion() < 4.1) == False),\ +assert ((paraview.compatibility.GetVersion() < (4, 1)) == False),\ "less-than test should always fail when version is not specified." -assert ((paraview.compatibility.GetVersion() <= 4.1) == False),\ +assert ((paraview.compatibility.GetVersion() <= (4, 1)) == False),\ "less-equal test should always fail when version is not specified." -assert ((paraview.compatibility.GetVersion() > 4.1) == True),\ +assert ((paraview.compatibility.GetVersion() > (4, 1)) == True),\ "greater-than test should always pass when version is not specified." -assert ((paraview.compatibility.GetVersion() >= 4.1) == True),\ +assert ((paraview.compatibility.GetVersion() >= (4, 1)) == True),\ "greater-equal test should always pass when version is not specified." Sphere() @@ -39,10 +39,10 @@ # Now switch backwards compatibility to 4.1 paraview.compatibility.major = 4 paraview.compatibility.minor = 1 -assert ((paraview.compatibility.GetVersion() < 4.1) == False), "version comparison failed" -assert ((paraview.compatibility.GetVersion() <= 4.1) == True), "version comparison failed" -assert ((paraview.compatibility.GetVersion() > 4.1) == False), "version comparison failed" -assert ((paraview.compatibility.GetVersion() >= 4.1) == True), "version comparison failed" +assert ((paraview.compatibility.GetVersion() < (4, 1)) == False), "version comparison failed" +assert ((paraview.compatibility.GetVersion() <= (4, 1)) == True), "version comparison failed" +assert ((paraview.compatibility.GetVersion() > (4, 1)) == False), "version comparison failed" +assert ((paraview.compatibility.GetVersion() >= (4, 1)) == True), "version comparison failed" a = r.ColorAttributeType assert (type(a) == str), "'ColorAttributeType' must return a string" diff --git a/Remoting/Application/Testing/Python/LinePlotInScripts.py b/Remoting/Application/Testing/Python/LinePlotInScripts.py index 4b09c212bed..6e2e9e99334 100644 --- a/Remoting/Application/Testing/Python/LinePlotInScripts.py +++ b/Remoting/Application/Testing/Python/LinePlotInScripts.py @@ -25,5 +25,5 @@ for i in xrange(5): w.Maximum = 2**i - WriteImage(smtesting.TempDir + "/LinePlotInScripts_%d.png" % i, Magnification=2) + SaveScreenshot(smtesting.TempDir + "/LinePlotInScripts_%d.png" % i, magnification=2) print("Done") diff --git a/Remoting/Application/Testing/Python/MultiView.py b/Remoting/Application/Testing/Python/MultiView.py index 70a2065cde4..46b396a1625 100644 --- a/Remoting/Application/Testing/Python/MultiView.py +++ b/Remoting/Application/Testing/Python/MultiView.py @@ -30,15 +30,16 @@ testing2.AddArgument(baseline2) v2 = CreateXYPlotView() + for i in [0, 1, 2]: Render(v1) filename = "%s/view1_%d.png" % (smtesting.TempDir, i) - WriteImage(filename, v1) + SaveScreenshot(filename, v1, ImageResolution=(400, 400)) if testing1.RegressionTest(filename, smtesting.Threshold) != testing1.PASSED: raise RuntimeError("Failed image comparison for view 1 on run #%d"%i) Render(v2) filename = "%s/view2_%d.png" % (smtesting.TempDir, i) - WriteImage(filename, v2) + SaveScreenshot(filename, v2, ImageResolution=(400, 400)) if testing2.RegressionTest(filename, smtesting.Threshold) != testing2.PASSED: raise RuntimeError("Failed image comparison for view 2 on run #%d"%i) diff --git a/Remoting/Application/Testing/Python/PythonVersion.py b/Remoting/Application/Testing/Python/PythonVersion.py index 903a6ba78db..a6254d2f57d 100644 --- a/Remoting/Application/Testing/Python/PythonVersion.py +++ b/Remoting/Application/Testing/Python/PythonVersion.py @@ -1,42 +1,58 @@ # ensures paraview._version() works as expected. -from paraview import _version, compatibility +from paraview import compatibility -assert (compatibility.GetVersion().GetVersion() == None),\ +assert (bool(compatibility.GetVersion()) == False),\ "ParaView modules should never force backwards compatibility to any version" -assert ((compatibility.GetVersion() < 4.1) == False),\ +assert ((compatibility.GetVersion() < (4, 1)) == False),\ "less-than test should always fail when version is not specified." -assert ((compatibility.GetVersion() <= 4.1) == False),\ +assert ((compatibility.GetVersion() <= (4, 1)) == False),\ "less-equal test should always fail when version is not specified." -assert ((compatibility.GetVersion() > 4.1) == True),\ +assert ((compatibility.GetVersion() > (4, 1)) == True),\ "greater-than test should always pass when version is not specified." -assert ((compatibility.GetVersion() >= 4.1) == True),\ +assert ((compatibility.GetVersion() >= (4, 1)) == True),\ "greater-equal test should always pass when version is not specified." - -# Now switch backwards compatibility to 4.1 +# Now switch backwards compatibility to (4, 1) compatibility.major = 4 compatibility.minor = 1 -assert ((compatibility.GetVersion() < 4.1) == False), "version comparison failed" -assert ((compatibility.GetVersion() <= 4.1) == True), "version comparison failed" -assert ((compatibility.GetVersion() > 4.1) == False), "version comparison failed" -assert ((compatibility.GetVersion() >= 4.1) == True), "version comparison failed" +try: + compatibility.GetVersion() < 4.1 + assert (False), "version comparison with floating value should fail" +except TypeError: + assert (True) -assert ((compatibility.GetVersion() < (4, 10)) == True), "version comparison failed" -assert ((compatibility.GetVersion() <= (4,10)) == True), "version comparison failed" -assert ((compatibility.GetVersion() > (4,10)) == False), "version comparison failed" -assert ((compatibility.GetVersion() >= (4,10)) == False), "version comparison failed" +assert ((compatibility.GetVersion() < (4, 1)) == False), "version comparison failed" +assert ((compatibility.GetVersion() <= (4, 1)) == True), "version comparison failed" +assert ((compatibility.GetVersion() > (4, 1)) == False), "version comparison failed" +assert ((compatibility.GetVersion() >= (4, 1)) == True), "version comparison failed" +assert ((compatibility.GetVersion() < (4, 10)) == True), "version comparison failed" +assert ((compatibility.GetVersion() <= (4, 10)) == True), "version comparison failed" +assert ((compatibility.GetVersion() > (4, 10)) == False), "version comparison failed" +assert ((compatibility.GetVersion() >= (4, 10)) == False), "version comparison failed" compatibility.major = 4 -compatibility.major = 11 -assert ((compatibility.GetVersion() < 4.1) == False), "version comparison failed" -assert ((compatibility.GetVersion() <= 4.1) == False), "version comparison failed" -assert ((compatibility.GetVersion() > 4.1) == True), "version comparison failed" -assert ((compatibility.GetVersion() >= 4.1) == True), "version comparison failed" +compatibility.minor = 11 + +assert ((compatibility.GetVersion() < (4, 1)) == False), "version comparison failed" +assert ((compatibility.GetVersion() <= (4, 1)) == False), "version comparison failed" +assert ((compatibility.GetVersion() > (4, 1)) == True), "version comparison failed" +assert ((compatibility.GetVersion() >= (4, 1)) == True), "version comparison failed" assert ((compatibility.GetVersion() < (4, 10)) == False), "version comparison failed" -assert ((compatibility.GetVersion() <= (4,10)) == False), "version comparison failed" -assert ((compatibility.GetVersion() > (4,10)) == True), "version comparison failed" -assert ((compatibility.GetVersion() >= (4,10)) == True), "version comparison failed" +assert ((compatibility.GetVersion() <= (4, 10)) == False), "version comparison failed" +assert ((compatibility.GetVersion() > (4, 10)) == True), "version comparison failed" +assert ((compatibility.GetVersion() >= (4, 10)) == True), "version comparison failed" + +assert ((compatibility.GetVersion() < (4, 11)) == False), "version comparison failed" +assert ((compatibility.GetVersion() <= (4, 11)) == True), "version comparison failed" +assert ((compatibility.GetVersion() > (4, 11)) == False), "version comparison failed" +assert ((compatibility.GetVersion() >= (4, 11)) == True), "version comparison failed" + +assert ((compatibility.GetVersion() < (5, 0)) == True), "version comparison failed" +assert ((compatibility.GetVersion() > (3, 12)) == True), "version comparison failed" + +assert ((compatibility.GetVersion() < 5) == True), "major version comparison failed" +assert ((compatibility.GetVersion() > 3) == True), "major version comparison failed" diff --git a/Remoting/Application/Testing/Python/SaveAnimation.py b/Remoting/Application/Testing/Python/SaveAnimation.py index ea7304155e9..48fe591a3d0 100644 --- a/Remoting/Application/Testing/Python/SaveAnimation.py +++ b/Remoting/Application/Testing/Python/SaveAnimation.py @@ -40,17 +40,15 @@ def RegressionTest(imageName, baselineName): canex2Display = Show(reader, renderView1) # Save animation images -SaveAnimation(tempdir + "/SaveAnimation.png", ImageResolution=[600, 600], ImageQuality=40) +SaveAnimation(tempdir + "/SaveAnimation.png", ImageResolution=[600, 600]) # Lets save stereo animation images (two eyes at the same time) SaveAnimation(tempdir + "/SaveAnimationStereo.png", - ImageResolution=[600, 600], ImageQuality=40, - StereoMode="Both Eyes") + ImageResolution=[600, 600], StereoMode="Both Eyes") # Lets save stere video SaveAnimation(tempdir + "/SaveAnimationStereo.ogv", - ImageResolution=[600, 600], ImageQuality=40, - StereoMode="Both Eyes") + ImageResolution=[600, 600], StereoMode="Both Eyes") pm = servermanager.vtkProcessModule.GetProcessModule() if pm.GetPartitionId() == 0: diff --git a/Remoting/ServerManager/vtkSMStateVersionController.cxx b/Remoting/ServerManager/vtkSMStateVersionController.cxx index 355688766b3..37eaa61f131 100644 --- a/Remoting/ServerManager/vtkSMStateVersionController.cxx +++ b/Remoting/ServerManager/vtkSMStateVersionController.cxx @@ -61,13 +61,6 @@ class UniqueIdGenerator vtkTypeUInt32 GetNextUniqueId() { return (++this->LastUniqueId); } }; -string toString(int i) -{ - ostringstream ostr; - ostr << i; - return ostr.str(); -} - class vtkSMVersion { public: diff --git a/Remoting/Views/Testing/Python/SurfaceLICTestDriver.py b/Remoting/Views/Testing/Python/SurfaceLICTestDriver.py index 520a8368dce..4ee9a6d0a7a 100644 --- a/Remoting/Views/Testing/Python/SurfaceLICTestDriver.py +++ b/Remoting/Views/Testing/Python/SurfaceLICTestDriver.py @@ -46,7 +46,7 @@ SetActiveView(view) Render() imageFile = os.path.splitext(os.path.basename(smtesting.StateXMLFileName))[0] - WriteImage('%s/../../%s.png'%(smtesting.TempDir, imageFile)) + SaveScreenshot('%s/../../%s.png'%(smtesting.TempDir, imageFile)) if not smtesting.DoRegressionTesting(view.SMProxy): raise smtesting.TestError('Test failed.') diff --git a/Web/Python/paraview/web/dataset_builder.py b/Web/Python/paraview/web/dataset_builder.py index 56ca1ea06f1..d1eac644e38 100644 --- a/Web/Python/paraview/web/dataset_builder.py +++ b/Web/Python/paraview/web/dataset_builder.py @@ -133,7 +133,7 @@ def __init__(self, location, imageMimeType, cameraInfo, metadata={}): def writeImages(self): for cam in self.camera: update_camera(self.view, cam) - simple.WriteImage(self.dataHandler.getDataAbsoluteFilePath("image")) + simple.SaveScreenshot(self.dataHandler.getDataAbsoluteFilePath("image")) # ----------------------------------------------------------------------------- diff --git a/Wrapping/Python/paraview/__init__.py.in b/Wrapping/Python/paraview/__init__.py.in index 20017ed19d8..de569f9fd1f 100644 --- a/Wrapping/Python/paraview/__init__.py.in +++ b/Wrapping/Python/paraview/__init__.py.in @@ -90,41 +90,21 @@ class _version(object): def __bool__(self): return bool(self.__version) - def GetVersion(self): - """::deprecated:: 5.10 - - Return version as a float. Will return None is no version is - specified. - - This method is deprecated in 5.10. It's return value is not appropriate - for version number comparisons and hence should no longer be used. - """ - if self: - version = float(self.minor) - while version >= 1.0: - version = version / 10.0 - version += float(self.major) - return version - return None - def _convert(self, value): # convert value to _version if type(value) == type(self): return value elif type(value) == tuple or type(value) == list: if len(value) == 0: - value = _version(None, None) + return _version(None, None) elif len(value) == 1: - value = _version(value[0], 0) + return _version(value[0], 0) elif len(value) >= 2: - value = _version(value[0], value[1]) + return _version(value[0], value[1]) elif type(value) == int: - value = _version(value, 0) - elif type(value) == float: - major = int(value) - minor = int(10 * value) - (10 * major) - value = _version(major, minor) - return value + return _version(value, 0) + else: + raise TypeError("unsupport type %s", type(value)) def __lt__(self, other): """This will always return False if compatibility is not being forced @@ -132,12 +112,7 @@ class _version(object): if not self: return False - # convert other to _version, if possible - other = self._convert(other) - if type(other) == type(self): - return self.__version < other.__version - else: - raise TypeError("unsupport type %s", type(other)) + return self.__version < self._convert(other).__version def __le__(self, other): """This will always return False if compatibility is not forced to a @@ -145,12 +120,7 @@ class _version(object): if not self: return False - # convert other to _version, if possible - other = self._convert(other) - if type(other) == type(self): - return self.__version <= other.__version - else: - raise TypeError("unsupport type %s", type(other)) + return self.__version <= self._convert(other).__version def __eq__(self, other): raise RuntimeError("Equal operation not supported.") @@ -164,26 +134,15 @@ class _version(object): if not self: return True - # convert other to _version, if possible - other = self._convert(other) - if type(other) == type(self): - return self.__version > other.__version - else: - raise TypeError("unsupport type %s", type(other)) + return self.__version > self._convert(other).__version def __ge__(self, other): """This will always return True if compatibility is not being forced to a particular version""" - myversion = self.GetVersion() - if not myversion: + if not self: return True - # convert other to _version, if possible - other = self._convert(other) - if type(other) == type(self): - return self.__version >= other.__version - else: - raise TypeError("unsupport type %s", type(other)) + return self.__version >= self._convert(other).__version def __repr__(self): return str(self.__version) diff --git a/Wrapping/Python/paraview/_backwardscompatibilityhelper.py b/Wrapping/Python/paraview/_backwardscompatibilityhelper.py index 4c2b904c0b0..2744cf69e80 100644 --- a/Wrapping/Python/paraview/_backwardscompatibilityhelper.py +++ b/Wrapping/Python/paraview/_backwardscompatibilityhelper.py @@ -80,7 +80,7 @@ def setattr(proxy, pname, value): version = paraview.compatibility.GetVersion() if pname == "ColorAttributeType" and proxy.SMProxy.GetProperty("ColorArrayName"): - if paraview.compatibility.GetVersion() <= 4.1: + if paraview.compatibility.GetVersion() <= (4, 1): # set ColorAttributeType on ColorArrayName property instead. caProp = proxy.GetProperty("ColorArrayName") proxy.GetProperty("ColorArrayName").SetData((value, caProp[1])) @@ -92,7 +92,7 @@ def setattr(proxy, pname, value): "instead. Refer to ParaView Python API changes documentation online.") if pname == "AspectRatio" and proxy.SMProxy.GetProperty("ScalarBarThickness"): - if paraview.compatibility.GetVersion() <= 5.3: + if paraview.compatibility.GetVersion() <= (5, 3): # We can't do this perfectly, so we set the ScalarBarThickness # property instead. Assume a reasonable modern screen size of # 1280x1024 with a Render view size of 1000x600. Even if we had @@ -115,7 +115,7 @@ def setattr(proxy, pname, value): "'ScalarBarThickness' property to set the width instead.") if pname == "Position2" and proxy.SMProxy.GetProperty("ScalarBarLength"): - if paraview.compatibility.GetVersion() <= 5.3: + if paraview.compatibility.GetVersion() <= (5, 3): # The scalar bar length corresponds to Position2[0] when the # orientation is horizontal and Position2[1] when the orientation # is vertical. @@ -131,7 +131,7 @@ def setattr(proxy, pname, value): "'ScalarBarLength' property to set the length instead.") if pname == "LockScalarRange" and proxy.SMProxy.GetProperty("AutomaticRescaleRangeMode"): - if paraview.compatibility.GetVersion() <= 5.4: + if paraview.compatibility.GetVersion() <= (5, 4): from paraview.modules.vtkRemotingViews import vtkSMTransferFunctionManager if value: proxy.GetProperty("AutomaticRescaleRangeMode").SetData(vtkSMTransferFunctionManager.NEVER) @@ -148,7 +148,7 @@ def setattr(proxy, pname, value): # data it operates on. This change changed the method and property name from AttributeMode to # AttributeType if pname == "AttributeMode" and proxy.SMProxy.GetXMLName() == "Calculator": - if paraview.compatibility.GetVersion() <= 5.4: + if paraview.compatibility.GetVersion() <= (5, 4): # The Attribute type uses enumeration values from vtkDataObject::AttributeTypes # rather than custom constants for the calculator. For the values supported by # ParaView before this change, the conversion works out to subtracting 1 if value @@ -164,13 +164,13 @@ def setattr(proxy, pname, value): "'AttributeMode' is obsolete. Use 'AttributeType' property of Calculator filter instead.") if pname == "UseOffscreenRenderingForScreenshots" and proxy.SMProxy.IsA("vtkSMViewProxy"): - if paraview.compatibility.GetVersion() <= 5.4: + if paraview.compatibility.GetVersion() <= (5, 4): raise Continue() else: raise NotSupportedException(\ "'UseOffscreenRenderingForScreenshots' is obsolete. Simply remove it from your script.") if pname == "UseOffscreenRendering" and proxy.SMProxy.IsA("vtkSMViewProxy"): - if paraview.compatibility.GetVersion() <= 5.4: + if paraview.compatibility.GetVersion() <= (5, 4): raise Continue() else: raise NotSupportedException(\ @@ -180,7 +180,7 @@ def setattr(proxy, pname, value): # in 5.5, CGNS reader had some changes. "BaseStatus", "FamilyStatus", # "LoadBndPatch", and "LoadMesh" properties were removed. if pname in ["LoadBndPatch", "LoadMesh", "BaseStatus", "FamilyStatus"]: - if paraview.compatibility.GetVersion() <= 5.4: + if paraview.compatibility.GetVersion() <= (5, 4): paraview.print_warning(\ "'%s' is no longer supported and will have no effect. "\ "Please use `Blocks` property to specify blocks to load." % pname) @@ -190,7 +190,7 @@ def setattr(proxy, pname, value): "property to select blocks using SIL instead." % pname) if pname == "DataBoundsInflateFactor" and proxy.SMProxy.GetProperty("DataBoundsScaleFactor"): - if paraview.compatibility.GetVersion() <= 5.4: + if paraview.compatibility.GetVersion() <= (5, 4): # In 5.5, The axes grid data bounds inflate factor have been # translated by 1 to become the scale factor. proxy.GetProperty("DataBoundsScaleFactor").SetData(value + 1) @@ -203,7 +203,7 @@ def setattr(proxy, pname, value): if proxy.SMProxy and proxy.SMProxy.GetXMLName() == "AnnotateAttributeData": # in 5.5, Annotate Attribute Data changed how it sets the array to annotate if pname == "ArrayAssociation": - if paraview.compatibility.GetVersion() <= 5.4: + if paraview.compatibility.GetVersion() <= (5, 4): paraview.print_warning(\ "'ArrayAssociation' is obsolete. Use 'SelectInputArray' property of AnnotateAttributeData instead.") @@ -223,7 +223,7 @@ def setattr(proxy, pname, value): raise NotSupportedException(\ "'ArrayAssociation' is obsolete as of ParaView 5.5. Use 'SelectInputArray' instead.") elif pname == "ArrayName": - if paraview.compatibility.GetVersion() <= 5.4: + if paraview.compatibility.GetVersion() <= (5, 4): paraview.print_warning(\ "'ArrayName' is obsolete. Use 'SelectInputArray' property of AnnotateAttributeData instead.") @@ -237,7 +237,7 @@ def setattr(proxy, pname, value): # In 5.5, we changed the Clip to be inverted from what it was before and changed the InsideOut # property to be called Invert to be clearer. if pname == "InsideOut" and proxy.SMProxy.GetXMLName() == "Clip": - if paraview.compatibility.GetVersion() <= 5.4: + if paraview.compatibility.GetVersion() <= (5, 4): proxy.GetProperty("Invert").SetData(1-value) raise Continue() else: @@ -248,7 +248,7 @@ def setattr(proxy, pname, value): # the "FieldAssociation" and "GenerateCellConnectivity" properties. They are # now moved to the view. if pname in ["FieldAssociation", "GenerateCellConnectivity"] and proxy.SMProxy.GetXMLName() == "SpreadSheetRepresentation": - if paraview.compatibility.GetVersion() <= 5.5: + if paraview.compatibility.GetVersion() <= (5, 5): raise Continue() else: raise NotSupportedException( @@ -257,7 +257,7 @@ def setattr(proxy, pname, value): # In 5.7, we changed to the names of the input proxies in ResampleWithDataset to clarify what # each source does. if pname == "Input" and proxy.SMProxy.GetXMLName() == "ResampleWithDataset": - if paraview.compatibility.GetVersion() < 5.7: + if paraview.compatibility.GetVersion() < (5, 7): proxy.GetProperty("SourceDataArrays").SetData(value) raise Continue() else: @@ -266,7 +266,7 @@ def setattr(proxy, pname, value): 'Please set the SourceDataArrays property instead.') if pname == "Source" and proxy.SMProxy.GetXMLName() == "ResampleWithDataset": - if paraview.compatibility.GetVersion() < 5.7: + if paraview.compatibility.GetVersion() < (5, 7): proxy.GetProperty("DestinationMesh").SetData(value) raise Continue() else: @@ -277,7 +277,7 @@ def setattr(proxy, pname, value): # In 5.7, we removed `ArrayName` property on the `GenerateIdScalars` filter # and replaced it with `CellIdsArrayName` and `PointIdsArrayName`. if pname == "ArrayName" and proxy.SMProxy.GetXMLName() == "GenerateIdScalars": - if paraview.compatibility.GetVersion() < 5.7: + if paraview.compatibility.GetVersion() < (5, 7): proxy.GetProperty("PointIdsArrayName").SetData(value) proxy.GetProperty("CellIdsArrayName").SetData(value) raise Continue() @@ -288,7 +288,7 @@ def setattr(proxy, pname, value): # In 5.7, we renamed the 3D View's ray tracing interface from OSPRay to RayTracing if pname == "EnableOSPRay" and proxy.SMProxy.IsA("vtkSMRenderViewProxy"): - if paraview.compatibility.GetVersion() < 5.7: + if paraview.compatibility.GetVersion() < (5, 7): return proxy.GetProperty("EnableRayTracing").SetData(value) else: raise NotSupportedException( @@ -297,7 +297,7 @@ def setattr(proxy, pname, value): newvalue = "OSPRay raycaster" if value == "pathtracer": newvalue = "OSPRay pathtracer" - if paraview.compatibility.GetVersion() < 5.7: + if paraview.compatibility.GetVersion() < (5, 7): return proxy.GetProperty("BackEnd").SetData(newvalue) else: raise NotSupportedException( @@ -305,32 +305,32 @@ def setattr(proxy, pname, value): 'the settings `scivis` and `pathtracer` have been renamed to `OSPRay scivis` '\ 'and `OSPRay pathtracer` respectively.') if pname == "OSPRayTemporalCacheSize" and proxy.SMProxy.IsA("vtkSMRenderViewProxy"): - if paraview.compatibility.GetVersion() < 5.7: + if paraview.compatibility.GetVersion() < (5, 7): return proxy.GetProperty("TemporalCacheSize").SetData(value) else: raise NotSupportedException( 'The `OSPRayTemporalCacheSize` control has been renamed in ParaView 5.7 to `TemporalCacheSize`.') if pname == "OSPRayUseScaleArray" and proxy.SMProxy.IsA("vtkSMRepresentationProxy"): - if paraview.compatibility.GetVersion() < 5.7: + if paraview.compatibility.GetVersion() < (5, 7): return proxy.GetProperty("UseScaleArray").SetData(value) else: raise NotSupportedException( 'The `OSPRayUseScaleArray` control has been renamed in ParaView 5.7 to `UseScaleArray`.') if pname == "OSPRayScaleFunction" and proxy.SMProxy.IsA("vtkSMRepresentationProxy"): - if paraview.compatibility.GetVersion() < 5.7: + if paraview.compatibility.GetVersion() < (5, 7): return proxy.GetProperty("ScaleFunction").SetData(value) else: raise NotSupportedException( 'The `OSPRayScaleFunction` control has been renamed in ParaView 5.7 to `ScaleFunction`.') if pname == "OSPRayMaterial" and proxy.SMProxy.IsA("vtkSMRepresentationProxy"): - if paraview.compatibility.GetVersion() < 5.7: + if paraview.compatibility.GetVersion() < (5, 7): return proxy.GetProperty("Material").SetData(value) else: raise NotSupportedException( 'The `OSPRayMaterial` control has been renamed in ParaView 5.7 to `Material`.') if pname == "CompositeDataSetIndex" and proxy.SMProxy.GetXMLName() == "SpreadSheetRepresentation": - if paraview.compatibility.GetVersion() <= 5.9: + if paraview.compatibility.GetVersion() <= (5, 9): selectors = ["//*[@cid='%s']" % cid for cid in value] return proxy.GetProperty("BlockVisibilities").SetData(selectors) else: @@ -340,7 +340,7 @@ def setattr(proxy, pname, value): if pname == "BlockIndices" and proxy.SMProxy.GetXMLName() == "ExtractBlock": - if paraview.compatibility.GetVersion() <= 5.9: + if paraview.compatibility.GetVersion() <= (5, 9): selectors = ["//*[@cid='%s']" % cid for cid in value] return proxy.GetProperty("Selectors").SetData(selectors) else: @@ -349,7 +349,7 @@ def setattr(proxy, pname, value): "supports 'Selectors' to select blocks.") if pname in ["MaintainStructure", "PruneOutput"] and proxy.SMProxy.GetXMLName() == "ExtractBlock": - if paraview.compatibility.GetVersion() <= 5.9: + if paraview.compatibility.GetVersion() <= (5, 9): return else: raise NotSupportedException( @@ -359,7 +359,7 @@ def setattr(proxy, pname, value): if pname in ["UseGradientBackground", "UseTexturedBackground", "UseSkyboxBackground"] and proxy.SMProxy.GetXMLGroup() == "views" \ and proxy.SMProxy.GetProperty("BackgroundColorMode"): - if paraview.compatibility.GetVersion() <= 5.9: + if paraview.compatibility.GetVersion() <= (5, 9): mode = proxy.GetProperty("BackgroundColorMode").GetData() if pname == "UseGradientBackground": if value == 1 and mode != "Gradient": @@ -385,7 +385,7 @@ def setattr(proxy, pname, value): # From ParaView 5.10, the Threshold filter now offers additional # thresholding methods besides ThresholdBetween. The lower and upper # threshold values are also set separately. - if paraview.compatibility.GetVersion() <= 5.9: + if paraview.compatibility.GetVersion() <= (5, 9): proxy.GetProperty("ThresholdMethod").SetData(0) proxy.GetProperty("LowerThreshold").SetData(value[0]) proxy.GetProperty("UpperThreshold").SetData(value[1]) @@ -400,7 +400,7 @@ def setattr(proxy, pname, value): # In 5.11, we changed the ParticleTracer/ParticlePath/StreakLine's the StaticMesh # property to be called MeshOverTime since more capabilities were added. if pname == "StaticMesh" and proxy.SMProxy.GetXMLName() in ["ParticleTracer, ParticlePath, StreakLine"]: - if paraview.compatibility.GetVersion() <= 5.10: + if paraview.compatibility.GetVersion() <= (5, 10): proxy.GetProperty("MeshOverTime").SetData(value) raise Continue() else: @@ -416,7 +416,7 @@ def setattr(proxy, pname, value): def setattr_fix_value(proxy, pname, value, setter_func): if pname == "ShaderPreset" and proxy.SMProxy.GetXMLName().endswith("Representation"): if value == "Gaussian Blur (Default)": - if paraview.compatibility.GetVersion() <= 5.5: + if paraview.compatibility.GetVersion() <= (5, 5): paraview.print_warning(\ "The 'Gaussian Blur (Default)' option has been renamed to 'Gaussian Blur'. Please use that instead.") setter_func(proxy, "Gaussian Blur") @@ -426,7 +426,7 @@ def setattr_fix_value(proxy, pname, value, setter_func): " Use 'Gaussian Blur' instead.") if pname == "FieldAssociation" and proxy.SMProxy.GetXMLName() in ["DataSetCSVWriter", "CSVWriter"]: - if paraview.compatibility.GetVersion() < 5.8: + if paraview.compatibility.GetVersion() < (5, 8): if value == "Points": value = "Point Data" elif value == "Cells": @@ -448,7 +448,7 @@ def setattr_fix_value(proxy, pname, value, setter_func): if value == seed_sources_from[i]: domain_proxy = domain.FindProxy("extended_sources", seed_sources_proxyname[i]) if domain_proxy: - if paraview.compatibility.GetVersion() < 5.9: + if paraview.compatibility.GetVersion() < (5, 9): value = seed_sources_to[i] setter_func(proxy, value) raise Continue() @@ -463,7 +463,7 @@ def setattr_fix_value(proxy, pname, value, setter_func): 'UpperLeftCorner': 'Upper Left Corner', 'UpperRightCorner': 'Upper Right Corner', 'UpperCenter': 'Upper Center'} new_value = window_location_map[value] - if paraview.compatibility.GetVersion() <= 5.9: + if paraview.compatibility.GetVersion() <= (5, 9): setter_func(proxy, new_value) raise Continue() else: @@ -493,7 +493,7 @@ def getattr(proxy, pname): # In 4.2, we removed ColorAttributeType property. One is expected to use # ColorArrayName to specify the attribute type as well. if pname == "ColorAttributeType" and proxy.SMProxy.GetProperty("ColorArrayName"): - if version <= 4.1: + if version <= (4, 1): if proxy.GetProperty("ColorArrayName")[0] == "CELLS": return "CELL_DATA" else: @@ -507,7 +507,7 @@ def getattr(proxy, pname): # since we added support to render view to automatically reset clipping # range for each render. if pname == "CameraClippingRange" and not proxy.SMProxy.GetProperty("CameraClippingRange"): - if version <= 5.0: + if version <= (5, 0): return [0.0, 0.0, 0.0] else: raise NotSupportedException( @@ -517,7 +517,7 @@ def getattr(proxy, pname): # In 5.1, we remove support for Cube Axes and related properties. global _ACubeAxesHelper if proxy.SMProxy.IsA("vtkSMPVRepresentationProxy") and hasattr(_ACubeAxesHelper, pname): - if version <= 5.0: + if version <= (5, 0): return builtins.getattr(_ACubeAxesHelper, pname) else: raise NotSupportedException( @@ -527,7 +527,7 @@ def getattr(proxy, pname): # In 5.4, we removed the AspectRatio property and replaced it with the # ScalarBarThickness property. if pname == "AspectRatio" and proxy.SMProxy.GetProperty("ScalarBarThickness"): - if version <= 5.3: + if version <= (5, 3): return 20.0 else: raise NotSupportedException( @@ -538,7 +538,7 @@ def getattr(proxy, pname): # In 5.4, we removed the Position2 property and replaced it with the # ScalarBarLength property. if pname == "Position2" and proxy.SMProxy.GetProperty("ScalarBarLength"): - if version <= 5.3: + if version <= (5, 3): if proxy.GetProperty("Orientation").GetData() == "Horizontal": return [0.05, proxy.GetProperty("ScalarBarLength").GetData()] else: @@ -551,7 +551,7 @@ def getattr(proxy, pname): # In 5.5, we removed the PVLookupTable.LockScalarRange boolean property and # replaced it with the enumeration AutomaticRescaleRangeMode. if pname == "LockScalarRange" and proxy.SMProxy.GetProperty("AutomaticRescaleRangeMode"): - if version <= 5.4: + if version <= (5, 4): from paraview.modules.vtkRemotingViews import vtkSMTransferFunctionManager if proxy.GetProperty("AutomaticRescaleRangeMode").GetData() == "Never": return 1 @@ -566,7 +566,7 @@ def getattr(proxy, pname): # data it operates on. This change changed the method and property name from AttributeMode to # AttributeType if pname == "AttributeMode" and proxy.SMProxy.GetName() == "Calculator": - if paraview.compatibility.GetVersion() <= 5.4: + if version <= (5, 4): # The Attribute type uses enumeration values from vtkDataObject::AttributeTypes # rather than custom constants for the calculator. For the values supported by # ParaView before this change, the conversion works out to adding 1 if it is an @@ -583,14 +583,14 @@ def getattr(proxy, pname): 'constants are needed for the two properties.') if pname == "UseOffscreenRenderingForScreenshots" and proxy.SMProxy.IsA("vtkSMViewProxy"): - if version <= 5.4: + if version <= (5, 4): return 0 else: raise NotSupportedException('`UseOffscreenRenderingForScreenshots` '\ 'is no longer supported. Please remove it.') if pname == "UseOffscreenRendering" and proxy.SMProxy.IsA("vtkSMViewProxy"): - if version <= 5.4: + if version <= (5, 4): return 0 else: raise NotSupportedException(\ @@ -598,7 +598,7 @@ def getattr(proxy, pname): if proxy.SMProxy.GetXMLName() == "CGNSSeriesReader" and\ pname in ["LoadBndPatch", "LoadMesh", "BaseStatus", "FamilyStatus"]: - if version < 5.5: + if version < (5, 5): if pname in ["LoadMesh", "LoadBndPatch"]: return 0 else: @@ -613,7 +613,7 @@ def getattr(proxy, pname): # In 5.5, we removed the DataBoundsInflateFactor property and replaced it with the # DataBoundsScaleFactor property. if pname == "DataBoundsInflateFactor" and proxy.SMProxy.GetProperty("DataBoundsScaleFactor"): - if version <= 5.4: + if version <= (5, 4): inflateValue = proxy.GetProperty("DataBoundsScaleFactor").GetData() - 1 if inflateValue >= 0: return inflateValue @@ -627,7 +627,7 @@ def getattr(proxy, pname): if proxy.SMProxy and proxy.SMProxy.GetXMLName() == "AnnotateAttributeData": # in 5.5, Annotate Attribute Data changed how it sets the array to annotate if pname == "ArrayAssociation": - if paraview.compatibility.GetVersion() <= 5.4: + if version <= (5, 4): paraview.print_warning(\ "'ArrayAssociation' is obsolete. Use 'SelectInputArray' property of AnnotateAttributeData instead.") @@ -644,7 +644,7 @@ def getattr(proxy, pname): raise NotSupportedException(\ "'ArrayAssociation' is obsolete as of ParaView 5.5. Use 'SelectInputArray' instead.") elif pname == "ArrayName": - if paraview.compatibility.GetVersion() <= 5.4: + if version <= (5, 4): paraview.print_warning(\ "'ArrayName' is obsolete. Use 'SelectInputArray' property of AnnotateAttributeData instead.") return proxy.GetProperty("SelectInputArray")[1] @@ -655,7 +655,7 @@ def getattr(proxy, pname): # In 5.5, we changed the Clip to be inverted from what it was before and changed the InsideOut # property to be called Invert to be clearer. if pname == "InsideOut" and proxy.SMProxy.GetXMLName() == "Clip": - if paraview.compatibility.GetVersion() <= 5.4: + if version <= (5, 4): return proxy.GetProperty("Invert").GetData() else: raise NotSupportedException( @@ -666,7 +666,7 @@ def getattr(proxy, pname): # the "FieldAssociation" and "GenerateCellConnectivity" properties. They are # now moved to the view. if pname in ["FieldAssociation", "GenerateCellConnectivity"] and proxy.SMProxy.GetXMLName() == "SpreadSheetRepresentation": - if paraview.compatibility.GetVersion() <= 5.5: + if version <= (5, 5): return 0 else: raise NotSupportedException( @@ -675,7 +675,7 @@ def getattr(proxy, pname): # In 5.7, we changed to the names of the input proxies in ResampleWithDataset to clarify what # each source does. if pname == "Input" and proxy.SMProxy.GetXMLName() == "ResampleWithDataset": - if paraview.compatibility.GetVersion() < 5.7: + if version < (5, 7): return proxy.GetProperty("SourceDataArrays") else: raise NotSupportedException( @@ -683,7 +683,7 @@ def getattr(proxy, pname): 'Please access the SourceDataArrays property instead.') if pname == "Source" and proxy.SMProxy.GetXMLName() == "ResampleWithDataset": - if paraview.compatibility.GetVersion() < 5.7: + if version < (5, 7): return proxy.GetProperty("DestinationMesh") else: raise NotSupportedException( @@ -693,7 +693,7 @@ def getattr(proxy, pname): # In 5.7, we removed `ArrayName` property on the `GenerateIdScalars` filter # and replaced it with `CellIdsArrayName` and `PointIdsArrayName`. if pname == "ArrayName" and proxy.SMProxy.GetXMLName() == "GenerateIdScalars": - if paraview.compatibility.GetVersion() < 5.7: + if version < (5, 7): return proxy.GetProperty("PointIdsArrayName") else: raise NotSupportedException( @@ -702,13 +702,13 @@ def getattr(proxy, pname): # In 5.7, we renamed the 3D View's ray tracing interface from OSPRay to RayTracing if pname == "EnableOSPRay" and proxy.SMProxy.IsA("vtkSMRenderViewProxy"): - if paraview.compatibility.GetVersion() < 5.7: + if version < (5, 7): return proxy.GetProperty("EnableRayTracing") else: raise NotSupportedException( 'The `EnableOSPRay` control has been renamed in ParaView 5.7 to `EnableRayTracing`.') if pname == "OSPRayRenderer" and proxy.SMProxy.IsA("vtkSMRenderViewProxy"): - if paraview.compatibility.GetVersion() < 5.7: + if version < (5, 7): return proxy.GetProperty("BackEnd") else: raise NotSupportedException( @@ -716,25 +716,25 @@ def getattr(proxy, pname): 'the settings `scivis` and `pathtracer` have been renamed to `OSPRay scivis` '\ 'and `OSPRay pathtracer` respectively.') if pname == "OSPRayTemporalCacheSize" and proxy.SMProxy.IsA("vtkSMRenderViewProxy"): - if paraview.compatibility.GetVersion() < 5.7: + if version < (5, 7): return proxy.GetProperty("TemporalCacheSize") else: raise NotSupportedException( 'The `OSPRayTemporalCacheSize` control has been renamed in ParaView 5.7 to `TemporalCacheSize`.') if pname == "OSPRayUseScaleArray" and proxy.SMProxy.IsA("vtkSMRepresentationProxy"): - if paraview.compatibility.GetVersion() < 5.7: + if version < (5, 7): return proxy.GetProperty("UseScaleArray") else: raise NotSupportedException( 'The `OSPRayUseScaleArray` control has been renamed in ParaView 5.7 to `UseScaleArray`.') if pname == "OSPRayScaleFunction" and proxy.SMProxy.IsA("vtkSMRepresentationProxy"): - if paraview.compatibility.GetVersion() < 5.7: + if version < (5, 7): return proxy.GetProperty("ScaleFunction") else: raise NotSupportedException( 'The `OSPRayScaleFunction` control has been renamed in ParaView 5.7 to `ScaleFunction`.') if pname == "OSPRayMaterial" and proxy.SMProxy.IsA("vtkSMRepresentationProxy"): - if paraview.compatibility.GetVersion() < 5.7: + if version < (5, 7): return proxy.GetProperty("Material") else: raise NotSupportedException( @@ -743,7 +743,7 @@ def getattr(proxy, pname): # In 5.7, the `Box` implicit function's Scale property was renamed to # Length. if pname == "Scale" and proxy.SMProxy.GetXMLName() == "Box": - if paraview.compatibility.GetVersion() < 5.7: + if version < (5, 7): return proxy.GetProperty("Length") else: raise NotSupportedException( @@ -751,7 +751,7 @@ def getattr(proxy, pname): # In 5.9, CGNSSeriesReader no longer supports the "Blocks" property. if pname == "Blocks" and proxy.SMProxy.GetXMLName() == "CGNSSeriesReader": - if paraview.compatibility.GetVersion() < 5.9: + if version < (5, 9): return [] else: raise NotSupportedException( @@ -763,7 +763,7 @@ def getattr(proxy, pname): # 5.10 onwards SpreadSheetRepresentation cannot provide a value for # CompositeDataSetIndex if pname == "CompositeDataSetIndex" and proxy.SMProxy.GetXMLName() == "SpreadSheetRepresentation": - if paraview.compatibility.GetVersion() <= 5.9: + if version <= (5, 9): return [] else: raise NotSupportedException( @@ -773,21 +773,21 @@ def getattr(proxy, pname): if proxy.SMProxy.GetXMLName() == "ExtractBlock": if pname == "BlockIndices": - if paraview.compatibility.GetVersion() <= 5.9: + if version <= (5, 9): return [] else: raise NotSupportedException( "Since ParaView 5.10, 'BlockIndices' on 'ExtractBlock' " "has been replaced by 'Selectors'.") elif pname == "PruneOutput": - if paraview.compatibility.GetVersion() <= 5.9: + if version <= (5, 9): return 1 else: raise NotSupportedException( "Since ParaView 5.10, 'PruneOutput' on 'ExtractBlock' " "is no longer supported. Simply remove it.") elif pname == "MaintainStructure": - if paraview.compatibility.GetVersion() <= 5.9: + if version <= (5, 9): return 1 else: raise NotSupportedException( @@ -797,7 +797,7 @@ def getattr(proxy, pname): if pname in ["UseGradientBackground", "UseTexturedBackground", "UseSkyboxBackground"] and proxy.SMProxy.GetXMLGroup() == "views" \ and proxy.SMProxy.GetProperty("BackgroundColorMode"): - if paraview.compatibility.GetVersion() <= 5.9: + if version <= (5, 9): mode = proxy.GetProperty("BackgroundColorMode").GetData() if pname == "UseGradientBackground": return 1 if mode == "Gradient" else 0 @@ -814,7 +814,7 @@ def getattr(proxy, pname): # The Threshold filter now offers additional thresholding methods # besides ThresholdBetween. The lower and upper threshold values # are also set separately. - if paraview.compatibility.GetVersion() <= 5.9: + if version <= (5, 9): return [proxy.GetProperty("LowerThreshold").GetData(), proxy.GetProperty("UpperThreshold").GetData()] else: @@ -828,7 +828,7 @@ def getattr(proxy, pname): # The Threshold filter now offers additional thresholding methods # besides ThresholdBetween. The lower and upper threshold values # are also set separately. - if paraview.compatibility.GetVersion() <= 5.10: + if version <= (5, 10): return [proxy.GetProperty("LowerThreshold").GetData(), proxy.GetProperty("UpperThreshold").GetData()] else: @@ -844,7 +844,7 @@ def getattr(proxy, pname): "instead. The 'CutoffArray' needs to be provided by the data set source.") if pname == "StaticMesh" and proxy.SMProxy.GetXMLName() in ["ParticleTracer, ParticlePath, StreakLine"]: - if paraview.compatibility.GetVersion() <= 5.10: + if version <= (5, 10): return proxy.GetProperty("MeshOverTime").GetData() else: raise NotSupportedException( @@ -853,7 +853,7 @@ def getattr(proxy, pname): if proxy.SMProxy.GetXMLName() == "DataSetSurfaceFilter": if pname == "UseGeometryFilter": - if paraview.compatibility.GetVersion() <= 5.10: + if version <= (5, 10): return 1 else: raise NotSupportedException( @@ -866,21 +866,21 @@ def getattr(proxy, pname): # label and not its name. def GetProxy(module, key, **kwargs): version = paraview.compatibility.GetVersion() - if version < 5.5: + if version < (5, 5): if key == "Clip": # in PV 5.5 we changed the default for Clip's InsideOut property to 1 instead of 0 # also InsideOut was changed to Invert in 5.5 clip = builtins.getattr(module, key)(**kwargs) clip.Invert = 0 return clip - if version < 5.7: + if version < (5, 7): if key == "ExodusRestartReader" or key == "ExodusIIReader": # in 5.7, we changed the names for blocks, this preserves old # behavior reader = builtins.getattr(module, key)(**kwargs) reader.UseLegacyBlockNamesWithElementTypes = 1 return reader - if version <= 5.9: + if version <= (5, 9): if key == "PlotOverLine": ## in 5.10, we changed the backend of Plot Over Line ## This restores the previous backend. @@ -902,7 +902,7 @@ def GetProxy(module, key, **kwargs): # into a unique 'Gradient" filter. gradient = builtins.getattr(module, "GradientLegacy")(**kwargs) return gradient - if version <= 5.10: + if version <= (5, 10): if key in ["ParticleTracer, ParticlePath, StreakLine"]: # in 5.11, we changed the StaticMesh flag of ParticleTracer, ParticlePath and StreakLine # This restores the previous StaticMesh. @@ -919,7 +919,7 @@ def lookupTableUpdate(lutName): # For backwards compatibility reverseLut = False version = paraview.compatibility.GetVersion() - if (version <= 5.8): + if (version <= (5, 8)): # In 5.9, some redundant color maps were removed and some had name changes. # Replace these with a color map that remains. Also handle some color map # name changes. diff --git a/Wrapping/Python/paraview/_colorMaps.py b/Wrapping/Python/paraview/_colorMaps.py index 7f207008a4f..11ed24f7965 100644 --- a/Wrapping/Python/paraview/_colorMaps.py +++ b/Wrapping/Python/paraview/_colorMaps.py @@ -1,7 +1,10 @@ r""" +PARAVIEW_DEPRECATED_IN_5_12_0 + This is a deprecated module and should not be used anymore. These are legacy colormap XMLs kept around till `paraview.lookuptable` module is deprecated -and removed.""" +and removed. +""" __colorMapsXML = """ @@ -2945,7 +2948,13 @@ """ def getColorMaps(): - """Returns the vtkPVXMLElement instance for the default (legacy) color maps""" + """ + PARAVIEW_DEPRECATED_IN_5_12_0 + Returns the vtkPVXMLElement instance for the default (legacy) color maps + """ + import warnings + warnings.warn("'getColorMaps' is deprecated.", DeprecationWarning) + global __colorMapsXML from paraview.modules.vtkPVCore import vtkPVXMLParser parser = vtkPVXMLParser() diff --git a/Wrapping/Python/paraview/coprocessing.py b/Wrapping/Python/paraview/coprocessing.py index 58317ff5ab7..7e9cd60eb9d 100644 --- a/Wrapping/Python/paraview/coprocessing.py +++ b/Wrapping/Python/paraview/coprocessing.py @@ -611,19 +611,29 @@ def RegisterView(self, view, filename, freq, fittoscreen, magnification, width, return view def CreateWriter(self, proxy_ctor, filename, freq): - """**DEPRECATED!!! Use RegisterWriter instead** + """ + PARAVIEW_DEPRECATED_IN_5_12_0 Use RegisterWriter instead + Creates a writer proxy. This method is generally used in reatePipeline() to create writers. All writes created as such will write the output files appropriately in WriteData() is called. """ + import warnings + warnings.warn("'CoProcessor.CreateWriter' is deprecated, use CoProcessor.RegisterWriter instead", DeprecationWarning) + writer = proxy_ctor() return self.RegisterWriter(writer, filename, freq) def CreateView(self, proxy_ctor, filename, freq, fittoscreen, magnification, width, height): - """**DEPRECATED!!! Use RegisterView instead** + """ + PARAVIEW_DEPRECATED_IN_5_12_0 Use RegisterView instead + Create a CoProcessing view for image capture with extra meta-data such as magnification, size and frequency. """ + import warnings + warnings.warn("'CoProcessor.CreateView' is deprecated, use 'CoProcessor.RegisterView' instead", DeprecationWarning) + view = proxy_ctor() return self.RegisterView(view, filename, freq, fittoscreen, magnification, width, height, None) diff --git a/Wrapping/Python/paraview/lookuptable.py b/Wrapping/Python/paraview/lookuptable.py index f5d40f8b9d2..374a6d263c6 100644 --- a/Wrapping/Python/paraview/lookuptable.py +++ b/Wrapping/Python/paraview/lookuptable.py @@ -2,7 +2,7 @@ This module is intended for use with by simple.py. -DEPRECATED: will be removed in future releases of ParaView. +PARAVIEW_DEPRECATED_IN_5_12_0: will be removed in future releases of ParaView. """ #============================================================================== # @@ -146,6 +146,9 @@ class vtkPVLUTReader: """ def __init__(self,ns=None): + import warnings + warnings.warn("'vtkPVLUTReader' is deprecated.", DeprecationWarning) + self.LUTS={} self.DefaultLUT=None self.Globals=ns diff --git a/Wrapping/Python/paraview/servermanager.py b/Wrapping/Python/paraview/servermanager.py index 96e4a1f2f69..2b3e8460a03 100644 --- a/Wrapping/Python/paraview/servermanager.py +++ b/Wrapping/Python/paraview/servermanager.py @@ -90,7 +90,7 @@ def _wrap_property(proxy, smproperty): appropriate python object. """ property = None - if paraview.compatibility.GetVersion() >= 3.5 and \ + if paraview.compatibility.GetVersion() >= (3, 5) and \ smproperty.IsA("vtkSMStringVectorProperty"): arraySelectionDomain = smproperty.FindDomain("vtkSMArraySelectionDomain") chartSeriesSelectionDomain = smproperty.FindDomain("vtkSMChartSeriesSelectionDomain") @@ -358,7 +358,7 @@ def GetPropertyValue(self, name): """Returns a scalar for properties with 1 elements, the property itself for vectors.""" p = self.GetProperty(name) - if isinstance(p, VectorProperty) and paraview.compatibility.GetVersion() <= 4.1 and name == "ColorArrayName": + if isinstance(p, VectorProperty) and paraview.compatibility.GetVersion() <= (4, 1) and name == "ColorArrayName": # Return ColorArrayName as just the array name for backwards compatibility. return p[1] if isinstance(p, EnumerationProperty) or \ @@ -608,7 +608,7 @@ class ExodusIIReaderProxy(SourceProxy): """Special class to define convenience functions for array selection.""" - if paraview.compatibility.GetVersion() >= 3.5: + if paraview.compatibility.GetVersion() >= (3, 5): def FileNameChanged(self): "Called when the filename changes. Selects all variables." SourceProxy.FileNameChanged(self) @@ -1505,12 +1505,17 @@ def __init__(self, dataInformation, proxy, idx): self.Idx = idx def Update(self): - """****Deprecated**** There is no reason anymore to use this method + """ + PARAVIEW_DEPRECATED_IN_5_12_0 There is no reason anymore to use this method explicitly, it is called automatically when one gets any value from the data information object. + Update the data information if necessary. Note that this does not cause execution of the underlying object. In certain cases, you may have to call UpdatePipeline() on the proxy.""" + import warnings + warnings.warn("'DataInformation.Update' is no longer necessary and thus deprecated.", DeprecationWarning) + if self.Proxy: self.Proxy.GetDataInformation(self.Idx) @@ -1579,7 +1584,7 @@ def __eq__(self, other): def __neq__(self, other): return not self.__eq__(other) - if paraview.compatibility.GetVersion() <= 3.4: + if paraview.compatibility.GetVersion() <= (3, 4): def Range(self, component=0): return self.GetRange(component) @@ -2359,7 +2364,9 @@ def get_source(self, fullname): return self._info(fullname).GetSource() def LoadXML(xmlstring): - """DEPRECATED. Given a server manager XML as a string, parse and process it.""" + """ + PARAVIEW_DEPRECATED_IN_5_12_0 Use LoadPlugin(...) instead + """ raise RuntimeError ("Deprecated. Use LoadPlugin(...) instead.") def LoadPlugin(filename, remote=True, connection=None): @@ -2599,7 +2606,7 @@ def _createGetProperty(pName): """Internal method to create a GetXXX() method where XXX == pName.""" propName = pName def getProperty(self): - if paraview.compatibility.GetVersion() >= 3.5: + if paraview.compatibility.GetVersion() >= (3, 5): return self.GetPropertyValue(propName) else: return self.GetProperty(propName) @@ -2642,7 +2649,9 @@ def _printProgress(caller, event): currentProgress = 0 def updateModules(m=None): - """Deprecated. Not needed since 5.10.""" + """PARAVIEW_DEPRECATED_IN_5_12_0. Not needed since 5.10.""" + import warnings + warnings.warn("'servermanager.updateModules' is no longer necessary and thus deprecated.", DeprecationWarning) pass class ProxyNamespace: @@ -2670,7 +2679,7 @@ def _getPyName(xml=None, smproxy=None, proxyname=None): assert xml or smproxy or proxyname if proxyname: name = proxyname - elif paraview.compatibility.GetVersion() >= 3.5: + elif paraview.compatibility.GetVersion() >= (3, 5): if xml: name = xml.GetAttributeOrDefault("label", xml.GetAttribute("name")) elif smproxy: @@ -2832,12 +2841,12 @@ def _createClassProperties(proto, excludeset=frozenset()): # Add all properties as python properties. for prop in iter: propName = iter.GetKey() - if paraview.compatibility.GetVersion() >= 3.5: + if paraview.compatibility.GetVersion() >= (3, 5): if (prop.GetInformationOnly() and propName != "TimestepValues" \ and prop.GetPanelVisibility() == "never") or prop.GetIsInternal(): continue names = [propName] - if paraview.compatibility.GetVersion() >= 3.5: + if paraview.compatibility.GetVersion() >= (3, 5): names = [iter.PropertyLabel] propDoc = None @@ -2863,7 +2872,7 @@ def _createClass(groupName, proxyName, apxm=None, prototype=None): paraview.print_error("Error while loading %s %s"%(groupName, proxyName)) return None pname = proxyName - if paraview.compatibility.GetVersion() >= 3.5 and proto.GetXMLLabel(): + if paraview.compatibility.GetVersion() >= (3, 5) and proto.GetXMLLabel(): pname = proto.GetXMLLabel() pname = _make_name_valid(pname) if not pname: @@ -2949,7 +2958,7 @@ def demo1(): view)""" if not ActiveConnection: Connect() - if paraview.compatibility.GetVersion() <= 3.4: + if paraview.compatibility.GetVersion() <= (3, 4): ss = sources.SphereSource(Radius=2, ThetaResolution=32) shr = filters.ShrinkFilter(Input=OutputPort(ss,0)) cs = sources.ConeSource() @@ -2979,7 +2988,7 @@ def demo2(fname="/Users/berk/Work/ParaViewData/Data/disk_out_ref.ex2"): # Create the exodus reader and specify a file name reader = sources.ExodusIIReader(FileName=fname) # Get the list of point arrays. - if paraview.compatibility.GetVersion() <= 3.4: + if paraview.compatibility.GetVersion() <= (3, 4): arraySelection = reader.PointResultArrayStatus else: arraySelection = reader.PointVariables @@ -3016,7 +3025,7 @@ def demo2(fname="/Users/berk/Work/ParaViewData/Data/disk_out_ref.ex2"): numComps = ai.GetNumberOfComponents() print ("Number of components:", numComps) for j in range(numComps): - if paraview.compatibility.GetVersion() <= 3.4: + if paraview.compatibility.GetVersion() <= (3, 4): print ("Range:", ai.Range(j)) else: print ("Range:", ai.GetRange(j)) @@ -3049,7 +3058,7 @@ def demo3(): if not ActiveConnection: Connect() # Create a synthetic data source - if paraview.compatibility.GetVersion() <= 3.4: + if paraview.compatibility.GetVersion() <= (3, 4): source = sources.RTAnalyticSource() else: source = sources.Wavelet() @@ -3083,7 +3092,7 @@ def demo3(): rv.StillRender() # Now, let's probe the data - if paraview.compatibility.GetVersion() <= 3.4: + if paraview.compatibility.GetVersion() <= (3, 4): probe = filters.Probe(Input=source) # with a line line = sources.LineSource(Resolution=60) @@ -3133,7 +3142,7 @@ def demo5(): """ Simple sphere animation""" if not ActiveConnection: Connect() - if paraview.compatibility.GetVersion() <= 3.4: + if paraview.compatibility.GetVersion() <= (3, 4): sphere = sources.SphereSource() else: sphere = sources.Sphere() diff --git a/Wrapping/Python/paraview/simple.py b/Wrapping/Python/paraview/simple.py index 9955b314450..839723dc7b9 100644 --- a/Wrapping/Python/paraview/simple.py +++ b/Wrapping/Python/paraview/simple.py @@ -139,16 +139,10 @@ def SetActiveConnection(connection=None, ns=None): #============================================================================== # Views and Layout methods #============================================================================== -def CreateView(view_xml_name, detachedFromLayout=None, **params): +def CreateView(view_xml_name, **params): """Creates and returns the specified proxy view based on its name/label. Also set params keywords arguments as view properties. - - `detachedFromLayout` has been deprecated in ParaView 5.7 as it is no longer - needed. All views are created detached by default. """ - if detachedFromLayout is not None: - warnings.warn("`detachedFromLayout` is deprecated in ParaView 5.7", DeprecationWarning) - view = servermanager._create_view(view_xml_name) if not view: raise RuntimeError ("Failed to create requested view", view_xml_name) @@ -169,12 +163,12 @@ def CreateView(view_xml_name, detachedFromLayout=None, **params): controller.PostInitializeProxy(view) controller.RegisterViewProxy(view, registrationName) - if paraview.compatibility.GetVersion() <= 5.6: + if paraview.compatibility.GetVersion() <= (5, 6): # older versions automatically assigned view to a # layout. controller.AssignViewToLayout(view) - if paraview.compatibility.GetVersion() <= 5.9: + if paraview.compatibility.GetVersion() <= (5, 9): if hasattr(view, "UseColorPaletteForBackground"): view.UseColorPaletteForBackground = 0 @@ -191,67 +185,67 @@ def CreateView(view_xml_name, detachedFromLayout=None, **params): # ----------------------------------------------------------------------------- -def CreateRenderView(detachedFromLayout=False, **params): +def CreateRenderView(**params): """Create standard 3D render view. See CreateView for arguments documentation""" - return CreateView("RenderView", detachedFromLayout, **params) + return CreateView("RenderView", **params) # ----------------------------------------------------------------------------- -def CreateXYPlotView(detachedFromLayout=False, **params): +def CreateXYPlotView(**params): """Create XY plot Chart view. See CreateView for arguments documentation""" - return CreateView("XYChartView", detachedFromLayout, **params) + return CreateView("XYChartView", **params) # ----------------------------------------------------------------------------- -def CreateXYPointPlotView(detachedFromLayout=False, **params): +def CreateXYPointPlotView(**params): """Create XY plot point Chart view. See CreateView for arguments documentation""" - return CreateView("XYPointChartView", detachedFromLayout, **params) + return CreateView("XYPointChartView", **params) # ----------------------------------------------------------------------------- -def CreateBarChartView(detachedFromLayout=False, **params): +def CreateBarChartView(**params): """Create Bar Chart view. See CreateView for arguments documentation""" - return CreateView("XYBarChartView", detachedFromLayout, **params) + return CreateView("XYBarChartView", **params) # ----------------------------------------------------------------------------- -def CreateComparativeRenderView(detachedFromLayout=False, **params): +def CreateComparativeRenderView(**params): """Create Comparative view. See CreateView for arguments documentation""" - return CreateView("ComparativeRenderView", detachedFromLayout, **params) + return CreateView("ComparativeRenderView", **params) # ----------------------------------------------------------------------------- -def CreateComparativeXYPlotView(detachedFromLayout=False, **params): +def CreateComparativeXYPlotView(**params): """Create comparative XY plot Chart view. See CreateView for arguments documentation""" - return CreateView("ComparativeXYPlotView", detachedFromLayout, **params) + return CreateView("ComparativeXYPlotView", **params) # ----------------------------------------------------------------------------- -def CreateComparativeBarChartView(detachedFromLayout=False, **params): +def CreateComparativeBarChartView(**params): """Create comparative Bar Chart view. See CreateView for arguments documentation""" - return CreateView("ComparativeBarChartView", detachedFromLayout, **params) + return CreateView("ComparativeBarChartView", **params) # ----------------------------------------------------------------------------- -def CreateParallelCoordinatesChartView(detachedFromLayout=False, **params): +def CreateParallelCoordinatesChartView(**params): """Create Parallele coordinate Chart view. See CreateView for arguments documentation""" - return CreateView("ParallelCoordinatesChartView", detachedFromLayout, **params) + return CreateView("ParallelCoordinatesChartView", **params) # ----------------------------------------------------------------------------- -def Create2DRenderView(detachedFromLayout=False, **params): +def Create2DRenderView(**params): """Create the standard 3D render view with the 2D interaction mode turned ON. See CreateView for arguments documentation""" - return CreateView("2DRenderView", detachedFromLayout, **params) + return CreateView("2DRenderView", **params) # ----------------------------------------------------------------------------- @@ -1241,16 +1235,6 @@ def ReplaceReaderFileName(readerProxy, files, propName): should be "FileNames" or "FileName" depending on the property name in the reader.""" servermanager.vtkSMCoreUtilities.ReplaceReaderFileName(readerProxy.SMProxy, files, propName) -# ----------------------------------------------------------------------------- -def ImportCinema(filename, view=None): - """::deprecated:: 5.9 - - Cinema import capabilities are no longer supported in this version. - """ - import warnings - warnings.warn("'ImportCinema' is no longer supported", DeprecationWarning) - return False - # ----------------------------------------------------------------------------- def CreateWriter(filename, proxy=None, **extraArgs): """Creates a writer that can write the data produced by the source proxy in @@ -1289,24 +1273,6 @@ def SaveData(filename, proxy=None, **extraArgs): writer.UpdatePipeline() del writer -# ----------------------------------------------------------------------------- - -def WriteImage(filename, view=None, **params): - """::deprecated:: 4.2 - Use :func:`SaveScreenshot` instead. - """ - if not view: - view = active_objects.view - writer = None - if 'Writer' in params: - writer = params['Writer'] - mag = 1 - if 'Magnification' in params: - mag = int(params['Magnification']) - if not writer: - writer = _find_writer(filename) - view.WriteImage(filename, writer, mag) - # ----------------------------------------------------------------------------- def _SaveScreenshotLegacy(filename, view=None, layout=None, magnification=None, quality=None, **params): @@ -1322,9 +1288,9 @@ def _SaveScreenshotLegacy(filename, except TypeError: magnification = 1 try: - quality = int(quality) + quality = max(0, min(100, int(quality))) except TypeError: - quality = -1 + quality = 100 # convert magnification to image resolution. if viewOrLayout.IsA("vtkSMViewProxy"): @@ -1337,13 +1303,20 @@ def _SaveScreenshotLegacy(filename, imageResolution = (size[0]*magnification, size[1]*magnification) - # convert quality to ImageQuality - imageQuality = quality - - # now, call the new API - return SaveScreenshot(filename, viewOrLayout, + import os.path + _, extension = os.path.splitext(filename) + if (extension == '.jpg'): + return SaveScreenshot(filename, viewOrLayout, ImageResolution=imageResolution, - ImageQuality=imageQuality) + Quality=quality) + elif (extension == '.png'): + compression = int(((quality * 0.01) - 1.0) * -9.0) + return SaveScreenshot(filename, viewOrLayout, + ImageResolution=imageResolution, + CompressionLevel=compression) + else: + return SaveScreenshot(filename, viewOrLayout, + ImageResolution=imageResolution) def SaveScreenshot(filename, viewOrLayout=None, **params): """Save screenshot for a view or layout (collection of views) to an image. @@ -1433,11 +1406,6 @@ def SaveScreenshot(filename, viewOrLayout=None, **params): quality (int) Output image quality, a number in the range [0, 100]. - - ImageQuality (int) - For ParaView 5.4, the following parameters were available, however - it is ignored starting with ParaView 5.5. Instead, it is recommended - to use format-specific quality parameters based on the file format being used. """ # Let's handle backwards compatibility. # Previous API for this method took the following arguments: @@ -1488,11 +1456,6 @@ def SaveScreenshot(filename, viewOrLayout=None, **params): formatProxy.SetPropertyWithName(prop, params[prop]) del params[prop] - if "ImageQuality" in params: - import warnings - warnings.warn("'ImageQuality' is deprecated and will be ignored.", DeprecationWarning) - del params["ImageQuality"] - SetProperties(options, **params) return options.WriteImage(filename) @@ -1569,17 +1532,6 @@ def SaveAnimation(filename, viewOrLayout=None, scene=None, **params): UseSubsampling: When set to 1 (or True), the video will be encoded using 4:2:0 subsampling for the color channels. - - **Obsolete Parameters** - - DisconnectAndSave (int): - This mode is no longer supported as of ParaView 5.5, and will be - ignored. - - ImageQuality (int) - For ParaView 5.4, the following parameters were available, however - it is ignored starting with ParaView 5.5. Instead, it is recommended - to use format-specific quality parameters based on the file format being used. """ # use active view if no view or layout is specified. viewOrLayout = viewOrLayout if viewOrLayout else GetActiveView() @@ -1591,11 +1543,6 @@ def SaveAnimation(filename, viewOrLayout=None, scene=None, **params): if not scene: raise RuntimeError("Missing animation scene.") - if "DisconnectAndSave" in params: - import warnings - warnings.warn("'DisconnectAndSave' is deprecated and will be ignored.", DeprecationWarning) - del params["DisconnectAndSave"] - controller = servermanager.ParaViewPipelineController() options = servermanager.misc.SaveAnimation() controller.PreInitializeProxy(options) @@ -1624,73 +1571,9 @@ def SaveAnimation(filename, viewOrLayout=None, scene=None, **params): formatProxy.SetPropertyWithName(prop, params[prop]) del params[prop] - if "ImageQuality" in params: - import warnings - warnings.warn("'ImageQuality' is deprecated and will be ignored.", DeprecationWarning) - del params["ImageQuality"] - SetProperties(options, **params) return options.WriteAnimation(filename) -def WriteAnimation(filename, **params): - """ - ::deprecated:: 5.3 - Use :func:`SaveAnimation` instead. - - This function can still be used to save an animation, but using - :func: `SaveAnimation` is strongly recommended as it provides more - flexibility. - - The following parameters are currently supported. - - **Parameters** - - filename (str) - Name of the output file. - - **Keyword Parameters (optional)** - - Magnification (int): - Magnification factor for the saved animation. - - Quality (int) - int in range [0,2]. - - FrameRate (int) - Frame rate. - - The following parameters are no longer supported and are ignored: - Subsampling, BackgroundColor, FrameRate, StartFileCount, PlaybackTimeWindow - """ - newparams = {} - - # this method simply tries to provide legacy behavior. - scene = GetAnimationScene() - newparams["scene"] = scene - - # previously, scene saved all views and only worked well if there was 1 - # layout, so do that. - layout = GetLayout() - newparams["viewOrLayout"] = layout - - if "Magnification" in params: - magnification = params["Magnification"] - exts = [0] * 4 - layout.GetLayoutExtent(exts) - size = [exts[1]-exts[0]+1, exts[3]-exts[2]+1] - imageResolution = (size[0]*magnification, size[1]*magnification) - newparams["ImageResolution"] = imageResolution - - if "Quality" in params: - # convert quality (0=worst, 2=best) to imageQuality (0 = worst, 100 = best) - quality = int(params["Quality"]) - imageQuality = int(100 * quality/2.0) - newparams["ImageQuality"] = imageQuality - - if "FrameRate" in params: - newparams["FrameRate"] = int(params["FrameRate"]) - return SaveAnimation(filename, **newparams) - def WriteAnimationGeometry(filename, view=None): """Save the animation geometry from a specific view to a file specified. The animation geometry is written out as a PVD file. If no view is @@ -1927,7 +1810,10 @@ def GetLookupTableForArray(arrayname, num_components, **params): """Used to get an existing lookuptable for a array or to create one if none exists. Keyword arguments can be passed in to initialize the LUT if a new one is created. - *** DEPRECATED ***: Use GetColorTransferFunction instead""" + PARAVIEW_DEPRECATED_IN_5_12_0: Use GetColorTransferFunction instead""" + import warnings + warnings.warn("'GetLookupTableForArray' is deprecated, use GetColorTransferFunction instead", DeprecationWarning) + return GetColorTransferFunction(arrayname, **params) # ----------------------------------------------------------------------------- @@ -1995,34 +1881,6 @@ def LoadLookupTable(fileName): # ----------------------------------------------------------------------------- -def CreateScalarBar(**params): - """Create and return a scalar bar widget. The returned widget may - be added to a render view by appending it to the view's representations - The widget must have a valid lookup table before it is added to a view. - It is possible to pass the lookup table (and other properties) as arguments - to this method:: - - lt = MakeBlueToRedLT(3.5, 7.5) - bar = CreateScalarBar(LookupTable=lt, Title="Velocity") - GetRenderView().Representations.append(bar) - - By default the returned widget is selectable and resizable. - ::deprecated:: 5.10 - Use :func:`GetScalarBar` instead. - """ - import warnings - warnings.warn("`CreateScalarBar` is deprecated in ParaView 5.10. Use `GetScalarBar` instead", - DeprecationWarning) - sb = servermanager.rendering.ScalarBarWidgetRepresentation() - sb.Selectable = 1 - sb.Resizable = 1 - sb.Enabled = 1 - sb.Title = "Scalars" - SetProperties(sb, **params) - return sb - -# ----------------------------------------------------------------------------- - # TODO: Change this to take the array name and number of components. Register # the lt under the name ncomp.array_name def MakeBlueToRedLT(min, max): @@ -2521,7 +2379,7 @@ def Show3DWidgets(proxy=None): If possible in the current environment, this method will request the application to show the 3D widget(s) for proxy - ::deprecated:: 5.11 + PARAVIEW_DEPRECATED_IN_5_11_0 Use :func:`ShowInteractiveWidgets` instead. """ import warnings @@ -2534,7 +2392,7 @@ def Hide3DWidgets(proxy=None): If possible in the current environment, this method will request the application to show the 3D widget(s) for proxy - ::deprecated:: 5.11 + PARAVIEW_DEPRECATED_IN_5_11_0 Use :func:`HideInteractiveWidgets` instead. """ import warnings diff --git a/Wrapping/Python/paraview/spatiotemporalparallelism.py b/Wrapping/Python/paraview/spatiotemporalparallelism.py index 6d24331333a..0f01553aac9 100644 --- a/Wrapping/Python/paraview/spatiotemporalparallelism.py +++ b/Wrapping/Python/paraview/spatiotemporalparallelism.py @@ -58,7 +58,7 @@ def WriteImages(currentTimeStep, currentTime, views): filename = view.tpFileName.replace("%t", str(currentTimeStep)) view.ViewTime = currentTime cinemaLines.append(str(currentTime) + "," + view.GetXMLName()+"_"+str(cnt) + "," + filename + "\n") - pvsimple.WriteImage(filename, view, Magnification=view.tpMagnification) + pvsimple.SaveScreenshot(filename, view, magnification=view.tpMagnification) cnt = cnt + 1 return cinemaLines