ansys-tools-visualization-interface 0.10.0__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,8 +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: Optional[Dict[str, Any]] = {},
416
- **show_options: Dict[str, Any],
441
+ **kwargs: Dict[str, Any],
417
442
  ) -> List[Any]:
418
443
  """Plot and show any PyAnsys object.
419
444
 
@@ -432,11 +457,8 @@ class PyVistaBackendInterface(BaseBackend):
432
457
  Regular expression with the desired name or names to include in the plotter.
433
458
  dark_mode : bool, default: False
434
459
  Whether to use dark mode for the widgets.
435
- plotting_options : dict, default: None
436
- Keyword arguments. For allowable keyword arguments, see the
437
- :meth:`Plotter.add_mesh <pyvista.Plotter.add_mesh>` method.
438
- **show_options : Any
439
- Additional keyword arguments for the show method.
460
+ **kwargs : Any
461
+ Additional keyword arguments for the show or plot method.
440
462
 
441
463
  Returns
442
464
  -------
@@ -444,6 +466,14 @@ class PyVistaBackendInterface(BaseBackend):
444
466
  List with the picked bodies in the picked order.
445
467
 
446
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
+ )
447
477
  self.plot(plottable_object, name_filter, **plotting_options)
448
478
  if self._pl.object_to_actors_map:
449
479
  self._object_to_actors_map = self._pl.object_to_actors_map
@@ -479,6 +509,8 @@ class PyVistaBackendInterface(BaseBackend):
479
509
  # Update all buttons/widgets
480
510
  [widget.update() for widget in self._widgets]
481
511
 
512
+ # Remove screenshot from show options since we pass it manually
513
+ show_options.pop("screenshot", None)
482
514
  self.show_plotter(screenshot, **show_options)
483
515
 
484
516
  picked_objects_list = []
@@ -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:
@@ -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.10.0
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>
@@ -21,21 +21,21 @@ Requires-Dist: trame >= 3.6.0,<4
21
21
  Requires-Dist: trame-vtk >= 2.8.7,<3,!=2.8.16
22
22
  Requires-Dist: trame-vuetify >= 2.4.3,< 4
23
23
  Requires-Dist: pyvista==0.45.2 ; extra == "doc"
24
- Requires-Dist: ansys-sphinx-theme==1.3.2 ; extra == "doc"
24
+ Requires-Dist: ansys-sphinx-theme==1.5.2 ; extra == "doc"
25
25
  Requires-Dist: jupyter_sphinx==0.5.3 ; extra == "doc"
26
26
  Requires-Dist: jupytext==1.17.2 ; extra == "doc"
27
27
  Requires-Dist: nbsphinx==0.9.6 ; extra == "doc"
28
- Requires-Dist: numpydoc==1.8.0 ; extra == "doc"
28
+ Requires-Dist: numpydoc==1.9.0 ; extra == "doc"
29
29
  Requires-Dist: sphinx==8.2.3 ; extra == "doc"
30
30
  Requires-Dist: sphinx-autoapi==3.6.0 ; extra == "doc"
31
31
  Requires-Dist: sphinx-copybutton==0.5.2 ; extra == "doc"
32
32
  Requires-Dist: sphinx_design==0.6.1 ; extra == "doc"
33
33
  Requires-Dist: sphinx-gallery==0.19.0 ; extra == "doc"
34
34
  Requires-Dist: sphinx-jinja==2.0.2 ; extra == "doc"
35
- Requires-Dist: ansys-fluent-core==0.32.1 ; extra == "doc"
35
+ Requires-Dist: ansys-fluent-core==0.33.0 ; extra == "doc"
36
36
  Requires-Dist: pyside6 >= 6.8.0,<7 ; extra == "pyvistaqt"
37
37
  Requires-Dist: pyvistaqt >= 0.11.1,<1 ; extra == "pyvistaqt"
38
- Requires-Dist: pytest==8.4.0 ; extra == "tests"
38
+ Requires-Dist: pytest==8.4.1 ; extra == "tests"
39
39
  Requires-Dist: pyvista==0.45.2 ; extra == "tests"
40
40
  Requires-Dist: pytest-pyvista==0.1.9 ; extra == "tests"
41
41
  Requires-Dist: pytest-cov==6.2.1 ; extra == "tests"
@@ -1,10 +1,10 @@
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=vQQFR-bK2bXAziBTPk8dm75I1EfH6h_YrJTxnvTPs08,26049
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
@@ -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.10.0.dist-info/LICENSE,sha256=hG7YAylqSVoTbB2JgP7Euy_f2WZRx8zwJ_x4yMttDTg,1098
63
- ansys_tools_visualization_interface-0.10.0.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
64
- ansys_tools_visualization_interface-0.10.0.dist-info/METADATA,sha256=3X3IxtG0mr3vuWyvHZK5gEVhn634aDnv4tPvdlMmDDU,7410
65
- ansys_tools_visualization_interface-0.10.0.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,,