mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
* General PdmObjectMethods for scripting.
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
#include "RicSaveProjectFeature.h"
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
|
||||
@@ -33,21 +35,21 @@ RICF_SOURCE_INIT( RicSaveProjectAsFeature, "RicSaveProjectAsFeature", "saveProje
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicSaveProjectAsFeature::RicSaveProjectAsFeature()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_filePath, "filePath", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_filePath, "filePath", "", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicSaveProjectAsFeature::execute()
|
||||
caf::PdmScriptResponse RicSaveProjectAsFeature::execute()
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
QString errorMessage;
|
||||
if ( !RiaApplication::instance()->saveProjectAs( m_filePath(), &errorMessage ) )
|
||||
{
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -73,7 +75,7 @@ void RicSaveProjectAsFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
auto response = execute();
|
||||
|
||||
if ( response.status() != RicfCommandResponse::COMMAND_OK )
|
||||
if ( response.status() != caf::PdmScriptResponse::COMMAND_OK )
|
||||
{
|
||||
QString displayMessage = response.messages().join( "\n" );
|
||||
if ( RiaGuiApplication::isRunning() )
|
||||
|
||||
@@ -32,7 +32,7 @@ class RicSaveProjectAsFeature : public caf::CmdFeature, public RicfCommandObject
|
||||
|
||||
public:
|
||||
RicSaveProjectAsFeature();
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
||||
@@ -38,7 +38,7 @@ RicSaveProjectFeature::RicSaveProjectFeature()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicSaveProjectFeature::execute()
|
||||
caf::PdmScriptResponse RicSaveProjectFeature::execute()
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
@@ -55,10 +55,10 @@ RicfCommandResponse RicSaveProjectFeature::execute()
|
||||
|
||||
if ( !worked )
|
||||
{
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
|
||||
return RicfCommandResponse();
|
||||
return caf::PdmScriptResponse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -88,7 +88,7 @@ void RicSaveProjectFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
|
||||
auto response = execute();
|
||||
if ( response.status() != RicfCommandResponse::COMMAND_OK )
|
||||
if ( response.status() != caf::PdmScriptResponse::COMMAND_OK )
|
||||
{
|
||||
QString displayMessage = response.messages().join( "\n" );
|
||||
if ( RiaGuiApplication::isRunning() )
|
||||
|
||||
@@ -32,7 +32,7 @@ class RicSaveProjectFeature : public caf::CmdFeature, public RicfCommandObject
|
||||
|
||||
public:
|
||||
RicSaveProjectFeature();
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
||||
Reference in New Issue
Block a user