#5632 Python method commands (#5649)

* General PdmObjectMethods for scripting.
This commit is contained in:
Gaute Lindkvist
2020-03-10 14:11:22 +01:00
committed by GitHub
parent 587478cbd1
commit c51aa91c42
145 changed files with 2646 additions and 1587 deletions

View File

@@ -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() )

View File

@@ -32,7 +32,7 @@ class RicSaveProjectAsFeature : public caf::CmdFeature, public RicfCommandObject
public:
RicSaveProjectAsFeature();
RicfCommandResponse execute() override;
caf::PdmScriptResponse execute() override;
protected:
// Overrides

View File

@@ -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() )

View File

@@ -32,7 +32,7 @@ class RicSaveProjectFeature : public caf::CmdFeature, public RicfCommandObject
public:
RicSaveProjectFeature();
RicfCommandResponse execute() override;
caf::PdmScriptResponse execute() override;
protected:
// Overrides