mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-26 21:27:15 -05:00
Some cleanup
This commit is contained in:
@@ -1854,9 +1854,11 @@ bool RiaGuiApplication::notify( QObject* receiver, QEvent* event )
|
||||
{
|
||||
if ( activeWindow() != mainWindow() )
|
||||
{
|
||||
QWheelEvent* wheelEvent = static_cast<QWheelEvent*>( event );
|
||||
RimPlotWindow* plot = dynamic_cast<RimPlotWindow*>( activePlotWindow() );
|
||||
if ( plot ) done = plot->handleGlobalWheelEvent( wheelEvent );
|
||||
QWheelEvent* wheelEvent = static_cast<QWheelEvent*>( event );
|
||||
if ( RimPlotWindow* plot = dynamic_cast<RimPlotWindow*>( activePlotWindow() ) )
|
||||
{
|
||||
done = plot->handleGlobalWheelEvent( wheelEvent );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !done )
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfSetMainWindowSize, "setMainWindowSize" );
|
||||
@@ -41,6 +39,7 @@ RicfSetMainWindowSize::RicfSetMainWindowSize()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmScriptResponse RicfSetMainWindowSize::execute()
|
||||
{
|
||||
RiaLogging::warning( "Method set_main_window_size has been obsoleted. Set size of image snapshots directly in the snapshot methods." );
|
||||
return caf::PdmScriptResponse();
|
||||
RiaLogging::warning( "Method set_main_window_size has been obsoleted. Set image sizes directly in the snapshot methods." );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_WARNING,
|
||||
"Obsolete command. Set image sizes directly in the snapshot methods." );
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
|
||||
#include "RicfSetPlotWindowSize.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
|
||||
@@ -39,11 +38,7 @@ RicfSetPlotWindowSize::RicfSetPlotWindowSize()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmScriptResponse RicfSetPlotWindowSize::execute()
|
||||
{
|
||||
RiaGuiApplication* guiApp = RiaGuiApplication::instance();
|
||||
if ( guiApp )
|
||||
{
|
||||
guiApp->getOrCreateAndShowMainPlotWindow()->resize( m_width, m_height );
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, "Need GUI ResInsight to set plot window size" );
|
||||
RiaLogging::warning( "Method set_plot_window_size has been obsoleted. Set image sizes directly in the snapshot methods." );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_WARNING,
|
||||
"Obsolete command. Set image sizes directly in the snapshot methods." );
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ void RicSnapshotAllViewsToFileFeature::saveAllViews()
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Export snapshots of a given view (or viewId == -1 for all views) for the given case (or caseId == -1 for all cases)
|
||||
/// -1 for width and height means to use the existing view size
|
||||
/// <= 0 for width and height means to use the existing view size
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( const QString& snapshotFolderName,
|
||||
int width,
|
||||
|
||||
@@ -500,8 +500,6 @@ void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOr
|
||||
m_annotationCountHint.uiCapability()->setUiReadOnly(
|
||||
!m_useCustomAnnotationStrategy || ( m_annotationStrategy() != RivAnnotationTools::LabelPositionStrategy::COUNT_HINT ) );
|
||||
|
||||
uiOrdering.add( &m_dockWindowId );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "cafPdmUiToolButtonEditor.h"
|
||||
|
||||
#include <QPaintDevice>
|
||||
#include <QPainter>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <cvfAssert.h>
|
||||
@@ -651,7 +650,7 @@ QImage RimMultiPlot::captureSnapshot( int width, int height )
|
||||
|
||||
QSize orgViewSize = m_viewer->size();
|
||||
|
||||
image = RimViewWindow::captureSnapshot( m_viewer->bookWidget(), width, height );
|
||||
image = RimViewWindow::internalCaptureSnapshot( m_viewer->bookWidget(), width, height );
|
||||
|
||||
m_viewer->resize( orgViewSize );
|
||||
doUpdateLayout();
|
||||
|
||||
@@ -196,8 +196,7 @@ void RimPlot::doRenderWindowContent( QPaintDevice* paintDevice )
|
||||
{
|
||||
if ( plotWidget() )
|
||||
{
|
||||
auto rect = plotWidget()->frameGeometry();
|
||||
plotWidget()->renderTo( paintDevice, rect );
|
||||
plotWidget()->renderTo( paintDevice, plotWidget()->frameGeometry() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ RimViewWindow::RimViewWindow()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewWindow::~RimViewWindow()
|
||||
{
|
||||
if ( m_windowController ) delete m_windowController;
|
||||
if ( m_windowController() ) delete m_windowController();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -234,13 +234,13 @@ QImage RimViewWindow::snapshotWindowContent()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimViewWindow::captureSnapshot( int width, int height )
|
||||
{
|
||||
return captureSnapshot( viewWidget(), width, height );
|
||||
return internalCaptureSnapshot( viewWidget(), width, height );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimViewWindow::captureSnapshot( QWidget* widget, int width, int height )
|
||||
QImage RimViewWindow::internalCaptureSnapshot( QWidget* widget, int width, int height )
|
||||
{
|
||||
if ( !widget ) return QImage();
|
||||
|
||||
@@ -400,7 +400,7 @@ void RimViewWindow::defineObjectEditorAttribute( QString uiConfigName, caf::PdmU
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
ads::CDockWidget* RimViewWindow::dockWidget()
|
||||
ads::CDockWidget* RimViewWindow::dockWidget() const
|
||||
{
|
||||
return m_dockWidget;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
|
||||
virtual QWidget* viewWidget() = 0;
|
||||
|
||||
ads::CDockWidget* dockWidget();
|
||||
ads::CDockWidget* dockWidget() const;
|
||||
ads::CDockWidget* createDockWidget();
|
||||
|
||||
virtual QImage captureSnapshot( int width, int height );
|
||||
@@ -103,7 +103,7 @@ protected:
|
||||
|
||||
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
QImage captureSnapshot( QWidget* widget, int width, int height );
|
||||
static QImage internalCaptureSnapshot( QWidget* widget, int width, int height );
|
||||
|
||||
private:
|
||||
friend class RimProject;
|
||||
|
||||
@@ -327,14 +327,6 @@ QString RiuDockWidgetTools::dockStateHideAll3DWindowName()
|
||||
return "Hide All";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuDockWidgetTools::viewWindowPrefix()
|
||||
{
|
||||
return "DockViewWindow_";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -91,8 +91,6 @@ public:
|
||||
static QString dockStateHideAllPlotWindowName();
|
||||
static QString dockStateHideAll3DWindowName();
|
||||
|
||||
static QString viewWindowPrefix();
|
||||
|
||||
static void setDockLayout( RiuMainWindowBase* mainWindow, const QString& layoutName );
|
||||
|
||||
static QAction* toggleActionForWidget( const ads::CDockManager* dockManager, const QString& dockWidgetName );
|
||||
|
||||
@@ -9,9 +9,6 @@ import rips
|
||||
resinsight = rips.Instance.find()
|
||||
cases = resinsight.project.cases()
|
||||
|
||||
# Set main window size
|
||||
# resinsight.set_main_window_size(width=1280, height=900)
|
||||
|
||||
n = 5 # every n-th time_step for snapshot
|
||||
property_list = ["SOIL", "PRESSURE"] # list of parameter for snapshot
|
||||
|
||||
|
||||
+2
-8
@@ -1,5 +1,5 @@
|
||||
###############################################################################
|
||||
# This example will show setting time step, window size and export snapshots and properties
|
||||
# This example will show setting time step and export snapshots and properties
|
||||
###############################################################################
|
||||
import os
|
||||
import tempfile
|
||||
@@ -8,11 +8,6 @@ import rips
|
||||
# Load instance
|
||||
resinsight = rips.Instance.find()
|
||||
|
||||
# Set window sizes
|
||||
resinsight.set_main_window_size(width=800, height=500)
|
||||
resinsight.set_plot_window_size(width=1000, height=1000)
|
||||
|
||||
|
||||
# Retrieve first case
|
||||
case = resinsight.project.cases()[0]
|
||||
|
||||
@@ -30,7 +25,6 @@ view1.apply_cell_result(
|
||||
result_type=rips.PropertyType.DYNAMIC_NATIVE, result_variable="SOIL"
|
||||
)
|
||||
|
||||
|
||||
# Create a temporary directory which will disappear at the end of this script
|
||||
# If you want to keep the files, provide a good path name instead of tmpdirname
|
||||
with tempfile.TemporaryDirectory(prefix="rips") as tmpdirname:
|
||||
@@ -41,7 +35,7 @@ with tempfile.TemporaryDirectory(prefix="rips") as tmpdirname:
|
||||
resinsight.set_export_folder(export_type="PROPERTIES", path=tmpdirname)
|
||||
|
||||
# Export all snapshots
|
||||
resinsight.project.export_snapshots()
|
||||
resinsight.project.export_snapshots(width=1024, height=768)
|
||||
|
||||
assert len(os.listdir(tmpdirname)) > 0
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ def export_multi_case_snapshots(self, grid_list_file):
|
||||
|
||||
|
||||
@add_method(Project)
|
||||
def export_snapshots(self, snapshot_type="ALL", prefix="", plot_format="PNG"):
|
||||
def export_snapshots(self, snapshot_type="ALL", prefix="", plot_format="PNG", width=-1, height=-1):
|
||||
"""Export all snapshots of a given type
|
||||
|
||||
Arguments:
|
||||
@@ -298,6 +298,8 @@ def export_snapshots(self, snapshot_type="ALL", prefix="", plot_format="PNG"):
|
||||
caseId=-1,
|
||||
viewId=-1,
|
||||
plotOutputFormat=plot_format,
|
||||
width=width,
|
||||
height=height
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user