ansys-tools-visualization-interface 0.9.2__py3-none-any.whl → 0.11.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,7 @@
21
21
  # SOFTWARE.
22
22
  """Provides a wrapper to aid in plotting."""
23
23
  from abc import abstractmethod
24
+ from collections.abc import Callable
24
25
  import importlib.util
25
26
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
26
27
 
@@ -405,6 +406,31 @@ class PyVistaBackendInterface(BaseBackend):
405
406
  """Disable hover capabilities in the plotter."""
406
407
  self._hover_widget.EnabledOff()
407
408
 
409
+ def __extract_kwargs(self, func_name: Callable, input_kwargs: Dict[str, Any]) -> Dict[str, Any]:
410
+ """Extracts the keyword arguments from a function signature and returns it as dict.
411
+
412
+ Parameters
413
+ ----------
414
+ func_name : Callable
415
+ Function to extract the keyword arguments from. It should be a callable function
416
+ input_kwargs : Dict[str, Any]
417
+ Dictionary with the keyword arguments to update the extracted ones.
418
+
419
+ Returns
420
+ -------
421
+ Dict[str, Any]
422
+ Dictionary with the keyword arguments extracted from the function signature and
423
+ updated with the input kwargs.
424
+ """
425
+ import inspect
426
+ signature = inspect.signature(func_name)
427
+ kwargs = {}
428
+ for k, v in signature.parameters.items():
429
+ # We are ignoring positional arguments, and passing everything as kwarg
430
+ if v.default is not inspect.Parameter.empty:
431
+ kwargs[k] = input_kwargs[k] if k in input_kwargs else v.default
432
+ return kwargs
433
+
408
434
  def show(
409
435
  self,
410
436
  plottable_object: Any = None,
@@ -412,7 +438,7 @@ class PyVistaBackendInterface(BaseBackend):
412
438
  view_2d: Dict = None,
413
439
  name_filter: str = None,
414
440
  dark_mode: bool = False,
415
- **plotting_options,
441
+ **kwargs: Dict[str, Any],
416
442
  ) -> List[Any]:
417
443
  """Plot and show any PyAnsys object.
418
444
 
@@ -431,9 +457,8 @@ class PyVistaBackendInterface(BaseBackend):
431
457
  Regular expression with the desired name or names to include in the plotter.
432
458
  dark_mode : bool, default: False
433
459
  Whether to use dark mode for the widgets.
434
- **plotting_options : dict, default: None
435
- Keyword arguments. For allowable keyword arguments, see the
436
- :meth:`Plotter.add_mesh <pyvista.Plotter.add_mesh>` method.
460
+ **kwargs : Any
461
+ Additional keyword arguments for the show or plot method.
437
462
 
438
463
  Returns
439
464
  -------
@@ -441,6 +466,14 @@ class PyVistaBackendInterface(BaseBackend):
441
466
  List with the picked bodies in the picked order.
442
467
 
443
468
  """
469
+ plotting_options = self.__extract_kwargs(
470
+ self._pl._scene.add_mesh,
471
+ kwargs,
472
+ )
473
+ show_options = self.__extract_kwargs(
474
+ self._pl.scene.show,
475
+ kwargs,
476
+ )
444
477
  self.plot(plottable_object, name_filter, **plotting_options)
445
478
  if self._pl.object_to_actors_map:
446
479
  self._object_to_actors_map = self._pl.object_to_actors_map
@@ -476,7 +509,9 @@ class PyVistaBackendInterface(BaseBackend):
476
509
  # Update all buttons/widgets
477
510
  [widget.update() for widget in self._widgets]
478
511
 
479
- self.show_plotter(screenshot, **plotting_options)
512
+ # Remove screenshot from show options since we pass it manually
513
+ show_options.pop("screenshot", None)
514
+ self.show_plotter(screenshot, **show_options)
480
515
 
481
516
  picked_objects_list = []
482
517
  if isinstance(plottable_object, list):
@@ -512,8 +547,7 @@ class PyVistaBackendInterface(BaseBackend):
512
547
  visualizer.set_scene(self._pl)
