From: vsv Date: Tue, 4 Sep 2018 10:23:15 +0000 (+0300) Subject: Issue #2612: Add a button for auto apply feature. X-Git-Tag: V9_2_0a1~66 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8431c943bf3c4666ed1890e99c31ff47dc535da1;p=modules%2Fshaper.git Issue #2612: Add a button for auto apply feature. --- diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index a1ae91d19..9c6c4fd88 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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&)), 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 diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 84eb52ece..186d66eb8 100755 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -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); diff --git a/src/XGUI/XGUI_pictures.qrc b/src/XGUI/XGUI_pictures.qrc index 913ca9b00..81b392d43 100644 --- a/src/XGUI/XGUI_pictures.qrc +++ b/src/XGUI/XGUI_pictures.qrc @@ -74,5 +74,6 @@ pictures/move_out_after.png pictures/move_out_before.png pictures/selection.png + pictures/autoapply.png diff --git a/src/XGUI/pictures/autoapply.png b/src/XGUI/pictures/autoapply.png new file mode 100644 index 000000000..2a626e0c2 Binary files /dev/null and b/src/XGUI/pictures/autoapply.png differ