Skip to content

Commit 5a8ec1a

Browse files
Bump version 0.2.3
1 parent 7c81f41 commit 5a8ec1a

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

doc/changelog.d/71.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fix: Off_screen not working properly

doc/source/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import ansys.tools.visualization_interface
2121
from ansys.tools.visualization_interface import __version__
2222

23-
os.environ["PYANSYS_VISUALIZER_DOC_BUILD"] = "true"
24-
2523
ansys.tools.visualization_interface.DOCUMENTATION_BUILD = True
2624

2725
LaTeXBuilder.supported_image_types = ["image/png", "image/pdf", "image/svg+xml"]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
44

55
[project]
66
name = "ansys-tools-visualization-interface"
7-
version = "0.2.2"
7+
version = "0.2.3"
88
description = "A Python visualization interface for PyAnsys libraries"
99
readme = "README.rst"
1010
requires-python = ">=3.9,<4"

src/ansys/tools/visualization_interface/backends/pyvista/pyvista_interface.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class PyVistaInterface:
4646
Parameters
4747
----------
4848
scene : ~pyvista.Plotter, default: None
49-
Scene for rendering the objects.
49+
Scene for rendering the objects. If passed, ``off_screen`` needs to
50+
be set manually beforehand for documentation and testing.
5051
color_opts : dict, default: None
5152
Dictionary containing the background and top colors.
5253
num_points : int, default: 100
@@ -73,9 +74,10 @@ def __init__(
7374
"""Initialize the plotter."""
7475
# Generate custom scene if ``None`` is provided
7576
if scene is None:
76-
scene = pv.Plotter(plotter_kwargs)
77-
if viz_interface.TESTING_MODE:
78-
scene.off_screen = True
77+
if viz_interface.TESTING_MODE or viz_interface.DOCUMENTATION_BUILD:
78+
scene = pv.Plotter(off_screen=True, **plotter_kwargs)
79+
else:
80+
scene = pv.Plotter(**plotter_kwargs)
7981
# If required, use a white background with no gradient
8082
if not color_opts:
8183
color_opts = dict(color="white")
@@ -336,10 +338,6 @@ def show(
336338
if kwargs.get("screenshot") is not None:
337339
self.scene.off_screen = True
338340

339-
# If running on testing, set off_screen to True for the plotter
340-
if viz_interface.TESTING_MODE or viz_interface.DOCUMENTATION_BUILD:
341-
self.scene.off_screen = True
342-
343341
self.scene.show(jupyter_backend=jupyter_backend, **kwargs)
344342

345343
def set_add_mesh_defaults(self, plotting_options: Optional[Dict]) -> None:

0 commit comments

Comments
 (0)