]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
authornds <natalia.donis@opencascade.com>
Fri, 17 Apr 2015 15:26:18 +0000 (18:26 +0300)
committernds <natalia.donis@opencascade.com>
Fri, 17 Apr 2015 15:26:18 +0000 (18:26 +0300)
31 files changed:
src/FeaturesPlugin/Test/TestBoolean.py
src/FeaturesPlugin/Test/TestExtrusion.py
src/FeaturesPlugin/Test/TestGroup.py
src/FeaturesPlugin/Test/TestMultiBoolean.py
src/ModelAPI/Test/TestDocument.py
src/NewGeom/CMakeLists.txt
src/NewGeom/NewGeom_Module.cpp
src/NewGeom/NewGeom_Module.h
src/NewGeom/NewGeom_NestedButton.cpp [new file with mode: 0644]
src/NewGeom/NewGeom_NestedButton.h [new file with mode: 0644]
src/SketchPlugin/Test/TestConstraintConcidence.py
src/SketchPlugin/Test/TestConstraintDistance.py
src/SketchPlugin/Test/TestConstraintEqual.py
src/SketchPlugin/Test/TestConstraintHorizontal.py
src/SketchPlugin/Test/TestConstraintLength.py
src/SketchPlugin/Test/TestConstraintMirror.py
src/SketchPlugin/Test/TestConstraintParallel.py
src/SketchPlugin/Test/TestConstraintPerpendicular.py
src/SketchPlugin/Test/TestConstraintRadius.py
src/SketchPlugin/Test/TestConstraintRigid.py
src/SketchPlugin/Test/TestConstraintTangent.py
src/SketchPlugin/Test/TestConstraintVertical.py
src/SketchPlugin/Test/TestHighload.py
src/SketchPlugin/Test/TestSketchArcCircle.py
src/SketchPlugin/Test/TestSketchPointLine.py
src/SketchPlugin/Test/TestSnowflake.py
src/XGUI/XGUI_ActionsMgr.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_SalomeConnector.h
src/XGUI/XGUI_Workshop.cpp

index d9a33eb1992157320084036eb738329118985273..767e51e15240ceac23d78b21f3e77d74e58e72c4 100644 (file)
@@ -26,8 +26,8 @@ aSession = ModelAPI_Session.get()
 # Create a part for extrusions & boolean
 aSession.startOperation()
 aPartFeature = aSession.moduleDocument().addFeature("Part")
-aPart = aSession.activeDocument()
 aSession.finishOperation()
+aPart = aSession.activeDocument()
 #=========================================================================
 # Create a sketch with circle to extrude
 #=========================================================================
@@ -37,8 +37,6 @@ origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
@@ -56,8 +54,6 @@ origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSketchLineA = aTriangleSketchFeature.addFeature("SketchLine")
@@ -88,11 +84,10 @@ for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]:
     aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
     origin = geomDataAPI_Point(eachSketchFeature.attribute("Origin")).pnt()
     dirX = geomDataAPI_Dir(eachSketchFeature.attribute("DirX")).dir()
