2019-10-09 09:21:28 +02:00
|
|
|
"""
|
|
|
|
|
ResInsight 2d plot module
|
|
|
|
|
"""
|
2024-01-26 07:38:10 +00:00
|
|
|
|
2026-09-16 15:30:34 +02:00
|
|
|
import warnings
|
2019-10-09 09:21:28 +02:00
|
|
|
|
2021-01-21 10:45:37 +01:00
|
|
|
from .pdmobject import add_method
|
2026-09-16 15:30:34 +02:00
|
|
|
from .resinsight_classes import (
|
|
|
|
|
PlotWindow as PlotWindow,
|
|
|
|
|
Plot as Plot,
|
|
|
|
|
SnapshotFileFormat,
|
|
|
|
|
)
|
2019-10-09 09:21:28 +02:00
|
|
|
|
2020-04-16 16:06:18 +02:00
|
|
|
|
2020-02-21 12:10:02 +01:00
|
|
|
@add_method(PlotWindow)
|
2026-06-09 17:55:28 +02:00
|
|
|
def export_snapshot(
|
2026-09-16 15:30:34 +02:00
|
|
|
self,
|
|
|
|
|
export_folder="",
|
|
|
|
|
file_prefix="",
|
|
|
|
|
output_format="PNG",
|
|
|
|
|
width=-1,
|
|
|
|
|
height=-1,
|
|
|
|
|
prefix=None,
|
|
|
|
|
file_format=None,
|
2026-06-09 17:55:28 +02:00
|
|
|
):
|
2021-01-26 20:48:01 +01:00
|
|
|
"""Export snapshot for the current plot
|
2020-04-16 16:06:18 +02:00
|
|
|
|
2020-02-21 12:10:02 +01:00
|
|
|
Arguments:
|
2026-09-16 15:30:34 +02:00
|
|
|
export_folder(str): The path to export to. By default will use the 'snapshots' folder next to the project file.
|
|
|
|
|
file_prefix (str): Deprecated, use prefix. Exported file name prefix
|
|
|
|
|
output_format(str): Deprecated, use file_format. Enum string. Can be 'PNG' or 'PDF'.
|
2026-06-09 01:12:48 +02:00
|
|
|
width (int): The width of the exported snapshot. By default will use the existing size.
|
|
|
|
|
height (int): The height of the exported snapshot. By default will use the existing size.
|
2026-09-16 15:30:34 +02:00
|
|
|
prefix (str): Exported file name prefix
|
|
|
|
|
file_format (SnapshotFileFormat): 'PNG' or 'PDF'
|
2020-04-16 16:06:18 +02:00
|
|
|
|
2020-02-21 12:10:02 +01:00
|
|
|
"""
|
2026-09-16 15:30:34 +02:00
|
|
|
if file_prefix:
|
|
|
|
|
warnings.warn(
|
|
|
|
|
"PlotWindow.export_snapshot(file_prefix=...) is deprecated, use prefix=...",
|
|
|
|
|
DeprecationWarning,
|
|
|
|
|
stacklevel=3,
|
2021-01-26 20:48:01 +01:00
|
|
|
)
|
2026-09-16 15:30:34 +02:00
|
|
|
if output_format != "PNG":
|
|
|
|
|
warnings.warn(
|
|
|
|
|
"PlotWindow.export_snapshot(output_format=...) is deprecated, use file_format=...",
|
|
|
|
|
DeprecationWarning,
|
|
|
|
|
stacklevel=3,
|
|
|
|
|
)
|
|
|
|
|
if prefix is None:
|
|
|
|
|
prefix = file_prefix
|
|
|
|
|
if file_format is None:
|
|
|
|
|
file_format = SnapshotFileFormat(output_format)
|
|
|
|
|
|
|
|
|
|
self._call_pdm_method_void(
|
|
|
|
|
"exportSnapshot",
|
|
|
|
|
export_folder=export_folder,
|
|
|
|
|
prefix=prefix,
|
|
|
|
|
width=width,
|
|
|
|
|
height=height,
|
|
|
|
|
file_format=file_format,
|
2021-01-26 20:48:01 +01:00
|
|
|
)
|