From: skv Date: Fri, 10 Oct 2014 07:17:09 +0000 (+0400) Subject: Change in name generation + behavior of apply buttons X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=84055170e9875a17b2bff9ad5b41dc42c6dbcbbc;p=modules%2Fgeom.git Change in name generation + behavior of apply buttons --- diff --git a/doc/salome/gui/GEOM/images/repair10.png b/doc/salome/gui/GEOM/images/repair10.png index 5db646742..9c67419a5 100755 Binary files a/doc/salome/gui/GEOM/images/repair10.png and b/doc/salome/gui/GEOM/images/repair10.png differ diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 75ef896f8..bd50af4ce 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -838,7 +838,7 @@ Please, select face, shell or solid and try again GEOM_FREE_FACES_NAME - Free_face_%1 + Free_face GEOM_FREE_FACES_TITLE diff --git a/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx b/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx index 8cc5a6560..00e08c13a 100644 --- a/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx +++ b/src/RepairGUI/RepairGUI_FreeFacesDlg.cxx @@ -143,6 +143,9 @@ void RepairGUI_FreeFacesDlg::Init() connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + initName(tr("GEOM_FREE_FACES_NAME")); + buttonOk()->setEnabled(false); + buttonApply()->setEnabled(false); activateSelection(); SelectionIntoArgument(); } @@ -165,6 +168,8 @@ bool RepairGUI_FreeFacesDlg::ClickOnApply() { if (!onAccept()) return false; + + initName(); return true; } @@ -208,6 +213,8 @@ void RepairGUI_FreeFacesDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if ( aSelList.Extent() != 1 ) { + buttonOk()->setEnabled(false); + buttonApply()->setEnabled(false); return; } @@ -215,6 +222,8 @@ void RepairGUI_FreeFacesDlg::SelectionIntoArgument() GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); if ( !GEOMBase::IsShape( anObj ) ) { + buttonOk()->setEnabled(false); + buttonApply()->setEnabled(false); return; } else { myObj = anObj; @@ -265,11 +274,15 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects ) TopoDS_Shape aSelShape; TopoDS_Shape aFace; TopTools_IndexedMapOfShape anIndices; + int aNbObj = 0; + if ( !myObj->_is_nil() && GEOMBase::GetShape( myObj, aSelShape ) ) { myEdit->setText( GEOMBase::GetName( myObj ) ); QString aMess; if ( !isValid( aMess ) ) { erasePreview( true ); + buttonOk()->setEnabled(false); + buttonApply()->setEnabled(false); return false; } @@ -315,6 +328,8 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects ) catch( const SALOME::SALOME_Exception& e ) { SalomeApp_Tools::QtCatchCorbaException( e ); + buttonOk()->setEnabled(false); + buttonApply()->setEnabled(false); return false; } } @@ -322,12 +337,18 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects ) // Create sub-objects GEOM::ListOfGO_var aList = anOper->MakeSubShapes(myObj, aFaceLst); - for (i = 0, n = aList->length(); i < n; i++) { + aNbObj = aList->length(); + + for (i = 0; i < aNbObj; i++) { objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i])); } aResult = true; } + + buttonOk()->setEnabled(aNbObj > 0); + buttonApply()->setEnabled(aNbObj > 0); + return aResult; } @@ -342,17 +363,6 @@ GEOM_Displayer* RepairGUI_FreeFacesDlg::getDisplayer() return myDisplayer; } -//================================================================ -// Function : getNewObjectName -// Purpose : Redefine this method to return proper name for a new object -//================================================================ -QString RepairGUI_FreeFacesDlg::getNewObjectName (int currObj) const -{ - QString aName = tr("GEOM_FREE_FACES_NAME").arg(currObj); - - return aName; -} - //================================================================ // Function : getFather // Purpose : Get father object for object to be added in study diff --git a/src/RepairGUI/RepairGUI_FreeFacesDlg.h b/src/RepairGUI/RepairGUI_FreeFacesDlg.h index 2fa420285..2e3f12f7f 100644 --- a/src/RepairGUI/RepairGUI_FreeFacesDlg.h +++ b/src/RepairGUI/RepairGUI_FreeFacesDlg.h @@ -50,8 +50,7 @@ protected: virtual GEOM::GEOM_IOperations_ptr createOperation(); virtual bool isValid( QString& ); virtual bool execute( ObjectList& ); - virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr); - virtual QString getNewObjectName (int CurrObj = -1) const; + virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr); private: void Init();