]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2612: Add a button for auto apply feature.
authorvsv <vsv@opencascade.com>
Tue, 4 Sep 2018 10:23:15 +0000 (13:23 +0300)
committervsv <vsv@opencascade.com>
Tue, 4 Sep 2018 10:23:15 +0000 (13:23 +0300)
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h
src/XGUI/XGUI_pictures.qrc
src/XGUI/pictures/autoapply.png [new file with mode: 0644]

index a1ae91d19785ea74489c07b27c0a4d771d04cdcc..9c6c4fd88358b5e6af15afd94a02c7791386b3e5 100755 (executable)
@@ -412,7 +412,7 @@ void XGUI_Workshop::initMenu()
                                                         QKeySequence::Undo, false,
                                                         "MEN_DESK_EDIT");
   QString aToolBarTitle = tr( "INF_DESK_TOOLBAR_STANDARD" );
-  salomeConnector()->addActionInToolbar( aAction,aToolBarTitle  );
+  salomeConnector()->addActionInToolbar( aAction,aToolBarTitle );
 
   connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onUndo()));
   addHistoryMenu(aAction, SIGNAL(updateUndoHistory(const QList<ActionInfo>&)), SLOT(onUndo(int)));
@@ -427,6 +427,18 @@ void XGUI_Workshop::initMenu()
 
   salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");
 
+  aAction = salomeConnector()->addDesktopCommand("AUTOCOMPUTE_CMD", tr("Block auto-apply"),
+                                              tr("Blocks immediate apply of modifications"),
+                                              QIcon(":pictures/autoapply.png"), QKeySequence(),
+                                              true, "MEN_DESK_EDIT");
+  salomeConnector()->addActionInToolbar( aAction, aToolBarTitle );
+
+  connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onAutoApply(bool)));
+
+  salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");
+
+
+  // Add commands to a file menu
   aAction = salomeConnector()->addDesktopCommand("SAVEAS_CMD", tr("Export native..."),
                                              tr("Export the current document into a native file"),
                                               QIcon(), QKeySequence(),
@@ -477,7 +489,16 @@ void XGUI_Workshop::initMenu()
                                 QIcon(":pictures/open.png"), QKeySequence::Open);
   aCommand->connectTo(this, SLOT(onOpen()));
 
-  aCommand = aGroup->addFeature("EXEC_CMD", tr("Launch Script"), tr("Launch Python script file"),
+
+  aCommand = aGroup->addFeature("AUTOCOMPUTE_CMD", tr("Block auto-apply"),
+                                tr("Blocks immediate apply of modifications"),
+                                QIcon(":pictures/autoapply.png"), QString(),
+                                QKeySequence(), true, true);
+  aCommand->setChecked(ModelAPI_Session::get()->isAutoUpdateBlocked());
+  aCommand->connectTo(this, SLOT(onAutoApply(bool)));
+
+
+  aCommand = aGroup->addFeature("EXEC_CMD", tr("Launch script"), tr("Launch Python script file"),
                                 QIcon(":pictures/assembly.png"), QKeySequence());
   aCommand->connectTo(this, SLOT(onFileExec()));
 
@@ -2810,3 +2831,9 @@ void XGUI_Workshop::onFileExec()
   }
 }
 #endif
+
+void XGUI_Workshop::onAutoApply(bool isToggle)
+{
+  SessionPtr aMgr = ModelAPI_Session::get();
+  aMgr->blockAutoUpdate(isToggle);
+}
\ No newline at end of file
index 84eb52ecee11ebf6d7d51826142ae8828a9e1c5b..186d66eb8d86d5403612bf64ecae0c683159a4b9 100755 (executable)
@@ -397,6 +397,9 @@ signals:
   void onFileExec();
 #endif
 
+  /// A slot calleon toggle of auto-compute button
+  void onAutoApply(bool isToggle);
+
   /// Activates/deactivates the trihedron in the viewer AIS context
   void onTrihedronVisibilityChanged(bool theState);
 
index 913ca9b006711b083ec2e68edc21483ebeac384f..81b392d43a8b57e982025ff18a4d4ad34d582bcd 100644 (file)
@@ -74,5 +74,6 @@
      <file>pictures/move_out_after.png</file>
      <file>pictures/move_out_before.png</file>
      <file>pictures/selection.png</file>
+     <file>pictures/autoapply.png</file>
  </qresource>
  </RCC>
diff --git a/src/XGUI/pictures/autoapply.png b/src/XGUI/pictures/autoapply.png
new file mode 100644 (file)
index 0000000..2a626e0
Binary files /dev/null and b/src/XGUI/pictures/autoapply.png differ