mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
#14772 Python: Add snapshot export object methods and forward exportSnapshots to them
- Add RimViewWindow_exportSnapshot on RimViewWindow (3D views and plots) with explicit ExportFolder, Prefix, Width, Height and FileFormat parameters. Generated as ViewWindow.export_snapshot(). - Add RimProject_exportSnapshots for exporting all views and/or plots with a ContentType parameter. Generated as Project.export_snapshots(). - Add RiaDefines::SnapshotFileFormat and SnapshotContentType enums, registered as Python StrEnums. - Extract single-item exportSnapshotOfView()/exportSnapshotOfPlot() from the RicSnapshotAll*ToFileFeature loops so the object methods and the legacy loops share the implementation. - RicfExportSnapshots resolves the export folder from the command file executor and forwards to the object methods. Python: the hand-written ViewWindow.export_snapshot() wrapper is removed (generated method is compatible). PlotWindow.export_snapshot() and Project.export_snapshots() keep their legacy argument names (file_prefix, output_format, snapshot_type, plot_format) as deprecated aliases. Case.export_snapshots_of_all_views() is deprecated in favor of View.export_snapshot(). Also fix Case.views(), which compared the view id to the case id and therefore never returned any views.
This commit is contained in:
1 parent
ee28576c48
commit
77c32a3fa5
17 files changed
+711
-170
No files matched your search
@@ -222,25 +222,3 @@ def visible_cells(self, time_step=0):
|
||||
finally:
|
||||
# Clean up temporary key from key-value store
|
||||
project.remove_key_values(visibility_key)
|
||||
|
||||
|
||||
@add_method(ViewWindow)
|
||||
def export_snapshot(self, prefix="", export_folder="", width=-1, height=-1):
|
||||
"""Export snapshot for the current view
|
||||
|
||||
Arguments:
|
||||
prefix (str): Exported file name prefix
|
||||
export_folder(str): The path to export to. By default will use the global export folder
|
||||
"""
|
||||
case_id = self.case().id
|
||||
return self._execute_command(
|
||||
exportSnapshots=Cmd.ExportSnapshotsRequest(
|
||||
type="VIEWS",
|
||||
prefix=prefix,
|
||||
caseId=case_id,
|
||||
viewId=self.id,
|
||||
exportFolder=export_folder,
|
||||
width=width,
|
||||
height=height,
|
||||
)
|
||||
)
|
||||
Reference in new issue
Block a user