513
548
  visualizer.show()
514
549
  else:
515
- jupyter_backend = kwargs.pop("jupyter_backend", None)
516
- self.pv_interface.show(screenshot=screenshot, jupyter_backend=jupyter_backend)
550
+ self.pv_interface.show(screenshot=screenshot, **kwargs)
517
551
 
518
552
  pv.OFF_SCREEN = self._pv_off_screen_original
519
553
 
@@ -328,8 +328,9 @@ class PyVistaInterface:
328
328
  jupyter_backend : str, default: None
329
329
  PyVista Jupyter backend.
330
330
  **kwargs : dict, default: None
331
- Plotting keyword arguments. For allowable keyword arguments, see the
332
- :meth:`Plotter.show <pyvista.Plotter.show>` method.
331
+ Plotting and show keyword arguments. For allowable keyword arguments, see the
332
+ :meth:`Plotter.show <pyvista.Plotter.show>` and
333
+ :meth:`Plotter.show <pyvista.Plotter.add_mesh>` methods.
333
334
 
334
335
  Notes
335
336
  -----
@@ -360,6 +361,8 @@ class PyVistaInterface:
360
361
  if kwargs.get("screenshot") is not None:
361
362
  self.scene.off_screen = True
362
363
  if jupyter_backend:
364
+ # Remove jupyter_backend from show options since we pass it manually
365
+ kwargs.pop("jupyter_backend", None)
363
366
  self.scene.show(jupyter_backend=jupyter_backend, **kwargs)
364
367
  else:
365
368
  if self._use_qt:
@@ -33,10 +33,6 @@ from ansys.tools.visualization_interface.backends.pyvista.widgets.widget import
33
33
  class Button(PlotterWidget):
34
34
  """Provides the abstract class for implementing buttons in PyAnsys.
35
35
 
36
- Notes
37
- -----
38
- This class wraps the PyVista ``add_checkbox_button_widget()`` method.
39
-
40
36
  Parameters
41
37
  ----------
42
38
  plotter : Plotter
@@ -46,6 +42,9 @@ class Button(PlotterWidget):
46
42
  dark_mode : bool, optional
47
43
  Whether to activate the dark mode or not.
48
44
 
45
+ Notes
46
+ -----
47
+ This class wraps the PyVista ``add_checkbox_button_widget()`` method.
49
48
  """
50
49
 
51
50
  def __init__(self, plotter: Plotter, button_config: tuple, dark_mode: bool = False) -> None:
@@ -56,16 +56,15 @@ class Ruler(PlotterWidget):
56
56
  def callback(self, state: bool) -> None:
57
57
  """Remove or add the ruler widget actor upon click.
58
58
 
59
- Notes
60
- -----
61
- This method provides a callback function for the ruler widet.
62
- It is called every time the ruler widget is clicked.
63
-
64
59
  Parameters
65
60
  ----------
66
61
  state : bool
67
62
  Whether the state of the button, which is inherited from PyVista, is ``True``.
68
63
 
64
+ Notes
65
+ -----
66
+ This method provides a callback function for the ruler widet.
67
+ It is called every time the ruler widget is clicked.
69
68
  """
70
69
  if not state and self._actor:
71
70
  self.plotter.remove_actor(self._actor)
@@ -56,16 +56,16 @@ class ScreenshotButton(PlotterWidget):
56
56
  def callback(self, state: bool) -> None:
57
57
  """Remove or add the screenshot widget actor upon click.
58
58
 
59
- Notes
60
- -----
61
- This method provides a callback function for the screenshot widget.
62
- It is called every time the screenshot widget is clicked.
63
-
64
59
  Parameters
65
60
  ----------
66
61
  state : bool
67
62
  Whether the state of the button, which is inherited from PyVista, is ``True``.
68
63
 
64
+
65
+ Notes
66
+ -----
67
+ This method provides a callback function for the screenshot widget.
68
+ It is called every time the screenshot widget is clicked.
69
69
  """
70
70
  self.plotter._pl.scene.screenshot("screenshot.png")
