mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Simplify "New ... script" enable logic.
This commit is contained in:
parent
ed392e6300
commit
fa1f189709
@ -45,17 +45,9 @@ CAF_CMD_SOURCE_INIT( RicNewOctaveScriptFeature, "RicNewOctaveScriptFeature" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewOctaveScriptFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimCalcScript*> calcScripts = RicScriptFeatureImpl::selectedScripts();
|
||||
std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections();
|
||||
if ( calcScripts.size() == 1u && calcScripts.front()->scriptType() == RimCalcScript::OCTAVE )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ( calcScriptCollections.size() == 1u && !calcScriptCollections.front()->directory().isEmpty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if ( calcScriptCollections.empty() ) return false;
|
||||
return !calcScriptCollections.front()->directory().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -46,17 +46,9 @@ CAF_CMD_SOURCE_INIT( RicNewPythonScriptFeature, "RicNewPythonScriptFeature" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewPythonScriptFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimCalcScript*> calcScripts = RicScriptFeatureImpl::selectedScripts();
|
||||
std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections();
|
||||
if ( calcScripts.size() == 1u && calcScripts.front()->scriptType() == RimCalcScript::PYTHON )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ( calcScriptCollections.size() == 1u && !calcScriptCollections.front()->directory().isEmpty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if ( calcScriptCollections.empty() ) return false;
|
||||
return !calcScriptCollections.front()->directory().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user