Salome HOME
#16755 [CEA 16749] Merge nodes generates fatal error if selection is disabled
authoreap <eap@opencascade.com>
Thu, 28 Mar 2019 15:22:44 +0000 (18:22 +0300)
committereap <eap@opencascade.com>
Thu, 28 Mar 2019 15:22:44 +0000 (18:22 +0300)
src/SMESHGUI/SMESHGUI_MergeDlg.cxx
src/SMESH_I/SMESH_PythonDump.cxx

index f7977d196d83683df32377dd11f88c782a0867a8..b269e2a47c99623abb11d521bc3db6d4114b20c6 100644 (file)
@@ -1144,6 +1144,9 @@ void SMESHGUI_MergeDlg::SetEditCurrentArgument()
 //=================================================================================
 void SMESHGUI_MergeDlg::SelectionIntoArgument()
 {
+  if ( myIsBusy )
+    return;
+
   if (myEditCurrentArgument == (QWidget*)LineEditMesh)
   {
     QString aString = "";
@@ -1222,6 +1225,9 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument()
 
     LineEditMesh->setText( aString );
 
+    
+    myIsBusy = true; // here selection can change
+
     if (myAction == MERGE_NODES) {
       SMESH::SetPointRepresentation(true);
       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
@@ -1231,6 +1237,8 @@ void SMESHGUI_MergeDlg::SelectionIntoArgument()
       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
         aViewWindow->SetSelectionMode(CellSelection);
 
+    myIsBusy = false;
+
     // process groups
     myGroups.clear();
     ListExclude->clear();
@@ -1408,9 +1416,11 @@ void SMESHGUI_MergeDlg::onTypeChanged (int id)
 
     myIdPreview->SetPointsLabeled(false);
     SMESH::SetPointRepresentation(false);
+    myIsBusy = true; // keep currently selected mesh
     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
       aViewWindow->SetSelectionMode(ActorSelection);
     mySelectionMgr->clearFilters();
+    myIsBusy = false;
     GroupCoincident->hide();
     GroupEdit->hide();
 
@@ -1424,6 +1434,7 @@ void SMESHGUI_MergeDlg::onTypeChanged (int id)
 
     myMeshOrSubMeshOrGroupFilter = new SMESH_TypeFilter (SMESH::IDSOURCE);
 
+    myIsBusy = true; // keep currently selected mesh
     if (myAction == MERGE_NODES) {
       SMESH::SetPointRepresentation(true);
       if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
@@ -1435,11 +1446,14 @@ void SMESHGUI_MergeDlg::onTypeChanged (int id)
         if( mySelector->IsSelectionEnabled() )
           aViewWindow->SetSelectionMode(CellSelection);
     }
+    myIsBusy = false;
     GroupCoincident->show();
     GroupEdit->show();
     break;
   }
-  SelectionIntoArgument();
+
+  if ( myMesh->_is_nil() )
+    SelectionIntoArgument();
 
   updateControls();
 
index aa35dc0a5e5f6631e98574a1a96bd2cc081f7102..5c9163bf42e3d55b2439accd1f2d58e33f2f5636 100644 (file)
@@ -1009,9 +1009,9 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
   
   lines.push_back(  aSMESHGen + " = smeshBuilder.New()" );
   if ( isPublished )
-    optionalComment = helper + "#";
+    optionalComment = "#";
   lines.push_back( optionalComment + aSMESHGen + ".SetEnablePublish( False ) # Set to False to avoid publish in study if not needed or in some particular situations:" );
-  lines.push_back( "                                 # multiples meshes built in parallel, complex and numerous mesh edition (performance)" );
+  lines.push_back( "                                 # multiples meshes built in parallel, complex and numerous mesh edition (performance)\n" );
   lines.push_back( helper + "aFilterManager = " + aSMESHGen + ".CreateFilterManager()" );
   lines.push_back( helper + "aMeasurements = "  + aSMESHGen + ".CreateMeasurements()" );