Salome HOME
Issue 0019938 - fix problem with wrong filter selection (ptv)
authorvsr <vsr@opencascade.com>
Fri, 20 Feb 2009 15:11:22 +0000 (15:11 +0000)
committervsr <vsr@opencascade.com>
Fri, 20 Feb 2009 15:11:22 +0000 (15:11 +0000)
20 files changed:
src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx
src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h
src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx
src/SMESHGUI/SMESHGUI_ExtrusionDlg.h
src/SMESHGUI/SMESHGUI_FilterDlg.cxx
src/SMESHGUI/SMESHGUI_FilterDlg.h
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx
src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx
src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx
src/SMESHGUI/SMESHGUI_RevolutionDlg.h
src/SMESHGUI/SMESHGUI_RotationDlg.cxx
src/SMESHGUI/SMESHGUI_RotationDlg.h
src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx
src/SMESHGUI/SMESHGUI_SmoothingDlg.h
src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx
src/SMESHGUI/SMESHGUI_SymmetryDlg.h
src/SMESHGUI/SMESHGUI_TranslationDlg.cxx
src/SMESHGUI/SMESHGUI_TranslationDlg.h
src/SMESHGUI/SMESH_msg_en.ts

index a8cffc9e3230a998d426ca7b285f8d7c2799af95..a9af10b7674608ee637c7b4cbff39e558fc08053 100644 (file)
@@ -166,8 +166,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
 
   ElementsLineEdit = new QLineEdit(GroupArguments);
   ElementsLineEdit->setValidator(myIdValidator);