-    dirY = geomDataAPI_Dir(eachSketchFeature.attribute("DirY")).dir()
     norm = geomDataAPI_Dir(eachSketchFeature.attribute("Norm")).dir()
     aSketchFaces = ShapeList()
     GeomAlgoAPI_SketchBuilder.createFaces(
-        origin, dirX, dirY, norm, aSketchEdges, aSketchFaces)
+        origin, dirX, norm, aSketchEdges, aSketchFaces)
     # Create extrusion on them
     anExtrusionFt = aPart.addFeature("Extrusion")
     anExtrusionFt.selectionList("base").append(
index fd2c2a8faea32cb072d3547b1f4c0161b19bacb8..bf5a2c0825e0a519747531c03e55b298fd1f8943 100644 (file)
@@ -4,9 +4,9 @@
       
       class FeaturesPlugin_Extrusion : public ModelAPI_Feature
         static const std::string MY_EXTRUSION_ID("Extrusion");
-        static const std::string MY_FACE_ID("extrusion_face");
-        static const std::string MY_SIZE_ID("extrusion_size");
-        static const std::string MY_REVERSE_ID("extrusion_reverse");
+        static const std::string MY_FACE_ID("base");
+        static const std::string MY_SIZE_ID("size");
+        static const std::string MY_REVERSE_ID("reverse");
           
         data()->addAttribute(FeaturesPlugin_Extrusion::FACE_ID(), ModelAPI_AttributeSelection::typeId());
         data()->addAttribute(FeaturesPlugin_Extrusion::SIZE_ID(), ModelAPI_AttributeDouble::typeId());
@@ -42,8 +42,6 @@ origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 # Create circle
@@ -61,11 +59,10 @@ aSketchResult = aSketchFeature.firstResult()
 aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
 origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")).pnt()
 dirX = geomDataAPI_Dir(aSketchFeature.attribute("DirX")).dir()
-dirY = geomDataAPI_Dir(aSketchFeature.attribute("DirY")).dir()
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")).dir()
 aSketchFaces = ShapeList()
 GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, dirY, norm, aSketchEdges, aSketchFaces)
+    origin, dirX, norm, aSketchEdges, aSketchFaces)
 assert (len(aSketchFaces) > 0)
 assert (aSketchFaces[0] is not None)
 # Create extrusion
index 41f6a6cc0fe5b1301e3c3af838aaaa14b15cd439..4fda808d6fa172fc378358cef1e42547c218872e 100644 (file)
@@ -33,8 +33,6 @@ origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSketchLineA = aTriangleSketchFeature.addFeature("SketchLine")
@@ -59,11 +57,10 @@ aSketchResult = aTriangleSketchFeature.firstResult()
 aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
 origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")).pnt()
 dirX = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX")).dir()
-dirY = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirY")).dir()
 norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm")).dir()
 aSketchFaces = ShapeList()
 GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, dirY, norm, aSketchEdges, aSketchFaces)
+    origin, dirX, norm, aSketchEdges, aSketchFaces)
 # Create extrusion on them
 anExtrusionFt = aPart.addFeature("Extrusion")
 anExtrusionFt.selectionList("base").append(
index 953ffc4ee0c3e4d15bb0b8f8d7afaa0c135412d0..8ff8dabb1273db26bf3c726c8ad0440c43a14077 100644 (file)
@@ -50,13 +50,11 @@ aSketchFeatures = []
 for i in xrange(0, N):
     for j in xrange(0, N):
         # Create circle
-        aSketchFeature = modelAPI_CompositeFeature(aPart.addFeature("Sketch"))
+        aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
         origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
         origin.setValue(0, 0, 0)
         dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
         dirx.setValue(1, 0, 0)
-        diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-        diry.setValue(0, 1, 0)
         norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
         norm.setValue(0, 0, 1)
         aSketchCircle = aSketchFeature.addFeature("SketchCircle")
@@ -82,11 +80,10 @@ for i in xrange(0, N * N):
     aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
     origin = geomDataAPI_Point(aSketchFeatures[i].attribute("Origin")).pnt()
     dirX = geomDataAPI_Dir(aSketchFeatures[i].attribute("DirX")).dir()
-    dirY = geomDataAPI_Dir(aSketchFeatures[i].attribute("DirY")).dir()
     norm = geomDataAPI_Dir(aSketchFeatures[i].attribute("Norm")).dir()
     aSketchFaces = ShapeList()
     GeomAlgoAPI_SketchBuilder.createFaces(
-        origin, dirX, dirY, norm, aSketchEdges, aSketchFaces)
+        origin, dirX, norm, aSketchEdges, aSketchFaces)
 
     anExtrusionFt = aPart.addFeature("Extrusion")
     assert (anExtrusionFt.getKind() == "Extrusion")
