mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Allow Python scripts to use currently selected cases (#6906)
* #6891 Python : Make sure python scripts can be launched from context menu * #6891 Python : Make currentScriptCaseId a general scripting feature
This commit is contained in:
@@ -29,16 +29,26 @@ using namespace rips;
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Status RiaGrpcProjectService::GetCurrentCase( ServerContext* context, const rips::Empty* request, rips::CaseRequest* reply )
|
||||
{
|
||||
RimGridView* view = RiaApplication::instance()->activeGridView();
|
||||
if ( view )
|
||||
int scriptCaseId = RiaApplication::instance()->currentScriptCaseId();
|
||||
if ( scriptCaseId != -1 )
|
||||
{
|
||||
RimCase* currentCase = view->ownerCase();
|
||||
if ( currentCase )
|
||||
reply->set_id( scriptCaseId );
|
||||
return Status::OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
RimGridView* view = RiaApplication::instance()->activeGridView();
|
||||
if ( view )
|
||||
{
|
||||
reply->set_id( currentCase->caseId() );
|
||||
return Status::OK;
|
||||
RimCase* currentCase = view->ownerCase();
|
||||
if ( currentCase )
|
||||
{
|
||||
reply->set_id( currentCase->caseId() );
|
||||
return Status::OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Status( grpc::NOT_FOUND, "No current case found" );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user