#4736 System python command refactor (#4743)

* Move case loading commands from Commands to project and case
* Major refactor
* Fix problems with Python examples
* Add ability to export snapshot from just one view + fixup
* Case comments and black
* Make all modules pass pylint test
This commit is contained in:
Gaute Lindkvist
2019-09-23 11:50:33 +02:00
committed by GitHub
parent 00eb02ccec
commit a2bad82391
54 changed files with 1753 additions and 1432 deletions

View File

@@ -48,6 +48,7 @@ CAF_PDM_SOURCE_INIT( RicfExportPropertyInViews, "exportPropertyInViews" );
RicfExportPropertyInViews::RicfExportPropertyInViews()
{
RICF_InitField( &m_caseId, "caseId", -1, "Case ID", "", "", "" );
RICF_InitField( &m_viewIds, "viewIds", std::vector<int>(), "View IDs", "", "", "" );
RICF_InitField( &m_viewNames, "viewNames", std::vector<QString>(), "View Names", "", "", "" );
RICF_InitField( &m_undefinedValue, "undefinedValue", 0.0, "Undefined Value", "", "", "" );
}
@@ -74,22 +75,35 @@ RicfCommandResponse RicfExportPropertyInViews::execute()
RimEclipseView* view = dynamic_cast<RimEclipseView*>( v );
if ( !view ) continue;
if ( m_viewNames().empty() )
if ( m_viewNames().empty() && m_viewIds().empty() )
{
viewsForExport.push_back( view );
}
else
{
bool matchingName = false;
for ( const auto& viewName : m_viewNames() )
bool matchingIdOrName = false;
for ( auto viewId : m_viewIds() )
{
if ( view->name().compare( viewName, Qt::CaseInsensitive ) == 0 )
if ( view->id() == viewId )
{
matchingName = true;
matchingIdOrName = true;
break;
}
}
if ( matchingName )
if ( !matchingIdOrName )
{
for ( const auto& viewName : m_viewNames() )
{
if ( view->name().compare( viewName, Qt::CaseInsensitive ) == 0 )
{
matchingIdOrName = true;
}
}
}
if ( matchingIdOrName )
{
viewsForExport.push_back( view );
}