]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Automatically activate SHAPER when dumping study from opened HDF file mpv/load_module_exprm2
authorvsr <vsr@opencascade.com>
Mon, 15 Jun 2020 08:48:50 +0000 (11:48 +0300)
committervsr <vsr@opencascade.com>
Mon, 15 Jun 2020 08:48:50 +0000 (11:48 +0300)
src/CAM/CAM_Application.cxx
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Application.h

index fd2b0b9480ba3f4085de66256f7552c174a46052..ae731cee51f48a1906f062719fbea145e5af7cf3 100644 (file)
@@ -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 );
index 94c952df3e7413eedde851f35d3b500877a8ad03..7204f3f740f73868f2f35b0936aa5dfae8d60781 100644 (file)
@@ -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<SalomeApp_Study*>(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<CAM_DataModel*> 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");
+  }
+}
index 3919ba3f8b487a0f7f81157f84935e5de9d20fad..5f4da65f06bd9b21f1a77be96a8107dc6b64948d 100644 (file)
@@ -193,6 +193,7 @@ private slots:
 
 private:
   void                                createExtraActions();
+  void                                ensureShaperIsActivated();
 
 private:
 #ifndef DISABLE_PYCONSOLE