]> SALOME platform Git repositories - modules/hexablock.git/commitdiff
Salome HOME
Modifs cas-tests + evols ihm
authorabuhsing <abuhsing>
Tue, 28 Jan 2014 12:49:03 +0000 (12:49 +0000)
committerabuhsing <abuhsing>
Tue, 28 Jan 2014 12:49:03 +0000 (12:49 +0000)
 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
src/HEXABLOCKGUI/HEXABLOCKGUI.hxx
src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx
src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx
src/TEST_PY/test_v6/makePipeTop.py
src/TEST_PY/test_v6/makeRindUni.py
src/TEST_PY/test_v6/makeSphere.py

index 63ebc656a7c23085cc726e82e882974f7cae8e9b..d508afb873f620c621f4f6e40ebbc0e63d6de3d4 100755 (executable)
@@ -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()
index f844c41ee87e7eed3258371fe0c9233e8d508162..492efedb9a13daf57acf8976104c8373cc077ecb 100755 (executable)
@@ -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;
index f2007d9bfdff22af0380184ddab7f0d2c866fb49..754bd89a7c8cd2607be744880f768d2cbe2d4ac5 100644 (file)
@@ -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();
     }
 }
index 16982661a012e6be62a8ab6a61e14adeec3d6a00..2f85baf869e1edd62e315ab146ffa3b5fc4ed061 100755 (executable)
@@ -78,8 +78,6 @@ private:
   double                             getUParameter() const;
   double                             getVParameter() const;
   void                               updateParamCoord(bool theIsUpdate);
-
-private:
   bool                               myBusy;
 
   MyDlgRef_3Spin*                      GroupXYZ;
index 917d6a1cde381c0da472f0d4560d898ba8b13082..290886be0266a579ed48fc54e761fbe11d1739f9 100644 (file)
@@ -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)
index 41738eaa86569fd20c8d186fc2534f17ab356f95..fa1cf2b96998bc5c71815bc7cc603fd038168bf4 100644 (file)
@@ -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)
index eb3343d97679ee04cd5180fb57c5039fa6ff400a..91c1a7feee2be7e9607215135aeffc13fba3e81d 100644 (file)
@@ -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)