]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' of salome:modules/shaper
authornds <nds@opencascade.com>
Thu, 18 Jan 2018 06:32:06 +0000 (09:32 +0300)
committernds <nds@opencascade.com>
Thu, 18 Jan 2018 06:32:06 +0000 (09:32 +0300)
12 files changed:
src/ModelAPI/Test/Test2401.py
src/ModuleBase/ModuleBase_IPropertyPanel.h
src/ModuleBase/ModuleBase_OperationFeature.cpp
src/ModuleBase/ModuleBase_WidgetNameEdit.cpp
src/ModuleBase/ModuleBase_WidgetNameEdit.h
src/PythonAPI/model/tests/tests.py
src/SketcherPrs/SketcherPrs_PositionMgr.cpp
src/XGUI/XGUI_DataModel.h
src/XGUI/XGUI_ObjectsBrowser.cpp
src/XGUI/XGUI_PropertyPanel.cpp
src/XGUI/XGUI_PropertyPanel.h
test.models/plug.py

index e65e74c42d259ed925225a0ca8ccbcf855635828..abf10ad1edd15e385feb39a396823b11708e6199 100644 (file)
@@ -76,7 +76,7 @@ SketchLine_8 = Sketch_1.addLine(0, 3, 8, 3)
 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_8.startPoint())
 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_8.endPoint())
 model.do()
-Part_1_doc.setCurrentFeature(Boolean_1.feature())
+Part_1_doc.setCurrentFeature(Boolean_1.feature(), True)
 model.end()
 
 # check that the plane is located as previously
index 446e0e59bb44c35bdfa67c983e6d51060787cc86..0ada2eedd2f62772729ec4cca08cfbb1998cc58d 100644 (file)
@@ -83,6 +83,9 @@ public:
   /// \return a widget or null
   ModuleBase_ModelWidget* findFirstAcceptingValueWidget();
 
+  /// The method is called on accepting of operation
+  virtual void onAcceptData() = 0;
+
   /// Returns the first widget, where canAcceptFocus returns true
   /// \return a widget or null
   static ModuleBase_ModelWidget* findFirstAcceptingValueWidget(
index 5a37bdd6731d6686aa78351976076bc08984e74c..c54669495dc94918a5ad39125cc288fe312591c9 100755 (executable)
@@ -341,6 +341,7 @@ bool ModuleBase_OperationFeature::commit()
     if (anActiveWidget && anActiveWidget->getValueState() == ModuleBase_ModelWidget::ModifiedInPP) {
       anActiveWidget->storeValue();
     }
+    aPanel->onAcceptData();
   }
   if (canBeCommitted()) {
     emit beforeCommitted();
index 9261f6f27868c49c964655caf44f15c5440bd11f..9684eb79b60f615134c20408953463740965206d 100644 (file)
 
 #include <QLineEdit>
 
+ModuleBase_WidgetNameEdit::ModuleBase_WidgetNameEdit(QWidget* theParent,
+                                                     const Config_WidgetAPI* theData,
+                                                     const std::string& thePlaceHolder )
+ : ModuleBase_WidgetLineEdit(theParent, theData, thePlaceHolder)
+{
+  // Disconnect the signal in order to avoid Apply button activation automatically
+  // it will activate apply because of value isApplyEnabledByActiveWidget in
+  // XGUI_ErrorMgr::updateActions
+  disconnect(myLineEdit, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified()));
+}
+
+
 bool ModuleBase_WidgetNameEdit::storeValueCustom()
 {
   if(!myFeature)
index ba090c4ab61656df61c7e30293f6127980a75a0c..5dda6b77eace088f87a4a9d72c14606ce5990394 100644 (file)
@@ -30,8 +30,7 @@ class ModuleBase_WidgetNameEdit : public ModuleBase_WidgetLineEdit
 public:
   ModuleBase_WidgetNameEdit( QWidget* theParent,
                              const Config_WidgetAPI* theData,
-                             const std::string& thePlaceHolder )
-             : ModuleBase_WidgetLineEdit(theParent, theData, thePlaceHolder) {}
+                             const std::string& thePlaceHolder );
 
   /// Returns True if the widget uses feature attribute.
   /// If not then it means that the widget do not need attribute at all.
index 6c6d8e89907a2aab5bd169b4306c17e43eca94aa..ff7ce4dddedba4ee5d7a50b337c0b9d754370673 100644 (file)
@@ -238,6 +238,9 @@ def testHaveNamingByType(theFeature, theModel, thePartDoc, theSubshapeType) :
       selectionList.append(selection)
       shapeExplorer.next()
   # Create group with this selection list
+  # (do not create group if nothing is selected)
+  if (len(selectionList) == 0):
+    return
   Group_1 = theModel.addGroup(thePartDoc, selectionList)
   theModel.do()
 
index 85aa05217cbe08cfe9473e4fef71f228f08d6174..3238fb24818f55018ba0bf873e55a3509444c4fc 100644 (file)
@@ -332,7 +332,7 @@ std::list<ObjectPtr> getCurves(const GeomPointPtr& thePnt, const SketcherPrs_Sym
         double aEnd = aCurve->endParam();
         GeomCirclePtr  aCircle = GeomCirclePtr(new GeomAPI_Circ(aCurve));
         GeomPointPtr aProjPnt = aCircle->project(thePnt);
-        if (thePnt->distance(aProjPnt) <= Precision::Confusion())
+        if (aProjPnt && thePnt->distance(aProjPnt) <= Precision::Confusion())
           aList.push_back(aResObj);
       }
     }
index d7178aa436ece05b076aece93cc87fed50b54201..e89546161dda5a6b3a564dcc0fe37741a607a222 100644 (file)
@@ -64,7 +64,7 @@ public:
 
   //! Returns index of the object
   //! \param theObject object to find