@@ -108,13 +105,11 @@ aSession.finishOperation()
 # Make rectangle sketch: base for the box, size 100x100
 #=========================================================================
 aSession.startOperation()
-aQuadrangleSketchFeature = modelAPI_CompositeFeature(aPart.addFeature("Sketch"))
+aQuadrangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
 origin = geomDataAPI_Point(aQuadrangleSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSketchLineA = aQuadrangleSketchFeature.addFeature("SketchLine")
@@ -148,11 +143,10 @@ aSketchResult = aQuadrangleSketchFeature.firstResult()
 aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
 origin = geomDataAPI_Point(aQuadrangleSketchFeature.attribute("Origin")).pnt()
 dirX = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirX")).dir()
-dirY = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirY")).dir()
 norm = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("Norm")).dir()
 aSketchFaces = ShapeList()
 GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, dirY, norm, aSketchEdges, aSketchFaces)
+    origin, dirX, norm, aSketchEdges, aSketchFaces)
 # Create extrusion on them
 aBox = aPart.addFeature("Extrusion")
 aBox.selectionList("base").append(
index d3693974e5f2abb6e856b9eeff5cf3ad7b59a549..e0f7da4be1b910f394de5d1502248c4733531652 100644 (file)
@@ -62,7 +62,7 @@ assert(aPart.size("Features") == 1)
 # Duplicate the document
 assert(aSession.moduleDocument().size("Parts") == 1)
 aSession.startOperation()
-aSession.moduleDocument().addFeature("Duplicate")
+aPart.addFeature("Duplicate")
 aSession.finishOperation()
 assert(aSession.moduleDocument().size("Parts") == 2)
 aCopyOfPart = aSession.activeDocument()
@@ -75,7 +75,7 @@ assert(aCopyOfPart != aPart)
 #=========================================================================
 assert(aSession.moduleDocument().size("Parts") == 2)
 aSession.startOperation()
-aSession.moduleDocument().addFeature("Remove")
+aPart.addFeature("Remove")
 aSession.finishOperation()
 assert(aSession.moduleDocument().size("Parts") == 1)
 assert(aSession.activeDocument().id() == aSession.moduleDocument().id())
@@ -83,23 +83,7 @@ assert(aSession.activeDocument().id() == aSession.moduleDocument().id())
 aSession.startOperation()
 aDoc1 = aSession.document("Part_1")
 aSession.setActiveDocument(aDoc1, False)
-aSession.moduleDocument().addFeature("Remove")
+aDoc1.addFeature("Remove")
 aSession.finishOperation()
 assert(aSession.moduleDocument().size("Parts") == 0)
 assert(aSession.activeDocument())
-#=========================================================================
-# Trying to duplicate/remove the root
-#=========================================================================
-aSession.startOperation()
-aSession.moduleDocument().addFeature("Duplicate")
-aSession.finishOperation()
-assert(aSession.activeDocument().id() == aSession.moduleDocument().id())
-assert(aSession.moduleDocument().size("Parts") == 0)
-aSession.startOperation()
-aSession.moduleDocument().addFeature("Remove")
-aSession.finishOperation()
-assert(aSession.activeDocument().id() == aSession.moduleDocument().id())
-assert(aSession.moduleDocument().size("Parts") == 0)
-#=========================================================================
-# End of test
-#=========================================================================
index 979269418dfebfbf1c72e1cc791532872c0a6425..70f406e6f2382ef1a90a421d83e82b1efa380b93 100644 (file)
@@ -9,6 +9,7 @@ SET(PROJECT_HEADERS
        NewGeom_DataModel.h
        NewGeom_OCCSelector.h
        NewGeom_SalomeViewer.h
+       NewGeom_NestedButton.h
 )
 
 SET(PROJECT_AUTOMOC 
@@ -20,6 +21,7 @@ SET(PROJECT_SOURCES
        NewGeom_DataModel.cpp
        NewGeom_OCCSelector.cpp
        NewGeom_SalomeViewer.cpp
+       NewGeom_NestedButton.cpp
 )
 
 SET(PROJECT_RESOURCES
index 50279350e19f198496233c71ed9cde0bcdc72db3..56e7b52025dc11d1a6b1f34564284b38d473523f 100644 (file)
@@ -4,6 +4,7 @@
 #include "NewGeom_Module.h"
 #include "NewGeom_DataModel.h"
 #include "NewGeom_OCCSelector.h"
+#include <NewGeom_NestedButton.h>
 
 #include <XGUI_Workshop.h>
 #include <XGUI_PropertyPanel.h>
@@ -14,6 +15,7 @@
 
 #include <ModuleBase_Operation.h>
 #include <ModuleBase_Preferences.h>
+#include <ModuleBase_ActionInfo.h>
 
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
@@ -302,6 +304,16 @@ CAM_DataModel* NewGeom_Module::createDataModel()
   return aDataModel;
 }
 
+QAction* NewGeom_Module::addFeature(const QString& theWBName, const ActionInfo& theInfo)
+{
+  return addFeature(theWBName,
+                    theInfo.id,
+                    theInfo.text,
+                    theInfo.toolTip,
+                    theInfo.icon,
+                    theInfo.shortcut);
+}
+
 //******************************************************
 QAction* NewGeom_Module::addFeature(const QString& theWBName, const QString& theId,
                                     const QString& theTitle, const QString& theTip,
@@ -322,17 +334,37 @@ QAction* NewGeom_Module::addFeature(const QString& theWBName, const QString& the
   aAction->setData(theId);
   int aItemId = createMenu(aId, aMenu, -1, 10);
   int aToolId = createTool(aId, aTool);
+
   return aAction;
 }
 
-QAction* NewGeom_Module::addFeature(const QString& theWBName, const ActionInfo& theInfo)
+
+QAction* NewGeom_Module::addNestedFeature(const QString& theWBName,
+                                          const ActionInfo& theInfo,
+                                          const QList<QAction*>& theNestedActions)
 {
-  return addFeature(theWBName,
-                    theInfo.id,
-                    theInfo.text,
-                    theInfo.toolTip,
-                    theInfo.icon,
-                    theInfo.shortcut);
+  int aMenu = createMenu(theWBName, -1, -1, 50);
+  int aTool = createTool(theWBName);
+
+  int aId = myActionsList.size();
+  myActionsList.append(theInfo.id);
+  SUIT_Desktop* aDesk = application()->desktop();
+  NewGeom_NestedButton* anAction = new NewGeom_NestedButton(aDesk, theNestedActions);
+  anAction->setData(theInfo.id);
+  anAction->setCheckable(theInfo.checkable);
+  anAction->setChecked(theInfo.checked);
+  anAction->setEnabled(theInfo.enabled);
+  anAction->setVisible(theInfo.visible);
+  anAction->setIcon(theInfo.icon);
+  anAction->setText(theInfo.text);
+  anAction->setToolTip(theInfo.toolTip);
+  anAction->setShortcut(theInfo.shortcut);
+  anAction->setFont(theInfo.font);
+
+  //int aItemId = createMenu(aId, aMenu, -1, 10);
+  int aToolId = createTool(anAction, aTool, aId);
+
+  return anAction;
 }
 
 
index f8834b760f75057ea9fbd719700c914c7560a0b1..89cfc45a2b1930599685bfedb4dd86f7a5ba7633 100644 (file)
@@ -57,6 +57,10 @@ Q_OBJECT
   virtual QAction* addFeature(const QString& theWBName,
                               const ActionInfo& theInfo);
 
+  virtual QAction* addNestedFeature(const QString& theWBName,
+                                    const ActionInfo& theInfo,
+                                    const QList<QAction*>& theNestedActions);
+
   virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
                                      const QString& theTip, const QIcon& theIcon,
                                      const QKeySequence& theKeys, bool isCheckable,
diff --git a/src/NewGeom/NewGeom_NestedButton.cpp b/src/NewGeom/NewGeom_NestedButton.cpp
new file mode 100644 (file)
index 0000000..ff42227
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * NewGeom_NestedButton.cpp
+ *
+ *  Created on: Apr 13, 2015
+ *      Author: sbh
+ */
+
+#include <NewGeom_NestedButton.h>
+
+#include <QAction>
+#include <QFrame>
+#include <QHBoxLayout>
+#include <QToolButton>
+
+NewGeom_NestedButton::NewGeom_NestedButton(QObject* theParent,
+                                           const QList<QAction*>& theNestedActions)
+: QWidgetAction(theParent),
+  myNestedActions(theNestedActions),
+  myAdditionalButtonsWidget(0),
+  myButtonFrame(0),
+  myThisButton(0)
+{
+}
+
+NewGeom_NestedButton::~NewGeom_NestedButton()
+{
+}
+
+void NewGeom_NestedButton::showAdditionalButtons(bool isShow)
+{
+  myAdditionalButtonsWidget->setVisible(isShow);
+  if (isShow) {
+    myButtonFrame->setFrameStyle(QFrame::WinPanel);
+    myButtonFrame->setFrameShadow(QFrame::Sunken);
+    myThisButton->setAutoRaise(false);
+  } else {
+    myButtonFrame->setFrameStyle(QFrame::NoFrame);
+    myButtonFrame->setFrameShadow(QFrame::Plain);
+    myThisButton->setAutoRaise(true);
+  }
+}
+
+QWidget * NewGeom_NestedButton::createWidget(QWidget * theParent)
+{
+  myButtonFrame = new QFrame(theParent);
+  QHBoxLayout* aBoxLay = new QHBoxLayout(myButtonFrame);
+  aBoxLay->setContentsMargins(2, 0, 0, 0);
+  aBoxLay->setSpacing(1);
+
+  myThisButton = new QToolButton(myButtonFrame);
+  myThisButton->setDefaultAction(this);
+  myThisButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+  aBoxLay->addWidget(myThisButton, 1);
+
+  myAdditionalButtonsWidget = new QWidget(myButtonFrame);
+  QHBoxLayout* aAdditionalBoxLay = new QHBoxLayout(myAdditionalButtonsWidget);
+  aAdditionalBoxLay->setContentsMargins(0, 0, 0, 0);
+  aAdditionalBoxLay->setSpacing(1);
+  foreach (QAction* eachAct, myNestedActions) {
+    QToolButton* aButton = new QToolButton(myButtonFrame);
+    aButton->setDefaultAction(eachAct);
+    aButton->setAutoRaise(true);
+    aAdditionalBoxLay->addWidget(aButton);
+  }
+  myAdditionalButtonsWidget->setLayout(aAdditionalBoxLay);
+  aBoxLay->addWidget(myAdditionalButtonsWidget);
+
+  myButtonFrame->setLayout(aBoxLay);
+
+  showAdditionalButtons(false);
+  connect(this, SIGNAL(toggled(bool)), this, SLOT(showAdditionalButtons(bool)));
+  connect(this, SIGNAL(changed()), this, SLOT(actionStateChanged()));
+  return myButtonFrame;
+}
+
+void NewGeom_NestedButton::actionStateChanged()
+{
+  if (isEnabled()) {
+    QString s = "true";
+  } else {
+    QString s = "false";
+  }
+  
+}
diff --git a/src/NewGeom/NewGeom_NestedButton.h b/src/NewGeom/NewGeom_NestedButton.h
new file mode 100644 (file)
index 0000000..7be12d4
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * NewGeom_NestedButton.h
+ *
+ *  Created on: Apr 13, 2015
+ *      Author: sbh
+ */
+
+#ifndef SRC_NEWGEOM_NEWGEOM_NESTEDBUTTON_H_
+#define SRC_NEWGEOM_NEWGEOM_NESTEDBUTTON_H_
+
+#include <QWidgetAction>
+
+class QFrame;
+class QAction;
+class QWidget;
+class QToolButton;
+
+/*!
+ * \ingroup Salome
+ * Custom (nested) button in salome mode.
+ */
+class NewGeom_NestedButton : public QWidgetAction
+{
+  Q_OBJECT
+ public:
+  NewGeom_NestedButton(QObject *parent, const QList<QAction*>& theNestedActions);
+  virtual ~NewGeom_NestedButton();
+
+ public slots:
+  /// Shows/hides the additional buttons widget
+  void showAdditionalButtons(bool);
+  void actionStateChanged();
+
+ protected:
+  /// Creates the button representation
+  virtual QWidget * createWidget(QWidget * theParent);
+
+ private:
+  QList<QAction*> myNestedActions; ///< list of nested actions
+  QWidget* myAdditionalButtonsWidget; ///< widget to precess additional buttons visibility
+  QFrame* myButtonFrame; ///< frame arround button representation
+  QToolButton* myThisButton; ///< main button
+};
+
+#endif /* SRC_NEWGEOM_NEWGEOM_NESTEDBUTTON_H_ */
index 79589ac4c6fa840149bf2d0f68bb6891a0eccc17..580a45e3255779ea3e78c8b445990f2345e1237f 100644 (file)
@@ -36,8 +36,6 @@ origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index 13aeada6f9f4fd19c766a85a48a363509d28aa8e..1e0880e68bbc6d980e8226c2dc433a1a11ef74b8 100644 (file)
@@ -50,8 +50,6 @@ origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index 5e99e051250f9e883848dcd6fe634dd08d581a50..751be751d52cb044582b19631421e81483301b43 100644 (file)
@@ -24,13 +24,11 @@ aDocument = aSession.moduleDocument()
 #=========================================================================
 aSession.startOperation()
 aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
 origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index 050c60f249e7084053c6cad865e887c80661c520..7a7a7d3faa92392503e7839b5b20bb2ad3717fdb 100644 (file)
@@ -22,13 +22,11 @@ aDocument = aSession.moduleDocument()
 #=========================================================================
 aSession.startOperation()
 aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
 origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index 4dc391889ed59c437751b40b12dcb0cf26386b88..87a388a65021fb5eaf48bd593810e67ceafbe5ab 100644 (file)
@@ -29,8 +29,6 @@ origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index 4f85ec44ecf22a0c97f9dcfcb387c1b36aab02eb..43d2c45bb3fc2a1c32010e6c692219b7ecc7718d 100644 (file)
@@ -25,13 +25,11 @@ aDocument = aSession.moduleDocument()
 #=========================================================================
 aSession.startOperation()
 aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
 origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index 965193b4e4ac188a5fdd787314204390ee8017e3..03eba23ccf379ae59722e2f90b440a10a59585ad 100644 (file)
@@ -29,8 +29,6 @@ origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index 64e15c899af7b1d0195aa9d8b7d9ec99618e05f0..837eb262695ded641b8737836bf0a6c3b7706fbd 100644 (file)
@@ -36,8 +36,6 @@ origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index 175823e1e1e775cce2692e439ebbda784be54171..9349352b32b4f4512ec674be73e694b5b1252517 100644 (file)
@@ -38,8 +38,6 @@ origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index e00acda2ca37e6a7a1952c1b4f8cb373a82c8ead..6a3a352c985c77bd3f9d2f69d733d7f5ef5cd521 100644 (file)
@@ -36,8 +36,6 @@ origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index a64b8a3a8c3db4293fa4bdbf982901ec5feaf90a..225447d3e308b50644dc17e06804fae0d1d38537 100644 (file)
@@ -25,13 +25,11 @@ aDocument = aSession.moduleDocument()
 #=========================================================================
 aSession.startOperation()
 aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
 origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index 9272b21ec1384559cc4890505d1c75b7e9eebc16..3a03d1d0e750dee73e0ce9be150f80cb50765145 100644 (file)
@@ -22,13 +22,11 @@ aDocument = aSession.moduleDocument()
 #=========================================================================
 aSession.startOperation()
 aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
 origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index 819cb00a566eff2a53d1b522a4c1445ba2691612..f745cdfa56eb1d48da1d8f93b3922f57973c84f7 100644 (file)
@@ -95,8 +95,6 @@ origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index 9927598a6882632ae357d43412826b4bb6bf6eca..9ab1394e0b587a817150b2c8880ef2fce8872444 100644 (file)
@@ -37,8 +37,6 @@ origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
index cbf0d05bf40f07f4d0f3fd332aac5eb178e70335..b37b0f61dd8ed40904ef4567ce0cf431ce7b2909 100644 (file)
@@ -19,8 +19,6 @@ origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
@@ -33,10 +31,6 @@ dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 assert (dirx.x() == 1)
 assert (dirx.y() == 0)
 assert (dirx.z() == 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-assert (diry.x() == 0)
-assert (diry.y() == 1)
-assert (diry.z() == 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 assert (norm.x() == 0)
 assert (norm.y() == 0)
index 4a0a31e53c0c8df2ca94a0fcdb0c5e8df1e380f1..e324fd2dab9d03fcfcca604eafa30a58b31f8974 100644 (file)
@@ -109,8 +109,6 @@ origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 #=========================================================================
index 129fdb2cfd9db0b6c6fe493c8034fc8dc2ce25f9..bdc91203b025b8dea63c8956eaaeabbbfd8ed10f 100644 (file)
@@ -299,6 +299,7 @@ void XGUI_ActionsMgr::setNestedStackEnabled(ModuleBase_Operation* theOperation)
     return;
   FeaturePtr aFeature = theOperation->feature();
   QString aFeatureId = QString::fromStdString(aFeature->getKind());
+  setActionEnabled(aFeatureId, true);
   setNestedCommandsEnabled(true, aFeatureId);
 
   setNestedStackEnabled(myOperationMgr->previousOperation(theOperation));
index 58e16daa26a1ed1a44e45e49badd85efea9821ce..dd564aba08280ce8f647e08a38eadbda7f37a1d4 100644 (file)
@@ -670,6 +670,8 @@ void XGUI_Displayer::setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bo
     closeLocalContexts(false);
   }
   aContext->SetDisplayMode(aAISIO, theMode, false);
+  // Redisplay in order to update new mode because it could be not computed before
+  aContext->Redisplay(aAISIO, false);
   if (aCanBeShaded) {
     openLocalContext();
     activateObjects(myActiveSelectionModes);
index 1fe9717fb9bf9f6623b39514ea2c530153f43fa5..dacd82f21309e94748432d0812e3d88dc9c5e504 100644 (file)
@@ -235,9 +235,10 @@ void XGUI_OperationMgr::onAbortOperation()
 void XGUI_OperationMgr::onOperationStarted()
 {
   ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
-  if (myOperations.count() == 1) {
-    emit nestedStateChanged(false);
-  }
+  
+  bool isNestedOk = (myOperations.count() >= 1) && 
+                     myOperations.at(0)->isValid();
+  emit nestedStateChanged(isNestedOk);
   emit operationStarted(aSenderOperation);
 }
 
@@ -250,7 +251,7 @@ void XGUI_OperationMgr::onOperationAborted()
 void XGUI_OperationMgr::onOperationCommitted()
 {
   ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
-  emit nestedStateChanged(true);
+  emit nestedStateChanged(myOperations.count() >= 1);
   emit operationCommitted(aSenderOperation);
 }
 
index 414ac4d66d07c793251863a6c5d81c5847ddad4c..312342e14e149a74d59eb5db486851325061f79b 100644 (file)
@@ -40,6 +40,13 @@ class XGUI_EXPORT XGUI_SalomeConnector
   virtual QAction* addFeature(const QString& theWBName,
                               const ActionInfo& theInfo) = 0;
 
+  //! Creates a feature (command) in SALOME desktop
+  //! \param theWBName - name of toolbar (workbench)
+  //! \param theInfo - information about action (icon, text, etc)
+  virtual QAction* addNestedFeature(const QString& theWBName,
+                                    const ActionInfo& theInfo,
+                                    const QList<QAction*>& theNestedActions) = 0;
+
   //! Creates a command in Edit menu of SALOME desktop
   //! \param theId - an id of the feature
   //! \param theTitle - a menu item string
index 42aa97e3000859a3b259ef7c55413428a5ca42b6..2ce90358a4d39955c2befe66419f860d8324ebdc 100644 (file)
@@ -762,8 +762,29 @@ void XGUI_Workshop::addFeature(const std::shared_ptr<Config_FeatureMessage>& the
   QStringList aNestedFeatures =
       QString::fromStdString(theMessage->nestedFeatures()).split(" ", QString::SkipEmptyParts);
   QString aDocKind = QString::fromStdString(theMessage->documentKind());
+  QList<QAction*> aNestedActList;
+  bool isColumnButton = !aNestedFeatures.isEmpty();
+  if (isColumnButton) {
+    QString aNestedActions = QString::fromStdString(theMessage->actionsWhenNested());
+    if (aNestedActions.contains("accept")) {
+      QAction* anAction = myActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL);
+      connect(anAction, SIGNAL(triggered()), myOperationMgr, SLOT(commitAllOperations()));
+      aNestedActList << anAction;
+    }
+    if (aNestedActions.contains("abort")) {
+      QAction* anAction = myActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll, NULL);
+      connect(anAction, SIGNAL(triggered()), myOperationMgr, SLOT(abortAllOperations()));
+      aNestedActList << anAction;
+    }
+  }
+
   if (isSalomeMode()) {
-    QAction* aAction = salomeConnector()->addFeature(aWchName, aFeatureInfo);
+    QAction* aAction;
+    if (isColumnButton) {
+      aAction = salomeConnector()->addNestedFeature(aWchName, aFeatureInfo, aNestedActList);
+    } else {
+      aAction = salomeConnector()->addFeature(aWchName, aFeatureInfo);
+    }
     salomeConnector()->setNestedActions(aFeatureInfo.id, aNestedFeatures);
     salomeConnector()->setDocumentKind(aFeatureInfo.id, aDocKind);
 
@@ -794,19 +815,7 @@ void XGUI_Workshop::addFeature(const std::shared_ptr<Config_FeatureMessage>& the
     // Enrich created button with accept/abort buttons if necessary
     AppElements_Button* aButton = aCommand->button();
     if (aButton->isColumnButton()) {
-      QString aNestedActions = QString::fromStdString(theMessage->actionsWhenNested());
-      QList<QAction*> anActList;
-      if (aNestedActions.contains("accept")) {
-        QAction* anAction = myActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, aButton);
-        connect(anAction, SIGNAL(triggered()), myOperationMgr, SLOT(commitAllOperations()));
-        anActList << anAction;
-      }
-      if (aNestedActions.contains("abort")) {
-        QAction* anAction = myActionsMgr->operationStateAction(XGUI_ActionsMgr::AbortAll, aButton);
-        connect(anAction, SIGNAL(triggered()), myOperationMgr, SLOT(abortAllOperations()));
-        anActList << anAction;
-      }
-      aButton->setAdditionalButtons(anActList);
+      aButton->setAdditionalButtons(aNestedActList);
     }
     myActionsMgr->addCommand(aCommand);
     myModule->actionCreated(aCommand);