mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Support PDF-export from Python
This commit is contained in:
@@ -68,7 +68,8 @@ void RicSnapshotAllPlotsToFileFeature::saveAllPlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QString& snapshotFolderName,
|
||||
const QString& prefix,
|
||||
int viewId )
|
||||
int viewId,
|
||||
const QString& preferredFileSuffix /*=".png"*/ )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
@@ -98,7 +99,7 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QS
|
||||
|
||||
fileName.replace( " ", "_" );
|
||||
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName( absSnapshotPath, fileName, ".png" );
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName( absSnapshotPath, fileName, preferredFileSuffix );
|
||||
|
||||
RicSnapshotViewToFileFeature::saveSnapshotAs( absoluteFileName, viewWindow );
|
||||
}
|
||||
|
||||
@@ -33,8 +33,9 @@ public:
|
||||
static void saveAllPlots();
|
||||
|
||||
static void exportSnapshotOfPlotsIntoFolder( const QString& snapshotFolderName,
|
||||
const QString& prefix = "",
|
||||
int viewId = -1 );
|
||||
const QString& prefix = "",
|
||||
int viewId = -1,
|
||||
const QString& preferredFileSuffix = ".png" );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
||||
@@ -50,7 +50,12 @@ CAF_CMD_SOURCE_INIT( RicSnapshotViewToFileFeature, "RicSnapshotViewToFileFeature
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSnapshotViewToFileFeature::saveSnapshotAs( const QString& fileName, RimViewWindow* viewWindow )
|
||||
{
|
||||
if ( viewWindow )
|
||||
RimPlotWindow* plotWindow = dynamic_cast<RimPlotWindow*>( viewWindow );
|
||||
if ( plotWindow && fileName.endsWith( ".pdf" ) )
|
||||
{
|
||||
savePlotPDFReportAs( fileName, plotWindow );
|
||||
}
|
||||
else if ( viewWindow )
|
||||
{
|
||||
QImage image = viewWindow->snapshotWindowContent();
|
||||
saveSnapshotAs( fileName, image );
|
||||
|
||||
Reference in New Issue
Block a user