-  virtual QModelIndex objectIndex(const ObjectPtr theObject, int theColumn = 0) const;
+  virtual QModelIndex objectIndex(const ObjectPtr theObject, int theColumn = 1) const;
 
   //! Clear internal data
   virtual void clear();
@@ -131,7 +131,7 @@ public:
 
   /// Returns an index which is root of the given document
   /// \param theDoc a document
-  QModelIndex documentRootIndex(DocumentPtr theDoc, int theColumn = 0) const;
+  QModelIndex documentRootIndex(DocumentPtr theDoc, int theColumn = 1) const;
 
   /// Returns last history object index
   virtual QModelIndex lastHistoryIndex() const;
index 6c2e61ffae991a90c92db7162c75805d6497d0cf..883d3f2f3798f8e69e35340b578604e0a6d32b26 100644 (file)
@@ -647,7 +647,7 @@ QMap<ObjectPtr, bool> XGUI_ObjectsBrowser::getFoldersState(DocumentPtr theDoc) c
   ObjectPtr aObj;
   for (int i = 0; i < aNb; i++) {
     aObj = theDoc->object(ModelAPI_Folder::group(), i);
-    QModelIndex aIdx = myDocModel->objectIndex(aObj);
+    QModelIndex aIdx = myDocModel->objectIndex(aObj, 0);
     aMap[aObj] = myTreeView->isExpanded(aIdx);
   }
   return aMap;
@@ -657,7 +657,7 @@ void XGUI_ObjectsBrowser::setFoldersState(const QMap<ObjectPtr, bool>& theStates
 {
   QMap<ObjectPtr, bool>::const_iterator aIt;
   for (aIt = theStates.constBegin(); aIt != theStates.constEnd(); aIt++) {
-    QModelIndex aIdx = myDocModel->objectIndex(aIt.key());
+    QModelIndex aIdx = myDocModel->objectIndex(aIt.key(), 0);
     myTreeView->setExpanded(aIdx, aIt.value());
   }
 }
index 562330de44746c98e839af45140ba473a8f630d3..33288b465827441990ea5b4fd9c9e87c22c753cc 100755 (executable)
@@ -565,13 +565,6 @@ void XGUI_PropertyPanel::setupActions(XGUI_ActionsMgr* theMgr)
     QAction* anAct = theMgr->operationStateAction(aActionIds.at(i));
     aBtn->setDefaultAction(anAct);
   }
-  // This code is necessary for remembering of user choice in property panel
-  QToolButton* aBtn = findButton(PROP_PANEL_OK);
-  if (aBtn)
-    connect(aBtn->defaultAction(), SIGNAL(triggered(bool)), this, SLOT(onAcceptData()));
-  aBtn = findButton(PROP_PANEL_OK_PLUS);
-  if (aBtn)
-    connect(aBtn->defaultAction(), SIGNAL(triggered(bool)), this, SLOT(onAcceptData()));
 }
 
 void XGUI_PropertyPanel::onAcceptData()
index 4b9ac059a268a8fbcc895e295cfbff359f447ade..9a665ba482b157fa68019e319e88c7a4f32c12a9 100644 (file)
@@ -133,6 +133,9 @@ Q_OBJECT
   /// \param theIsNext true, if Tab(to the next widget) or false(moving to the previous)
   bool setFocusNextPrevChild(bool theIsNext);
 
+  /// The method is called on accepting of operation
+  virtual void onAcceptData();
+
 public slots:
   /// \brief Update all widgets in property panel with values from the given feature
   /// \param theFeature a Feature to update values in widgets
@@ -160,9 +163,6 @@ public slots:
   /// \param theWidget the current widget
   void onActivateNextWidget(ModuleBase_ModelWidget* theWidget);
 
-  /// The method is called on accepting of operation
-  void onAcceptData();
-
 signals:
   /// The signal is emitted if the enter is clicked in the control of the widget
   /// \param theObject a sender of the event
index a1d9f63b79cbf203b072fccc208dc5cb6f2a3328..59bbf13368ff365d5dde22013ee9a2eb586cd901 100644 (file)
@@ -426,7 +426,7 @@ model.testNbSubShapes(Partition_1, GeomAPI_Shape.VERTEX, [1476])
 model.testResultsVolumes(Partition_1, [28288.886256640704232268035411835])
 
 Result = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPSOLID", "Partition_1_1"))
-Result.setSubShapesToRemove([model.selection("SOLID", "Partition_1_1_1")])
+Result.setSubShapesToRemove([model.selection("SOLID", "Partition_1_1_2")])
 Result.result().setName("Plug")
 # check Remove_SubShapes_1
 model.testNbResults(Result, 1)
@@ -437,7 +437,7 @@ model.testNbSubShapes(Result, GeomAPI_Shape.EDGE, [366])
 model.testNbSubShapes(Result, GeomAPI_Shape.VERTEX, [732])
 model.testResultsVolumes(Result, [14144.443128843522572424262762070])
 
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Plug/Modified_Face_1_1"), model.selection("FACE", "Plug/Modified_Face_2_1"), model.selection("FACE", "Plug/Modified_Face_3_1"), model.selection("FACE", "Plug/Modified_Face_4_1")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Plug/Modified_Face_3_1"), model.selection("FACE", "Plug/Modified_Face_5_1"), model.selection("FACE", "Plug/Modified_Face_46_1"), model.selection("FACE", "Plug/Modified_Face_48_1")])
 Group_1.result().setColor(68, 68, 68)
 # check Group_1
 model.checkGroup(Group_1, GeomAPI_Shape.FACE)