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:
@@ -31,6 +31,8 @@
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
@@ -62,11 +64,11 @@ RICF_SOURCE_INIT( RicImportWellPaths, "RicWellPathsImportFileFeature", "importWe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicImportWellPaths::RicImportWellPaths()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_wellPathFolder, "wellPathFolder", "", "", "", "" );
|
||||
RICF_InitFieldNoDefault( &m_wellPathFiles, "wellPathFiles", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_wellPathFolder, "wellPathFolder", "", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_wellPathFiles, "wellPathFiles", "", "", "", "" );
|
||||
}
|
||||
|
||||
RicfCommandResponse RicImportWellPaths::execute()
|
||||
caf::PdmScriptResponse RicImportWellPaths::execute()
|
||||
{
|
||||
QStringList errorMessages, warningMessages;
|
||||
QStringList wellPathFiles;
|
||||
@@ -115,7 +117,7 @@ RicfCommandResponse RicImportWellPaths::execute()
|
||||
}
|
||||
}
|
||||
|
||||
RicfCommandResponse response;
|
||||
caf::PdmScriptResponse response;
|
||||
if ( !wellPathFiles.empty() )
|
||||
{
|
||||
std::vector<RimWellPath*> importedWellPaths = importWellPaths( wellPathFiles, &warningMessages );
|
||||
@@ -137,12 +139,12 @@ RicfCommandResponse RicImportWellPaths::execute()
|
||||
|
||||
for ( QString warningMessage : warningMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warningMessage );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_WARNING, warningMessage );
|
||||
}
|
||||
|
||||
for ( QString errorMessage : errorMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
response.updateStatus( caf::PdmScriptResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
|
||||
return response;
|
||||
@@ -219,9 +221,9 @@ void RicImportWellPaths::onActionTriggered( bool isChecked )
|
||||
|
||||
if ( wellPathFilePaths.size() >= 1 )
|
||||
{
|
||||
m_wellPathFiles.v() = std::vector<QString>( wellPathFilePaths.begin(), wellPathFilePaths.end() );
|
||||
RicfCommandResponse response = execute();
|
||||
QStringList messages = response.messages();
|
||||
m_wellPathFiles.v() = std::vector<QString>( wellPathFilePaths.begin(), wellPathFilePaths.end() );
|
||||
caf::PdmScriptResponse response = execute();
|
||||
QStringList messages = response.messages();
|
||||
|
||||
if ( !messages.empty() )
|
||||
{
|
||||
@@ -231,7 +233,7 @@ void RicImportWellPaths::onActionTriggered( bool isChecked )
|
||||
{
|
||||
QMessageBox::warning( Riu3DMainWindowTools::mainWindowWidget(), "Well Path Loading", displayMessage );
|
||||
}
|
||||
if ( response.status() == RicfCommandResponse::COMMAND_ERROR )
|
||||
if ( response.status() == caf::PdmScriptResponse::COMMAND_ERROR )
|
||||
{
|
||||
RiaLogging::error( displayMessage );
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class RicImportWellPaths : public caf::CmdFeature, public RicfCommandObject
|
||||
|
||||
public:
|
||||
RicImportWellPaths();
|
||||
RicfCommandResponse execute() override;
|
||||
caf::PdmScriptResponse execute() override;
|
||||
|
||||
protected:
|
||||
static std::vector<RimWellPath*> importWellPaths( const QStringList& wellPathFilePaths, QStringList* errorMessages );
|
||||
|
||||
Reference in New Issue
Block a user