From 3ebce928a3a516c4bea70eaa793eec41d7273089 Mon Sep 17 00:00:00 2001 From: abuhsing Date: Tue, 28 Jan 2014 12:49:03 +0000 Subject: [PATCH] Modifs cas-tests + evols ihm Modified Files: Tag: V7_main HEXABLOCKGUI/HEXABLOCKGUI.cxx HEXABLOCKGUI/HEXABLOCKGUI.hxx HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx TEST_PY/test_v6/makePipeTop.py TEST_PY/test_v6/makeRindUni.py TEST_PY/test_v6/makeSphere.py ---------------------------------------------------------------------- --- src/HEXABLOCKGUI/HEXABLOCKGUI.cxx | 183 ++++++++++++++++++++++- src/HEXABLOCKGUI/HEXABLOCKGUI.hxx | 8 + src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx | 21 ++- src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx | 2 - src/TEST_PY/test_v6/makePipeTop.py | 2 + src/TEST_PY/test_v6/makeRindUni.py | 2 + src/TEST_PY/test_v6/makeSphere.py | 2 + 7 files changed, 209 insertions(+), 11 deletions(-) diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx index 63ebc65..d508afb 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx @@ -154,6 +154,7 @@ HEXABLOCKGUI::HEXABLOCKGUI() : // _treeViewDelegate(0), _isSaved( false ), moduleActivatedOnce(false), + menusEnabled(true), _vertexDiag(0), _edgeDiag(0), _quadDiag(0), @@ -360,7 +361,10 @@ bool HEXABLOCKGUI::activateModule( SUIT_Study* theStudy ) currentDocGView->getViewWindow()->installEventFilter(this); } else - initialMenus(); + { + newDocument(); +// initialMenus(); + } return bOk; } @@ -619,6 +623,8 @@ void HEXABLOCKGUI::onObjectBrowserClick(const QModelIndex& index) docGView->setViewWindow(graphicViewsHandler->createVtkWindow()); docGView->getViewWindow()->installEventFilter(this); showAllMenus(); + if (!menusEnabled) + setAllMenusEnabled(true); } else docGView->setViewWindow(currentDocGView->getViewWindow()); @@ -660,7 +666,10 @@ void HEXABLOCKGUI::onWindowClosed( SUIT_ViewWindow* svw) if (currentDocGView != NULL) currentDocGView->setViewWindow(NULL); - initialMenus(); +// initialMenus(); + setAllMenusEnabled(false); + enableDocumentMenus(true); + return; } @@ -941,7 +950,6 @@ void HEXABLOCKGUI::createAndFillDockWidget() _dwInputPanel = new QDockWidget(aParent); _dwInputPanel->setVisible(false); _dwInputPanel->setWindowTitle("Input Panel"); - _dwInputPanel->setObjectName("InputPanelDockWidget"); // _dwInputPanel->setMinimumWidth(DWINPUT_MINIMUM_WIDTH); // --- force a minimum until display // _treeViewDelegate = new DocumentDelegate(_dwInputPanel); @@ -952,7 +960,6 @@ void HEXABLOCKGUI::createAndFillDockWidget() _dwPattern->setVisible(false); _dwPattern->setWindowTitle("Model"); _dwPattern->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display - _dwPattern->setObjectName("ModelDockWidget"); QFrame* patternFrame = new QFrame(_dwPattern); patternFrame->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); @@ -987,7 +994,6 @@ void HEXABLOCKGUI::createAndFillDockWidget() _dwGroups->setVisible(false); _dwGroups->setWindowTitle("Groups"); _dwGroups->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display - _dwGroups->setObjectName("GroupsDockWidget"); _groupsTreeView = new QTreeView(_dwGroups); _groupsTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); // _groupsTreeView->setItemDelegate(_treeViewDelegate); @@ -999,7 +1005,6 @@ void HEXABLOCKGUI::createAndFillDockWidget() _dwMesh->setVisible(false); _dwMesh->setWindowTitle("Mesh"); _dwMesh->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display - _dwMesh->setObjectName("MeshDockWidget"); _meshTreeView = new QTreeView(_dwMesh); _meshTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); _meshTreeView->setSelectionMode(QAbstractItemView::SingleSelection); @@ -1563,6 +1568,16 @@ void HEXABLOCKGUI::showAllMenus() showMeshMenus( true ); } +void HEXABLOCKGUI::setAllMenusEnabled(bool enable) +{ + enableDocumentMenus( enable ); + enablePatternMenus( enable ); + enableAssociationMenus( enable ); + enableGroupsMenus( enable ); + enableMeshMenus( enable ); + + menusEnabled = enable; +} void HEXABLOCKGUI::showDocumentMenus(bool show) { @@ -1578,6 +1593,22 @@ void HEXABLOCKGUI::showDocumentMenus(bool show) setToolShown(_saveAct, show); } +void HEXABLOCKGUI::enableDocumentMenus(bool enable) +{ + _newAct->setEnabled(enable); +// setToolShown(_newAct, enable); + + _importAct->setEnabled(enable); +// setToolShown(_importAct, enable); + + _showModelInfoAct->setEnabled(enable); +// setToolShown(_showModelInfoAct, enable); + + _saveAct->setEnabled(enable); +// setToolShown(_saveAct, enable); +} + + void HEXABLOCKGUI::showPatternMenus(bool show) { DEBTRACE("HEXABLOCKGUI::showPatternMenus " << show); @@ -1653,6 +1684,93 @@ void HEXABLOCKGUI::showPatternMenus(bool show) setMenuShown( _showModelInfoAct, show ); } +void HEXABLOCKGUI::enablePatternMenus(bool enable) +{ + if ( enable && !getCurrentModel() ) return; + + _addVertex->setEnabled(enable); +// setToolShown(_addVertex, enable); + + _addEdge->setEnabled(enable); +// setToolShown(_addEdge, enable); + + _addQuad->setEnabled(enable); +// setToolShown(_addQuad, enable); + + _addHexa->setEnabled(enable); +// setToolShown(_addHexa, enable); + +// setMenuShown(_sep1, enable ); +// setToolShown(_sep1, enable); + + _addVector->setEnabled(enable); +// setToolShown( _addVector, enable); + +// setMenuShown(_sep2, enable ); +// setToolShown(_sep2, enable); + + _makeGrid->setEnabled(enable); +// setToolShown( _makeGrid, enable); + + _makePipe->setEnabled(enable); +// setToolShown( _makePipe, enable); + +// setMenuShown(_sep3, enable ); +// setToolShown(_sep3, enable); + + _makeCylinder->setEnabled(enable); +// setToolShown( _makeCylinder, enable); + + _makeCylinders->setEnabled(enable); +// setToolShown( _makeCylinders, enable); + + _makePipes->setEnabled(enable); +// setToolShown( _makePipes, enable); + + _makeHemiSphere->setEnabled(enable); +// setToolShown( _makeHemiSphere, enable); + + // Pattern Data Edition + _removeHexa->setEnabled(enable); +// setToolShown( _removeHexa, enable); + + _prismQuad->setEnabled(enable); +// setToolShown( _prismQuad, enable); + + _joinQuad->setEnabled(enable); +// setToolShown( _joinQuad, enable); + + _merge->setEnabled(enable); +// setToolShown( _merge, enable); + + _disconnect->setEnabled(enable); +// setToolShown( _disconnect, enable); + + _cutEdge->setEnabled(enable); +// setToolShown( _cutEdge, enable); + + _makeTransformation->setEnabled(enable); +// setToolShown( _makeTransformation, enable); + + _makeSymmetry->setEnabled(enable); +// setToolShown( _makeSymmetry, enable); + + _performTransformation->setEnabled(enable); +// setToolShown( _performTransformation, enable); + + _performSymmetry->setEnabled(enable); +// setToolShown( _performSymmetry, enable); + + _replaceHexa->setEnabled(enable); +// setToolShown( _replaceHexa, enable); + + _quadRevolution->setEnabled(enable); +// setToolShown( _quadRevolution, enable); + +// setMenuShown( _sep4, enable ); + _showModelInfoAct->setEnabled(enable); +} + void HEXABLOCKGUI::showAssociationMenus(bool show) { @@ -1662,13 +1780,34 @@ void HEXABLOCKGUI::showAssociationMenus(bool show) // Association Edition setMenuShown( _assocVertex, show ); setToolShown( _assocVertex, show ); + setMenuShown( _assocEdge, show ); setToolShown( _assocEdge, show ); + setMenuShown( _assocQuad, show ); setToolShown( _assocQuad, show ); + setMenuShown( _addShapeAct, show ); setToolShown( _addShapeAct, show ); +} +void HEXABLOCKGUI::enableAssociationMenus(bool enable) +{ + if ( enable && !getCurrentModel() ) + return; + + // Association Edition + _assocVertex->setEnabled(enable); + // setToolShown( _assocVertex, enable ); + + _assocEdge->setEnabled(enable); + // setToolShown( _assocEdge, enable ); + + _assocQuad->setEnabled(enable); + // setToolShown( _assocQuad, enable ); + + _addShapeAct->setEnabled(enable); + // setToolShown( _addShapeAct, enable ); } void HEXABLOCKGUI::showGroupsMenus(bool show) @@ -1681,6 +1820,18 @@ void HEXABLOCKGUI::showGroupsMenus(bool show) setToolShown( _removeGroup , show); } +void HEXABLOCKGUI::enableGroupsMenus(bool enable) +{ + if ( enable && !getCurrentModel() ) + return; + + _addGroup->setEnabled(enable); +// setToolShown( _addGroup, enable); + + _removeGroup->setEnabled(enable); +// setToolShown( _removeGroup , enable); +} + void HEXABLOCKGUI::showMeshMenus(bool show) { DEBTRACE("HEXABLOCKGUI::showMeshMenus" << show); @@ -1695,6 +1846,24 @@ void HEXABLOCKGUI::showMeshMenus(bool show) setToolShown( _computeMesh, show); } +void HEXABLOCKGUI::enableMeshMenus(bool enable) +{ + if ( enable && !getCurrentModel() ) + return; + + _addLaw->setEnabled(enable); +// setToolShown( _addLaw, enable); + + _removeLaw->setEnabled(enable); +// setToolShown( _removeLaw, enable); + + _setPropagation->setEnabled(enable); +// setToolShown( _setPropagation, enable); + + _computeMesh->setEnabled(enable); +// setToolShown( _computeMesh, enable); +} + void HEXABLOCKGUI::showVtkActor() { VtkDocumentGraphicView* currentVtkGView = getCurrentVtkGraphicView(); @@ -1977,6 +2146,8 @@ void HEXABLOCKGUI::switchModel(VtkDocumentGraphicView* dgview) currentDocGView->getDocumentModel()->refresh(); // _dwPattern->setWindowTitle(currentDocGView->getDocumentModel()->getName()); showAllMenus(); + if (!menusEnabled) + setAllMenusEnabled(true); } DocumentModel* HEXABLOCKGUI::getCurrentModel() diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx index f844c41..492efed 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx @@ -173,6 +173,7 @@ public: void initialMenus(); void showAllMenus(); + void setAllMenusEnabled(bool enable); void updateSelectors(); void switchModel(HEXABLOCK::GUI::VtkDocumentGraphicView* dgview); @@ -217,6 +218,12 @@ public slots: void showGroupsMenus(bool show); void showMeshMenus(bool show); + void enableDocumentMenus(bool enable); + void enablePatternMenus(bool enable); + void enableAssociationMenus(bool enable); + void enableGroupsMenus(bool enable); + void enableMeshMenus(bool enable); + protected slots: void onWindowActivated( SUIT_ViewWindow* svw); void onWindowClosed( SUIT_ViewWindow* svw); @@ -485,6 +492,7 @@ private: bool _isSaved; bool moduleActivatedOnce; + bool menusEnabled; QDir* loadDocLastPath; QDir* saveDocLastPath; diff --git a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx index f2007d9..754bd89 100644 --- a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx +++ b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx @@ -115,15 +115,19 @@ MyBasicGUI_PointDlg::MyBasicGUI_PointDlg(QWidget* parent, Qt::WindowFlags fl) myParamCoord = new QButtonGroup(myParamGroup); QHBoxLayout* boxLayout = new QHBoxLayout(myParamGroup); boxLayout->setMargin(MARGIN); boxLayout->setSpacing(SPACING); + QRadioButton* btn = new QRadioButton(tr("By Param"), myParamGroup); myParamCoord->addButton(btn, PARAM_VALUE); boxLayout->addWidget(btn); + btn = new QRadioButton(tr("By Length"), myParamGroup); myParamCoord->addButton(btn, LENGTH_VALUE); boxLayout->addWidget(btn); + btn = new QRadioButton(tr("By Coords"), myParamGroup); myParamCoord->addButton(btn, COORD_VALUE); boxLayout->addWidget(btn); + myParamCoord->setExclusive(true); myParamCoord->button(PARAM_VALUE)->setChecked(true); @@ -1058,9 +1062,20 @@ void MyBasicGUI_PointDlg::clear() void MyBasicGUI_PointDlg::onWindowActivated(SUIT_ViewManager* vm) { QString vmType = vm->getType(); - if ( (vmType == SVTK_Viewer::Type()) || (vmType == VTKViewer_Viewer::Type()) ){ + if ( ((vmType == SVTK_Viewer::Type()) || (vmType == VTKViewer_Viewer::Type())) && + !mainFrame()->RadioButton4->isChecked() && + !myParamCoord->button(LENGTH_VALUE)->isChecked() ) mainFrame()->_vertex_le->setFocus(); - } else if ( vmType == OCCViewer_Viewer::Type() ){ - // ... + else if ( vmType == OCCViewer_Viewer::Type() ){ + if (mainFrame()->RadioButton1->isChecked()) + // Make the field "Vertex of the model" lose the focus + mainFrame()->RadioButton1->click(); + else if (mainFrame()->RadioButton2->isChecked()) + GroupRefPoint->LineEdit1->setFocus(); + else if (mainFrame()->RadioButton3->isChecked() && + !myParamCoord->button(LENGTH_VALUE)->isChecked()) + GroupOnCurve->LineEdit1->setFocus(); + else if (mainFrame()->RadioButton5->isChecked()) + GroupOnSurface->LineEdit1->setFocus(); } } diff --git a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx index 1698266..2f85baf 100755 --- a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx +++ b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx @@ -78,8 +78,6 @@ private: double getUParameter() const; double getVParameter() const; void updateParamCoord(bool theIsUpdate); - -private: bool myBusy; MyDlgRef_3Spin* GroupXYZ; diff --git a/src/TEST_PY/test_v6/makePipeTop.py b/src/TEST_PY/test_v6/makePipeTop.py index 917d6a1..290886b 100644 --- a/src/TEST_PY/test_v6/makePipeTop.py +++ b/src/TEST_PY/test_v6/makePipeTop.py @@ -6,3 +6,5 @@ doc = hexablock.addDocument ("model") doc.makePipeTop (3, 8, 3) ### doc.saveVtk ("model1.vtk") +doc.addLaws (1, True) +mesh_hexas = hexablock.mesh(doc) diff --git a/src/TEST_PY/test_v6/makeRindUni.py b/src/TEST_PY/test_v6/makeRindUni.py index 41738ea..fa1cf2b 100644 --- a/src/TEST_PY/test_v6/makeRindUni.py +++ b/src/TEST_PY/test_v6/makeRindUni.py @@ -21,3 +21,5 @@ vplan = doc.addVertex (0, 0, -rext*0.7) doc.makeRindUni (center,vx,vz, rhole,rint,rext, angle,vplan,nr,na,nh) ## doc.saveVtk ("model1.vtk") +doc.addLaws (1, True) +mesh_hexas = hexablock.mesh(doc) diff --git a/src/TEST_PY/test_v6/makeSphere.py b/src/TEST_PY/test_v6/makeSphere.py index eb3343d..91c1a7f 100644 --- a/src/TEST_PY/test_v6/makeSphere.py +++ b/src/TEST_PY/test_v6/makeSphere.py @@ -18,3 +18,5 @@ tphi = [ -30, -10, 0, 10, 30, 45, 60, 75, 80 ] doc.makeSphere (center,vx,vz, trayons, tangles, tphi) doc.saveVtk ("model1.vtk") +doc.addLaws (0.5, True) +mesh_hexas = hexablock.mesh(doc) -- 2.39.2