Salome HOME
From NewGEOM: activation of SMESH after any module without object browser crashes...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index 0b30830c43c2c024bfafb2205f9899e917616301..1a330a766ac5b7055f2abe6e7d13f13d2e671d30 100644 (file)
@@ -426,17 +426,16 @@ namespace
     const bool isMED = ( theCommandID == SMESHOp::OpExportMED || theCommandID == SMESHOp::OpPopupExportMED );
     const bool isUNV = ( theCommandID == SMESHOp::OpExportUNV || theCommandID == SMESHOp::OpPopupExportUNV );
     const bool isSTL = ( theCommandID == SMESHOp::OpExportSTL || theCommandID == SMESHOp::OpPopupExportSTL );
-  #ifdef WITH_CGNS
+#ifdef WITH_CGNS
     const bool isCGNS= ( theCommandID == SMESHOp::OpExportCGNS || theCommandID == SMESHOp::OpPopupExportCGNS );
-  #else
+#else
     const bool isCGNS= false;
-  #endif
+#endif
     const bool isSAUV= ( theCommandID == SMESHOp::OpExportSAUV || theCommandID == SMESHOp::OpPopupExportSAUV );
     const bool isGMF = ( theCommandID == SMESHOp::OpExportGMF || theCommandID == SMESHOp::OpPopupExportGMF );
 
-    // actually, the following condition can't be met (added for insurance)
-    if( selected.Extent() == 0 ||
-        ( selected.Extent() > 1 && !isMED && !isSTL ))
+    const bool multiMeshSupported = ( isMED || isCGNS ); // file can hold several meshes
+    if ( selected.Extent() == 0 || ( selected.Extent() > 1 && !multiMeshSupported ))
       return;
 
     // get mesh object from selection and check duplication of their names
@@ -4383,9 +4382,9 @@ void SMESHGUI::initialize( CAM_Application* app )
 #ifdef WITH_CGNS
   createPopupItem( SMESHOp::OpPopupExportCGNS, OB, mesh_group, multiple_non_empty, anId );
 #endif
-  createPopupItem( SMESHOp::OpPopupExportSAUV, OB, mesh_group, multiple_non_empty, anId );
-  createPopupItem( SMESHOp::OpPopupExportGMF,  OB, mesh_group, multiple_non_empty, anId );
-  createPopupItem( SMESHOp::OpPopupExportDAT,  OB, mesh_group, multiple_non_empty, anId );
+  createPopupItem( SMESHOp::OpPopupExportSAUV, OB, mesh_group, only_one_non_empty, anId );
+  createPopupItem( SMESHOp::OpPopupExportGMF,  OB, mesh_group, only_one_non_empty, anId );
+  createPopupItem( SMESHOp::OpPopupExportDAT,  OB, mesh_group, only_one_non_empty, anId );
   createPopupItem( SMESHOp::OpDelete,          OB, mesh_part + " " + hyp_alg );
   createPopupItem( SMESHOp::OpDeleteGroup,     OB, group );
   popupMgr()->insert( separator(), -1, 0 );
@@ -4754,7 +4753,7 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
     PyErr_Print();
   }
   else {
-    PyObjWrapper result = PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"smesh",tr("MEN_MESH").toStdString().c_str(),tr("SMESH_PLUGINS_OTHER").toStdString().c_str());
+    PyObjWrapper result = PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"smesh",tr("MEN_MESH").toUtf8().data(),tr("SMESH_PLUGINS_OTHER").toUtf8().data());
     if ( !result )
       PyErr_Print();
   }
@@ -4766,11 +4765,10 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
 
   //  0020210. Make SMESH_Gen update meshes at switching GEOM->SMESH
   GetSMESHGen()->SetCurrentStudy(SALOMEDS::Study::_nil());
-  if ( SalomeApp_Study* s = dynamic_cast<SalomeApp_Study*>( study ))
-    if ( _PTR(Study) aStudy = s->studyDS()) {
+  if ( SalomeApp_Study* s = dynamic_cast<SalomeApp_Study*>( study )) {
+    if ( _PTR(Study) aStudy = s->studyDS() )
       GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
-      updateObjBrowser(); // objects can be removed
-    }
+  }
 
   // get all view currently opened in the study and connect their signals  to
   // the corresponding slots of the class.
@@ -5146,8 +5144,8 @@ void SMESHGUI::createPreferences()
                              LightApp_Preferences::IntSpin, "SMESH", "elem0d_size");
   /* int ballSize = addPreference(tr("PREF_BALL_SIZE"), elemGroup,
                              LightApp_Preferences::IntSpin, "SMESH", "ball_elem_size"); */
-  int ballDiameter = addPreference(tr("PREF_BALL_DIAMETER"), elemGroup,
-                             LightApp_Preferences::IntSpin, "SMESH", "ball_elem_diameter");
+  double ballDiameter = addPreference(tr("PREF_BALL_DIAMETER"), elemGroup,
+                             LightApp_Preferences::DblSpin, "SMESH", "ball_elem_diameter");
   double ballScale = addPreference(tr("PREF_BALL_SCALE"), elemGroup,
                              LightApp_Preferences::DblSpin, "SMESH", "ball_elem_scale");
   int elemW  = addPreference(tr("PREF_WIDTH"), elemGroup,