Debian Codegraph @

pyvista/plotting/errors.py

raw
1 """Plotting errors."""
2
3 from __future__ import annotations
4
5 CAMERA_ERROR_MESSAGE = """Invalid camera description
6 Camera description must be one of the following:
7
8 Iterable containing position, focal_point, and view up. For example:
9 [(2.0, 5.0, 13.0), (0.0, 0.0, 0.0), (-0.7, -0.5, 0.3)]
10
11 Iterable containing a view vector. For example:
12 [-1.0, 2.0, -5.0]
13
14 A string containing the plane orthogonal to the view direction. For example:
15 'xy'
16 """
17
18
19 class InvalidCameraError(ValueError): # numpydoc ignore=PR01
20 """Exception when passed an invalid camera."""
21
22 def __init__(self, message=CAMERA_ERROR_MESSAGE):
23 """Call the base class constructor with the custom message."""
24 super().__init__(message)
25
26
27 class RenderWindowUnavailable(RuntimeError): # numpydoc ignore=PR01 # noqa: N818
28 """Exception when the render window is not available."""
29
30 def __init__(self, message='Render window is not available.'):
31 """Call the base class constructor with the custom message."""
32 super().__init__(message)
33
34
35 class MismatchedInteractorError(RuntimeError): # numpydoc ignore=PR01 # pragma: no cover
36 """Exception when the interactor and render window backends are incompatible."""
37
38 def __init__(self, message='Interactor and render window backends are incompatible.'):
39 """Call the base class constructor with the custom message."""
40 super().__init__(message)
41
42
43 class PyVistaPickingError(RuntimeError):
44 """General picking error class."""