From 8431c943bf3c4666ed1890e99c31ff47dc535da1 Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 4 Sep 2018 13:23:15 +0300 Subject: [PATCH] Issue #2612: Add a button for auto apply feature. --- src/XGUI/XGUI_Workshop.cpp | 31 +++++++++++++++++++++++++++++-- src/XGUI/XGUI_Workshop.h | 3 +++ src/XGUI/XGUI_pictures.qrc | 1 + src/XGUI/pictures/autoapply.png | Bin 0 -> 707 bytes 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 src/XGUI/pictures/autoapply.png 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 0000000000000000000000000000000000000000..2a626e0c2230527d25aba1d26485430ca4ad452e GIT binary patch literal 707 zcmV;!0zCbRP)N2bZe?^J zG%heMGBNQWX_Wu~0zgSbK~y+TW4L|$Hc41Ko`FfZl)YG~m^BZ`X2YroA6Bd2Y%Dqw z|FimB#$TO!p{-aI;le;0CEaG|-J5>9j-=5P||C>%1{nx1x+y<3mV6g5}xd}7b zXP)VO`FtirWCNtr7?ixHnLZ6H@ceJ;Z1`W- zyZOI;pXybhlf}T2Kw!`)y4N?)?Z0=F`~U9!4S%vH#BMY-H9adSDcJ#5Aeq7-0!wn!WY8o~keQhe@#s4u!E+W)JT)vivy*7#plQ{}%;quoc@L>3nzAt5d^GqX@7C8cLT zHXaU=nAjmcp z3=$I%5WqA57CvP0BQ)kMg?z`RyF@* p2Y0&~MMcG9z(7OCN1dFU3ISxg=2M%=J$wKF002ovPDHLkV1kY~I?Mn7 literal 0 HcmV?d00001 -- 2.39.2