]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
BugID: IPAL9186, Modified method Init. Added a loading SMESHGUI if it hasn't been...
authorsrn <srn@opencascade.com>
Wed, 22 Jun 2005 11:27:49 +0000 (11:27 +0000)
committersrn <srn@opencascade.com>
Wed, 22 Jun 2005 11:27:49 +0000 (11:27 +0000)
src/SMESHGUI/SMESHGUI_Swig.cxx

index 6ed39d3c8ccfc70d3c9f1fd6a0c6d14bc9b0a499..b77d0c17754ea15741f08b6780da196641c05ee4 100644 (file)
@@ -109,7 +109,19 @@ void SMESH_Swig::Init(int studyID)
     anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributeName");
     aName = SALOMEDS::AttributeName::_narrow(anAttr);
     //NRI    aName->SetValue(QObject::tr("SMESH_MEN_COMPONENT"));
-    aName->SetValue( SMESHGUI::GetSMESHGUI()->moduleName() );
+    SMESHGUI* gui = SMESHGUI::GetSMESHGUI(); //SRN: BugID IPAL9186, load a SMESH gui if it hasn't been loaded
+    if(!gui) {
+      SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication()); 
+      if(app) {
+        CAM_Module* module = app->module( "Mesh" );
+       if(!module) module = app->loadModule("Mesh");
+       gui = dynamic_cast<SMESHGUI*>( module ); 
+      }
+      else {
+        MESSAGE("Can't find the application");
+      }
+    }  //SRN: BugID IPAL9186: end of a fix
+    aName->SetValue( gui->moduleName() );
     anAttr = myStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
     aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
     aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" );