-  QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
-  connect(filterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
+  myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+  connect(myFilterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
 
   // Controls for the whole mesh selection
   MeshCheck = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
@@ -276,7 +276,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
   GroupArgumentsLayout->addWidget(ElementsLab,          0, 0);
   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
   GroupArgumentsLayout->addWidget(ElementsLineEdit,     0, 2);
-  GroupArgumentsLayout->addWidget(filterBtn,            0, 3);
+  GroupArgumentsLayout->addWidget(myFilterBtn,          0, 3);
   GroupArgumentsLayout->addWidget(MeshCheck,            1, 0, 1, 4);
   GroupArgumentsLayout->addWidget(PathGrp,              2, 0, 1, 4);
   GroupArgumentsLayout->addWidget(BasePointGrp,         3, 0, 1, 4);
@@ -1136,6 +1136,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::onSelectMesh()
   ElementsLineEdit->setValidator(toSelectMesh ? 0 : myIdValidator);
   ElementsLab->setText(toSelectMesh ? tr("SMESH_NAME") : tr("SMESH_ID_ELEMENTS"));
   ElementsLineEdit->clear();
+  myFilterBtn->setEnabled(!toSelectMesh);
 
   SetEditCurrentArgument(SelectElementsButton);
 }
@@ -1237,6 +1238,12 @@ void SMESHGUI_ExtrusionAlongPathDlg::keyPressEvent( QKeyEvent* e )
 //=================================================================================
 void SMESHGUI_ExtrusionAlongPathDlg::setFilters()
 {
+  if(myMesh->_is_nil()) {
+    SUIT_MessageBox::critical(this,
+                             tr("SMESH_ERROR"),
+                             tr("NO_MESH_SELECTED"));
+   return;
+  }
   if ( !myFilterDlg )
   {
     QList<int> types;  
index 4e1cbcb9c05ff4cb4ee2d7642a02299b1f864dda..5d70d630600e9d6db8957733c0626ed14eef31c1 100644 (file)
@@ -140,6 +140,7 @@ private:
 
   QString                   myHelpFileName;
 
+  QPushButton*              myFilterBtn;
   SMESHGUI_FilterDlg*       myFilterDlg;
    
 protected slots:
index 0626e4575c3b4e4e3adf984e833b58f4f9ac0303..8eac1b9eb7dfabce4022f26e7ea0b17a10a136bf 100644 (file)
@@ -164,8 +164,8 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
 
   LineEditElements = new QLineEdit(GroupArguments);
   LineEditElements->setValidator(myIdValidator);
-  QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
-  connect(filterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
+  myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+  connect(myFilterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
 
   // Control for the whole mesh selection
   CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
@@ -207,7 +207,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
   GroupArgumentsLayout->addWidget(TextLabelElements,    0, 0);
   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
   GroupArgumentsLayout->addWidget(LineEditElements,     0, 2, 1, 5);
-  GroupArgumentsLayout->addWidget(filterBtn,            0, 7);
+  GroupArgumentsLayout->addWidget(myFilterBtn,          0, 7);
   GroupArgumentsLayout->addWidget(CheckBoxMesh,         1, 0, 1, 8);
   GroupArgumentsLayout->addWidget(TextLabelDistance,    2, 0);
   GroupArgumentsLayout->addWidget(TextLabelDx,          2, 2);
@@ -784,6 +784,7 @@ void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh)
     TextLabelElements->setText(tr("SMESH_NAME"));
   else
     TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
+  myFilterBtn->setEnabled(!toSelectMesh);
 
   if (myEditCurrentArgument != LineEditElements) {
     LineEditElements->clear();
@@ -850,6 +851,12 @@ void SMESHGUI_ExtrusionDlg::keyPressEvent( QKeyEvent* e )
 //=================================================================================
 void SMESHGUI_ExtrusionDlg::setFilters()
 {
+  if(myMesh->_is_nil()) {
+    SUIT_MessageBox::critical(this,
+                             tr("SMESH_ERROR"),
+                             tr("NO_MESH_SELECTED"));
+   return;
+  }
   if ( !myFilterDlg )
   {
     QList<int> types;  
index 99468eaa7dba01107f5183921bd5736015cceb2f..8e8a1f9bd9cac013bf274279b1c7226784b6ea30 100644 (file)
@@ -131,6 +131,7 @@ private:
 
   QString                          myHelpFileName;
 
+  QPushButton*                     myFilterBtn;
   SMESHGUI_FilterDlg*              myFilterDlg;
    
 private slots:
index 366af734d2b40a4ef9d56aaf358a8b3277310d4d..1655c06d803cc0fc56ac353caa74a0b264d7f3e7 100755 (executable)
@@ -2057,7 +2057,8 @@ SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI*         theModule,
                                         const QList<int>& theTypes )
 : QDialog( SMESH::GetDesktop( theModule ) ),
   mySMESHGUI( theModule ),
-  mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+  mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+  myInitSourceWgOnApply( true )
 {
   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
     mySelector = aViewWindow->GetSelector();
@@ -2073,7 +2074,8 @@ SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI*   theModule,
                                         const int   theType )
 : QDialog( SMESH::GetDesktop( theModule ) ),
   mySMESHGUI( theModule ),
-  mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+  mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+  myInitSourceWgOnApply( true )
 {
   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
     mySelector = aViewWindow->GetSelector();
@@ -2609,9 +2611,11 @@ bool SMESHGUI_FilterDlg::isValid() const
 // Purpose : Set widget of parent dialog containing idsto be filtered if
 //           user select corresponding source radio button
 //=======================================================================
-void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg)
+void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg,
+                                      const bool initOnApply)
 {
   mySourceWg = theWg;
+  myInitSourceWgOnApply = initOnApply;
 }
 
 //=======================================================================
@@ -2637,7 +2641,7 @@ void SMESHGUI_FilterDlg::SetSelection()
 
   if (mySelectionMgr) {
     myIObjects.Clear();
-    const SALOME_ListIO& anObjs = mySelector->StoredIObjects();
+    const SALOME_ListIO& anObjs = mySelector->StoredIObjects(); 
     SALOME_ListIteratorOfListIO anIter (anObjs);
     for ( ; anIter.More(); anIter.Next()) {
       TColStd_IndexedMapOfInteger aMap;
@@ -2674,9 +2678,11 @@ bool SMESHGUI_FilterDlg::onApply()
     if (!myFilter[ aCurrType ]->GetPredicate()->_is_nil()) {
       QList<int> aResultIds;
       filterSource(aCurrType, aResultIds);
+      // select in viewer
       selectInViewer(aCurrType, aResultIds);
     }
 
+
     myInsertState[ aCurrType ] = mySetInViewer->isChecked();
     myApplyToState[ aCurrType ] = mySourceGrp->checkedId();
   }
@@ -2792,10 +2798,10 @@ void SMESHGUI_FilterDlg::filterSource (const int theType,
     for (anIter = aDialogIds.begin(); anIter != aDialogIds.end(); ++ anIter)
       if (aPred->IsSatisfy(*anIter))
         theResIds.append(*anIter);
-
-    // set ids to the dialog
-    setIdsToWg(mySourceWg, theResIds);
   }
+  // set ids to the dialog
+  if (myInitSourceWgOnApply || aSourceId == Dialog)
+    setIdsToWg(mySourceWg, theResIds);
 }
 
 //=======================================================================
index ed1c95e9d921d3eb9f90632c1c29f9f8c5eb487b..4380d54d82122e9ea9692b591f75a693933bb5c0 100755 (executable)
@@ -223,7 +223,7 @@ public:
 
   void                      SetSelection();
   void                      SetMesh (SMESH::SMESH_Mesh_var);
-  void                      SetSourceWg( QWidget* );
+  void                      SetSourceWg( QWidget*, const bool initOnApply = true );
 
   static SMESH::Filter::Criterion createCriterion();
 
@@ -285,6 +285,7 @@ private:
   LightApp_SelectionMgr*    mySelectionMgr;
   SVTK_Selector*            mySelector;
   SMESH::SMESH_Mesh_var     myMesh;
+  bool                      myInitSourceWgOnApply;
   QWidget*                  mySourceWg;
 
   SALOME_DataMapOfIOMapOfInteger myIObjects;
index 352215c957923d3e79eb4e02e221b14b9abd0033..63b5d395674b05664ab5df3866b6f63bb63f8dd2 100644 (file)
@@ -1395,6 +1395,13 @@ void SMESHGUI_GroupDlg::setCurrentSelection()
 //=================================================================================
 void SMESHGUI_GroupDlg::setFilters()
 {
+  if(myMesh->_is_nil()) {
+    SUIT_MessageBox::critical(this,
+                             tr("SMESH_ERROR"),
+                             tr("NO_MESH_SELECTED"));
+   return;
+  }
+
   SMESH::ElementType aType = SMESH::ALL;
   switch ( myTypeId )
   {
@@ -1415,7 +1422,7 @@ void SMESHGUI_GroupDlg::setFilters()
 
   myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMesh );
-  myFilterDlg->SetSourceWg( myElements );
+  myFilterDlg->SetSourceWg( myElements, false );
 
   myFilterDlg->show();
 }
index 118d2d17c829f90f738c4078dcdc5e07464bcb02..7986c2d63c0e9c9782400f3f309b08116b189bb9 100644 (file)
@@ -507,6 +507,12 @@ void SMESHGUI_RemoveElementsDlg::keyPressEvent( QKeyEvent* e )
 //=================================================================================
 void SMESHGUI_RemoveElementsDlg::setFilters()
 {
+  if(myMesh->_is_nil()) {
+    SUIT_MessageBox::critical(this,
+                             tr("SMESH_ERROR"),
+                             tr("NO_MESH_SELECTED"));
+   return;
+  }
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
index bf218290a568b8f9cf54e86168be337e03469c2b..c511dbae41d20d6d61ec95a75780a0078ba2e4a1 100644 (file)
@@ -514,6 +514,12 @@ void SMESHGUI_RemoveNodesDlg::keyPressEvent( QKeyEvent* e )
 //=================================================================================
 void SMESHGUI_RemoveNodesDlg::setFilters()
 {
+  if(myMesh->_is_nil()) {
+    SUIT_MessageBox::critical(this,
+                             tr("SMESH_ERROR"),
+                             tr("NO_MESH_SELECTED"));
+   return;
+  }
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::NODE );
 
index 355e01ec3f5d695d38dabb8b13b1b8325d190a31..6003776fbeaf488c0746395dc5a01fc72ea2edcf 100644 (file)
@@ -144,8 +144,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
 
   LineEditElements  = new QLineEdit(GroupArguments);
   LineEditElements->setValidator(myIdValidator);
-  QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
-  connect(filterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
+  myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+  connect(myFilterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
 
   // Control for the whole mesh selection
   CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
@@ -238,7 +238,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
   GroupArgumentsLayout->addWidget(TextLabelElements,    0, 0);
   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
   GroupArgumentsLayout->addWidget(LineEditElements,     0, 2);
-  GroupArgumentsLayout->addWidget(filterBtn,            0, 3);
+  GroupArgumentsLayout->addWidget(myFilterBtn,          0, 3);
   GroupArgumentsLayout->addWidget(CheckBoxMesh,         1, 0, 1, 4);
   GroupArgumentsLayout->addWidget(GroupAxis,            2, 0, 1, 4);
   GroupArgumentsLayout->addWidget(GroupAngleBox,        3, 0, 1, 4);
@@ -932,6 +932,7 @@ void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh)
     TextLabelElements->setText(tr("SMESH_NAME"));
   else
     TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
+  myFilterBtn->setEnabled(!toSelectMesh);
 
   if (myEditCurrentArgument != LineEditElements) {
     LineEditElements->clear();
@@ -1144,6 +1145,12 @@ void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action){
 //=================================================================================
 void SMESHGUI_RevolutionDlg::setFilters()
 {
+  if(myMesh->_is_nil()) {
+    SUIT_MessageBox::critical(this,
+                             tr("SMESH_ERROR"),
+                             tr("NO_MESH_SELECTED"));
+   return;
+  }
   if ( !myFilterDlg )
   {
     QList<int> types;  
index a4c3fc1117d0a357a63948364920b68a9cac2545..028817e981d07eb8f1ac2f217aada1879d56a2d8 100644 (file)
@@ -153,6 +153,7 @@ private:
   
   QString                   myHelpFileName;
   
+  QPushButton*              myFilterBtn;
   SMESHGUI_FilterDlg*       myFilterDlg;
    
 private slots:
index 1e701097474a88072cf1b6ff6fd3557cc6077a25..4f122537b7d6a641f2946e991baf0883f5d9ee7e 100644 (file)
@@ -133,8 +133,8 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
   SelectElementsButton->setIcon(image1);
   LineEditElements = new QLineEdit(GroupArguments);
   LineEditElements->setValidator(myIdValidator);
-  QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
-  connect(filterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
+  myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+  connect(myFilterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
 
   // Control for the whole mesh selection
   CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
@@ -215,7 +215,7 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
   GroupArgumentsLayout->addWidget(TextLabelElements,    0, 0);
   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
   GroupArgumentsLayout->addWidget(LineEditElements,     0, 2, 1, 1);
-  GroupArgumentsLayout->addWidget(filterBtn,            0, 3);
+  GroupArgumentsLayout->addWidget(myFilterBtn,          0, 3);
   GroupArgumentsLayout->addWidget(CheckBoxMesh,         1, 0, 1, 4);
   GroupArgumentsLayout->addWidget(GroupAxis,            2, 0, 1, 4);
   GroupArgumentsLayout->addWidget(TextLabelAngle,       3, 0, 1, 2);
@@ -845,6 +845,7 @@ void SMESHGUI_RotationDlg::onSelectMesh (bool toSelectMesh)
     TextLabelElements->setText(tr("SMESH_NAME"));
   else
     TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
+  myFilterBtn->setEnabled(!toSelectMesh);
 
   if (myEditCurrentArgument != LineEditElements) {
     LineEditElements->clear();
@@ -974,6 +975,12 @@ void SMESHGUI_RotationDlg::keyPressEvent( QKeyEvent* e )
 //=================================================================================
 void SMESHGUI_RotationDlg::setFilters()
 {
+  if(myMesh->_is_nil()) {
+    SUIT_MessageBox::critical(this,
+                             tr("SMESH_ERROR"),
+                             tr("NO_MESH_SELECTED"));
+   return;
+  }
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
index 4dd572f2913a9bb818d220bc1cdc479f866b11da..bb743746f08a07ef485a5b9d5c9db1976bff2afa 100644 (file)
@@ -131,6 +131,7 @@ private:
 
   QString                myHelpFileName;
 
+  QPushButton*           myFilterBtn;
   SMESHGUI_FilterDlg*    myFilterDlg;
 
 private slots:
index c2144b1f4692cbe308d78e0c12aa89792c579e57..955f00795015aa4f65ed30ce7b45ba8874fcb98a 100644 (file)
@@ -137,8 +137,8 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule )
 
   LineEditElements = new QLineEdit(GroupArguments);
   LineEditElements->setValidator(myIdValidator);
-  QPushButton* filterElemBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
-  connect(filterElemBtn,   SIGNAL(clicked()), this, SLOT(setElemFilters()));
+  myElemFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+  connect(myElemFilterBtn,   SIGNAL(clicked()), this, SLOT(setElemFilters()));
 
   // Control for the whole mesh selection
   CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
@@ -175,7 +175,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule )
   GroupArgumentsLayout->addWidget(TextLabelElements,      0, 0);
   GroupArgumentsLayout->addWidget(SelectElementsButton,   0, 1);
   GroupArgumentsLayout->addWidget(LineEditElements,       0, 2);
-  GroupArgumentsLayout->addWidget(filterElemBtn,          0, 3);
+  GroupArgumentsLayout->addWidget(myElemFilterBtn,        0, 3);
   GroupArgumentsLayout->addWidget(CheckBoxMesh,           1, 0, 1, 4);
   GroupArgumentsLayout->addWidget(TextLabelNodes,         2, 0);
   GroupArgumentsLayout->addWidget(SelectNodesButton,      2, 1);
@@ -727,6 +727,7 @@ void SMESHGUI_SmoothingDlg::onSelectMesh (bool toSelectMesh)
     TextLabelElements->setText(tr("SMESH_NAME"));
   else
     TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
+  myElemFilterBtn->setEnabled(!toSelectMesh);
 
   if (myEditCurrentArgument != LineEditElements &&
       myEditCurrentArgument != LineEditNodes) {
@@ -779,6 +780,12 @@ void SMESHGUI_SmoothingDlg::keyPressEvent( QKeyEvent* e )
 //=================================================================================
 void SMESHGUI_SmoothingDlg::setFilters( const bool theIsElem )
 {
+  if(myMesh->_is_nil()) {
+    SUIT_MessageBox::critical(this,
+                             tr("SMESH_ERROR"),
+                             tr("NO_MESH_SELECTED"));
+   return;
+  }
   if ( !myFilterDlg )
   {
     QList<int> types;  
index 40b8170a3cbcbfd9e963bd8b85b0aac6002ef3e4..6def01cae4af13137686135c2318087d51355085 100644 (file)
@@ -116,7 +116,8 @@ private:
   QCheckBox*             CheckBoxParametric;
 
   QString                myHelpFileName;
-    
+
+  QPushButton*           myElemFilterBtn;
   SMESHGUI_FilterDlg*    myFilterDlg;
    
 private slots:
index ed49f5217b7e4967dcc6c20a9c58081fa566cece..750ada81d8a64f7084c82736c690ce1d1bc92f9d 100644 (file)
@@ -144,8 +144,8 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
   SelectElementsButton->setIcon(image3);
   LineEditElements = new QLineEdit(GroupArguments);
   LineEditElements->setValidator(myIdValidator);
-  QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
-  connect(filterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
+  myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+  connect(myFilterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
 
   // Control for the whole mesh selection
   CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
@@ -224,7 +224,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
   GroupArgumentsLayout->addWidget(TextLabelElements,    0, 0);
   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
   GroupArgumentsLayout->addWidget(LineEditElements,     0, 2, 1, 1);
-  GroupArgumentsLayout->addWidget(filterBtn,            0, 3);
+  GroupArgumentsLayout->addWidget(myFilterBtn,          0, 3);
   GroupArgumentsLayout->addWidget(CheckBoxMesh,         1, 0, 1, 4);
   GroupArgumentsLayout->addWidget(GroupMirror,          2, 0, 1, 4);
   GroupArgumentsLayout->addWidget(ActionBox,            3, 0, 3, 3);
@@ -931,6 +931,7 @@ void SMESHGUI_SymmetryDlg::onSelectMesh (bool toSelectMesh)
     TextLabelElements->setText(tr("SMESH_NAME"));
   else
     TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
+  myFilterBtn->setEnabled(!toSelectMesh);
 
   if (myEditCurrentArgument != LineEditElements) {
     LineEditElements->clear();
@@ -1073,6 +1074,12 @@ void SMESHGUI_SymmetryDlg::keyPressEvent( QKeyEvent* e )
 //=================================================================================
 void SMESHGUI_SymmetryDlg::setFilters()
 {
+  if(myMesh->_is_nil()) {
+    SUIT_MessageBox::critical(this,
+                             tr("SMESH_ERROR"),
+                             tr("NO_MESH_SELECTED"));
+   return;
+  }
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
index c56317d0bcbf7203f4472fcf0a7b00d331899ac7..1d763eb2e9fd0428df3086d0872f7615addab0ae 100644 (file)
@@ -133,6 +133,7 @@ private:
 
   QString                myHelpFileName;
    
+  QPushButton*           myFilterBtn;
   SMESHGUI_FilterDlg*    myFilterDlg;
    
 private slots:
index 091446d10f7ebbad02595cdd10a65b52ca52e792..ff605c6577401b0fcb95e5f65429ad304e2247c3 100644 (file)
@@ -156,8 +156,8 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
   SelectElementsButton->setIcon(image2);
   LineEditElements = new QLineEdit(GroupArguments);
   LineEditElements->setValidator(myIdValidator);
-  QPushButton* filterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
-  connect(filterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
+  myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments );
+  connect(myFilterBtn,   SIGNAL(clicked()), this, SLOT(setFilters()));
 
   // Control for the whole mesh selection
   CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments);
@@ -214,7 +214,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
   GroupArgumentsLayout->addWidget(TextLabelElements,    0, 0);
   GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1);
   GroupArgumentsLayout->addWidget(LineEditElements,     0, 2, 1, 5);
-  GroupArgumentsLayout->addWidget(filterBtn,            0, 7);
+  GroupArgumentsLayout->addWidget(myFilterBtn,          0, 7);
   GroupArgumentsLayout->addWidget(CheckBoxMesh,         1, 0, 1, 8);
   GroupArgumentsLayout->addWidget(TextLabel1,           2, 0);
   GroupArgumentsLayout->addWidget(SelectButton1,        2, 1);
@@ -910,6 +910,7 @@ void SMESHGUI_TranslationDlg::onSelectMesh (bool toSelectMesh)
     TextLabelElements->setText(tr("SMESH_NAME"));
   else
     TextLabelElements->setText(tr("SMESH_ID_ELEMENTS"));
+  myFilterBtn->setEnabled(!toSelectMesh);
 
   if (myEditCurrentArgument != LineEditElements) {
     LineEditElements->clear();
@@ -1021,6 +1022,12 @@ void SMESHGUI_TranslationDlg::keyPressEvent( QKeyEvent* e )
 //=================================================================================
 void SMESHGUI_TranslationDlg::setFilters()
 {
+  if(myMesh->_is_nil()) {
+    SUIT_MessageBox::critical(this,
+                             tr("SMESH_ERROR"),
+                             tr("NO_MESH_SELECTED"));
+   return;
+  }
   if ( !myFilterDlg )
     myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
 
index 279ec596bd9aa53b90c92e407629abf305f5ae81..cfd77378ad51e54886f4e1e98d4898dd1237f213 100644 (file)
@@ -130,6 +130,7 @@ private:
 
   QString                myHelpFileName;
 
+  QPushButton*           myFilterBtn;
   SMESHGUI_FilterDlg*    myFilterDlg;
    
 private slots:
index a93b7d1f611689c5fbf15b28d5bc3c897f223b72..2ecb18a86a8f28fadc77598726c0b5095a79461a 100644 (file)
@@ -2903,6 +2903,10 @@ Consider saving your work before application crash</translation>
             <source>SMESH_DRS_SOME_EMPTY</source>
             <translation>One or more mesh files were empty, data has not been published</translation>
         </message>
+        <message>
+            <source>NO_MESH_SELECTED</source>
+            <translation>No mesh selected</translation>
+        </message>
     </context>
     <context>
         <name>SMESHGUI</name>