From 944697806c6158c372f7382ebcb8d118320f7dd1 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 15 Jun 2020 11:48:50 +0300 Subject: [PATCH] Automatically activate SHAPER when dumping study from opened HDF file --- src/CAM/CAM_Application.cxx | 3 +-- src/SalomeApp/SalomeApp_Application.cxx | 19 +++++++++++++++++++ src/SalomeApp/SalomeApp_Application.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/CAM/CAM_Application.cxx b/src/CAM/CAM_Application.cxx index fd2b0b948..ae731cee5 100644 --- a/src/CAM/CAM_Application.cxx +++ b/src/CAM/CAM_Application.cxx @@ -101,7 +101,6 @@ CAM_Application::CAM_Application( const bool autoLoad ) myAutoLoad( autoLoad ), myBlocked( false ) { - setProperty("activateModule", false); readModuleList(); } @@ -426,7 +425,7 @@ bool CAM_Application::activateModule( const QString& modName ) if ( mod ) res = activateModule( mod ); - setProperty("activateModule", false); + setProperty("activateModule", QVariant()); } else res = activateModule( 0 ); diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 94c952df3..7204f3f74 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -966,6 +966,7 @@ void SalomeApp_Application::onDumpStudy( ) bool res; { SUIT_OverrideCursor wc; + ensureShaperIsActivated(); res = appStudy->dump( aFileName, toPublish, isMultiFile, toSaveGUI ); } if ( !res ) @@ -2113,3 +2114,21 @@ PyConsole_Interp* SalomeApp_Application::createPyInterp() } #endif // DISABLE_PYCONSOLE + +void SalomeApp_Application::ensureShaperIsActivated() +{ + SalomeApp_Study* study = dynamic_cast(activeStudy()); + _PTR(Study) studyDS = getStudy(); + if ( study && studyDS ) + { + _PTR(SObject) shaper = studyDS->FindObjectByPath("/Shaper"); // non null result if shaper data is present in the study + bool shaperIsActive = false; + QList models; + study->dataModels( models ); + for( int i = 0; i < models.count() && !shaperIsActive; i++ ) + shaperIsActive = models[i]->module()->moduleName() == "Shaper"; + + if (shaper && !shaperIsActive) + onDesktopMessage("register_module_in_study/Shaper"); + } +} diff --git a/src/SalomeApp/SalomeApp_Application.h b/src/SalomeApp/SalomeApp_Application.h index 3919ba3f8..5f4da65f0 100644 --- a/src/SalomeApp/SalomeApp_Application.h +++ b/src/SalomeApp/SalomeApp_Application.h @@ -193,6 +193,7 @@ private slots: private: void createExtraActions(); + void ensureShaperIsActivated(); private: #ifndef DISABLE_PYCONSOLE -- 2.39.2