71
71
 
@@ -66,7 +66,7 @@ class Plotter():
66
66
  plottable_object: Any = None,
67
67
  screenshot: str = None,
68
68
  name_filter: bool = None,
69
- **plotting_options
69
+ **kwargs
70
70
  ) -> None:
71
71
  """Show the plotted objects.
72
72
 
@@ -78,12 +78,12 @@ class Plotter():
78
78
  Path to save a screenshot, by default None.
79
79
  name_filter : bool, optional
80
80
  Flag to filter the object, by default None.
81
- plotting_options : dict
82
- Additional plotting options the selected backend accepts.
81
+ kwargs : dict
82
+ Additional options the selected backend accepts.
83
83
  """
84
84
  self._backend.show(
85
85
  plottable_object=plottable_object,
86
86
  screenshot=screenshot,
87
87
  name_filter=name_filter,
88
- **plotting_options
88
+ **kwargs
89
89
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ansys-tools-visualization-interface
3
- Version: 0.9.2
3
+ Version: 0.11.0
4
4
  Summary: A Python visualization interface for PyAnsys libraries
5
5
  Author-email: "ANSYS, Inc." <pyansys.core@ansys.com>
6
6
  Maintainer-email: "ANSYS, Inc." <pyansys.core@ansys.com>
@@ -14,29 +14,32 @@ Classifier: Operating System :: OS Independent
14
14
  Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
17
18
  Requires-Dist: pyvista >= 0.43.0,<1
18
19
  Requires-Dist: websockets >= 12.0,< 16
19
20
  Requires-Dist: trame >= 3.6.0,<4
20
21
  Requires-Dist: trame-vtk >= 2.8.7,<3,!=2.8.16
21
22
  Requires-Dist: trame-vuetify >= 2.4.3,< 4
22
- Requires-Dist: ansys-sphinx-theme==1.3.2 ; extra == "doc"
23
+ Requires-Dist: pyvista==0.45.2 ; extra == "doc"
24
+ Requires-Dist: ansys-sphinx-theme==1.5.2 ; extra == "doc"
23
25
  Requires-Dist: jupyter_sphinx==0.5.3 ; extra == "doc"
24
- Requires-Dist: jupytext==1.16.7 ; extra == "doc"
26
+ Requires-Dist: jupytext==1.17.2 ; extra == "doc"
25
27
  Requires-Dist: nbsphinx==0.9.6 ; extra == "doc"
26
- Requires-Dist: numpydoc==1.8.0 ; extra == "doc"
28
+ Requires-Dist: numpydoc==1.9.0 ; extra == "doc"
27
29
  Requires-Dist: sphinx==8.2.3 ; extra == "doc"
28
30
  Requires-Dist: sphinx-autoapi==3.6.0 ; extra == "doc"
29
31
  Requires-Dist: sphinx-copybutton==0.5.2 ; extra == "doc"
30
32
  Requires-Dist: sphinx_design==0.6.1 ; extra == "doc"
31
33
  Requires-Dist: sphinx-gallery==0.19.0 ; extra == "doc"
32
34
  Requires-Dist: sphinx-jinja==2.0.2 ; extra == "doc"
33
- Requires-Dist: ansys-fluent-core==0.30.3 ; extra == "doc"
35
+ Requires-Dist: ansys-fluent-core==0.33.0 ; extra == "doc"
34
36
  Requires-Dist: pyside6 >= 6.8.0,<7 ; extra == "pyvistaqt"
35
37
  Requires-Dist: pyvistaqt >= 0.11.1,<1 ; extra == "pyvistaqt"
36
- Requires-Dist: pytest==8.3.5 ; extra == "tests"
38
+ Requires-Dist: pytest==8.4.1 ; extra == "tests"
39
+ Requires-Dist: pyvista==0.45.2 ; extra == "tests"
37
40
  Requires-Dist: pytest-pyvista==0.1.9 ; extra == "tests"
38
- Requires-Dist: pytest-cov==6.1.1 ; extra == "tests"
39
- Requires-Dist: pyside6==6.9.0 ; extra == "tests"
41
+ Requires-Dist: pytest-cov==6.2.1 ; extra == "tests"
42
+ Requires-Dist: pyside6==6.9.1 ; extra == "tests"
40
43
  Project-URL: Discussions, https://github.com/ansys/ansys-tools-visualization-interface/discussions
41
44
  Project-URL: Documentation, https://visualization-interface.tools.docs.pyansys.com/
42
45
  Project-URL: Issues, https://github.com/ansys/ansys-tools-visualization-interface/issues
@@ -1,21 +1,21 @@
1
1
  ansys/tools/visualization_interface/__init__.py,sha256=9xKdGyp63iNNgVipyeE6gEJ2CnB3OLEyZX_QYf4T8OU,2432
2
- ansys/tools/visualization_interface/plotter.py,sha256=Q2WCPzq5w5bz84cEeknSGUqILYsacNgg3vGUvuemSDM,3230
2
+ ansys/tools/visualization_interface/plotter.py,sha256=WIHP7qsxiXBT7qyr_aAugzgiQOMJj9owt-e8Jfwqprw,3191
3
3
  ansys/tools/visualization_interface/backends/__init__.py,sha256=QrhkJRa-r6kqBqdw7FVPE4eofL4RGC5FcWM20Pgjcr0,1180
4
4
  ansys/tools/visualization_interface/backends/_base.py,sha256=pR_uqDCngqpuPsoA5qPI4Ul8kPqB_nMGZTCIbcjPBBM,1871
5
5
  ansys/tools/visualization_interface/backends/pyvista/__init__.py,sha256=V7w7QRUGTxmyl4eW5uZeY-mBjrrz9cN-T8HeS2qOC3E,1320
6
- ansys/tools/visualization_interface/backends/pyvista/pyvista.py,sha256=YA2xc-bo3jndnghuAXJovI4IYt4NdVgePm-ZyPac0oU,25984
7
- ansys/tools/visualization_interface/backends/pyvista/pyvista_interface.py,sha256=H5h8aoamLhygHjOfLzxQlf_NTXxzdZDNzGBw5F2R34k,15629
6
+ ansys/tools/visualization_interface/backends/pyvista/pyvista.py,sha256=zHwVijwI7UKs6U3EMxmWa7LOTcfrlZhQNcNOflpKsUE,27239
7
+ ansys/tools/visualization_interface/backends/pyvista/pyvista_interface.py,sha256=V9p9SlLEAqyMNf35ZUm9csrsH3MV3JYOXsEMEnbEMLs,15832
8
8
  ansys/tools/visualization_interface/backends/pyvista/trame_local.py,sha256=6jIDMqJhZGUPru3ebfKflW9qIHOikUl5zrLGFsMCGP0,2996
9
9
  ansys/tools/visualization_interface/backends/pyvista/trame_remote.py,sha256=LxiVbwyvKoBiOX5wj_U4oZ7E-i-_gD3z7H2ZMC6UiSU,2834
10
10
  ansys/tools/visualization_interface/backends/pyvista/trame_service.py,sha256=eseK01KmnXherN-sMyv5XSmkLeD_7mPd32BFT97K3K0,5404
11
11
  ansys/tools/visualization_interface/backends/pyvista/widgets/__init__.py,sha256=gxGGvlW2dn3jASvH1KOhMXRH2WaY0bgXjsfuuVRX6gs,1339
12
- ansys/tools/visualization_interface/backends/pyvista/widgets/button.py,sha256=W1_EcyvAuDPEgw485Xch0q22gxg8P1RwtvLoQfWwLfI,3251
12
+ ansys/tools/visualization_interface/backends/pyvista/widgets/button.py,sha256=n4cMOTNi5Uu-nhpLMEEDrzUqUuja1wEcw9pvuSRrjRU,3250
13
13
  ansys/tools/visualization_interface/backends/pyvista/widgets/displace_arrows.py,sha256=xJy8UQmpgK6F6AZQmM7c5JOeAfQYhRwL_OO4VUFEReM,4337
14
14
  ansys/tools/visualization_interface/backends/pyvista/widgets/hide_buttons.py,sha256=78Kb_LRKMl7YgSGN2o4_fMyRYrSV70MEpGkt19Hv2k4,3934
15
15
  ansys/tools/visualization_interface/backends/pyvista/widgets/measure.py,sha256=6ilSFoJxnZOy0jVIEBo5Ca3BWLKp2_ImnJN4M6QR50Y,4266
16
16
  ansys/tools/visualization_interface/backends/pyvista/widgets/mesh_slider.py,sha256=jRbqDxeIREJlP5iLRzfqQjINBERVbtnlpMo1k4QYHdA,5155
17
- ansys/tools/visualization_interface/backends/pyvista/widgets/ruler.py,sha256=w6VsNw1ShwlWkb_hRMy2w1MBjrelRFNWwXesFA9Vmbs,3866
18
- ansys/tools/visualization_interface/backends/pyvista/widgets/screenshot.py,sha256=XeH8PZNsJPNju-8iFqElRevnutTLQK7M5CX3-4aa3vo,3375
17
+ ansys/tools/visualization_interface/backends/pyvista/widgets/ruler.py,sha256=E1H0_b-zbF6IAXZrXSQ_FQCt8EJIuYHgA66dXyAf9y0,3865
18
+ ansys/tools/visualization_interface/backends/pyvista/widgets/screenshot.py,sha256=ziZByCihKWG20Bwl5XESwYukviCvb36w-keRm_R0pxk,3375
19
19
  ansys/tools/visualization_interface/backends/pyvista/widgets/view_button.py,sha256=8QvWoTXcCrRMtn3X_-dFvjksypNWq7baIXDoGa-nTF0,3444
20
20
  ansys/tools/visualization_interface/backends/pyvista/widgets/widget.py,sha256=M15gpahjGoZaCKwES0Jcgua5-Y3jukwlw5hx46lvqU0,2311
21
21
  ansys/tools/visualization_interface/backends/pyvista/widgets/_images/+xy.png,sha256=aPjLBmnKYIBmp_FKdDSp9M-NQuxnJ_VyMxZ6dqd1j6c,499
@@ -59,7 +59,7 @@ ansys/tools/visualization_interface/utils/__init__.py,sha256=KMyCn7hV7fzhvMntMqH
59
59
  ansys/tools/visualization_interface/utils/clip_plane.py,sha256=Mbavan9rZu86hgoBunEwWfh6Ts2mQJUCzUw9jEifrDU,2911
60
60
  ansys/tools/visualization_interface/utils/color.py,sha256=OPOO87b4bE00aRR014ob__82_rllLKu86kI1hQGmxFc,1641
61
61
  ansys/tools/visualization_interface/utils/logger.py,sha256=SRw6fcjly5dabAn4xRLYoug3WBoGulX9znSopCv4jA4,3825
62
- ansys_tools_visualization_interface-0.9.2.dist-info/LICENSE,sha256=hG7YAylqSVoTbB2JgP7Euy_f2WZRx8zwJ_x4yMttDTg,1098
63
- ansys_tools_visualization_interface-0.9.2.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
64
- ansys_tools_visualization_interface-0.9.2.dist-info/METADATA,sha256=ng4zYYUgqF_D1zsT5xHmUh_jU6OY7oDhL6LVTyR4oxE,7260
65
- ansys_tools_visualization_interface-0.9.2.dist-info/RECORD,,
62
+ ansys_tools_visualization_interface-0.11.0.dist-info/LICENSE,sha256=hG7YAylqSVoTbB2JgP7Euy_f2WZRx8zwJ_x4yMttDTg,1098
63
+ ansys_tools_visualization_interface-0.11.0.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
64
+ ansys_tools_visualization_interface-0.11.0.dist-info/METADATA,sha256=zbYEjVuhOfr_dYd5xWjGJ9NYRS67YQgK2rJis6JbpT4,7410
65
+ ansys_tools_visualization_interface-0.11.0.dist-info/RECORD,,