Skip to content

Commit af9f92c

Browse files
feat: Adapt the plugins import to Paraview 6.0 (#149)
* Add a condition on vtkMergeBlocks import for recent vtk and paraview API
1 parent 76140c4 commit af9f92c

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

geos-posp/src/geos_posp/visu/PVUtils/paraviewTreatments.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,16 @@
1212
ComponentNameEnum,
1313
GeosMeshOutputsEnum,
1414
)
15-
from paraview.modules.vtkPVVTKExtensionsMisc import ( # type: ignore[import-not-found]
16-
vtkMergeBlocks, )
15+
from packaging.version import Version
16+
17+
# TODO: remove this condition when all codes are adapted for Paraview 6.0
18+
import vtk
19+
if Version( vtk.__version__ ) >= Version( "9.5" ):
20+
from vtkmodules.vtkFiltersParallel import vtkMergeBlocks
21+
else:
22+
from paraview.modules.vtkPVVTKExtensionsMisc import ( # type: ignore[import-not-found]
23+
vtkMergeBlocks, )
24+
1725
from paraview.simple import ( # type: ignore[import-not-found]
1826
FindSource, GetActiveView, GetAnimationScene, GetDisplayProperties, GetSources, servermanager,
1927
)

geos-pv/src/geos/pv/utils/paraviewTreatments.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@
88
import numpy as np
99
import numpy.typing as npt
1010
import pandas as pd # type: ignore[import-untyped]
11-
from paraview.modules.vtkPVVTKExtensionsMisc import ( # type: ignore[import-not-found]
12-
vtkMergeBlocks, )
11+
12+
from packaging.version import Version
13+
14+
# TODO: remove this condition when all codes are adapted for Paraview 6.0
15+
import vtk
16+
if Version( vtk.__version__ ) >= Version( "9.5" ):
17+
from vtkmodules.vtkFiltersParallel import vtkMergeBlocks
18+
else:
19+
from paraview.modules.vtkPVVTKExtensionsMisc import ( # type: ignore[import-not-found]
20+
vtkMergeBlocks, )
1321
from paraview.simple import ( # type: ignore[import-not-found]
1422
FindSource, GetActiveView, GetAnimationScene, GetDisplayProperties, GetSources, servermanager,
1523
)

0 commit comments

Comments
 (0)