-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "XGUI_Workshop.h"
aCommand->connectTo(this, SLOT(onOpen()));
- //aCommand = aGroup->addFeature("AUTOCOMPUTE_CMD", tr("Auto rebuild"),
- // tr("Blocks immediate apply of modifications"),
- // QIcon(":pictures/autoapply_start.png"), QKeySequence());
- //aCommand->setChecked(ModelAPI_Session::get()->isAutoUpdateBlocked());
- //aCommand->connectTo(this, SLOT(onAutoApply()));
+ aCommand = aGroup->addFeature("AUTOCOMPUTE_CMD", tr("Auto rebuild"),
+ tr("Blocks immediate apply of modifications"),
+ QIcon(":pictures/autoapply_start.png"), QKeySequence());
+ aCommand->setChecked(ModelAPI_Session::get()->isAutoUpdateBlocked());
+ aCommand->connectTo(this, SLOT(onAutoApply()));
aCommand = aGroup->addFeature("PREF_CMD", tr("Preferences"), tr("Edit preferences"),
QIcon(":pictures/preferences.png"), QKeySequence::Preferences);
aMgr->blockAutoUpdate(false);
std::list<std::string> aFiles;
- saveDocument(myTmpDir.path(), aFiles);
- if (!XGUI_CompressFiles::compress(myCurrentFile, aFiles))
- return false;
+ // issue #2899: create a temporary directory, save and then remove it
+#ifdef HAVE_SALOME
+ std::string aTmpDir = XGUI_Tools::getTmpDirByEnv("SALOME_TMP_DIR");
+#else
+ std::string aTmpDir = XGUI_Tools::getTmpDirByEnv("");
+#endif
+ saveDocument(QString(aTmpDir.c_str()), aFiles);
+ bool aResult = XGUI_CompressFiles::compress(myCurrentFile, aFiles);
+ XGUI_Tools::removeTemporaryFiles(aTmpDir, aFiles);
- updateCommandStatus();
+ if (aResult) {
+ updateCommandStatus();
#ifndef HAVE_SALOME
myMainWindow->setModifiedState(false);
#endif
- return true;
+ }
+ return aResult;
}
//******************************************************
else
aCmd->setEnabled(myModule->canRedo());
}
- //else if (aId == "AUTOCOMPUTE_CMD") {
- // aCmd->setIcon(aMgr->isAutoUpdateBlocked() ?
- // QIcon(":pictures/autoapply_stop.png") :
- // QIcon(":pictures/autoapply_start.png"));
- //}
+ else if (aId == "AUTOCOMPUTE_CMD") {
+ aCmd->setIcon(aMgr->isAutoUpdateBlocked() ?
+ QIcon(":pictures/autoapply_stop.png") :
+ QIcon(":pictures/autoapply_start.png"));
+ }
else
// Enable all commands
aCmd->setEnabled(true);
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
if (aRes.get() && (!aRes->shape().get() || aRes->shape()->isNull()))
continue;
- myDisplayer->display(aObj, false);
+ ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aObj);
+ if (aResBody.get())
+ synchronizeResultTree(aResBody, false);
+ else
+ myDisplayer->display(aObj, false);
}
}
if (theUpdateViewer)
myDisplayer->updateViewer();
}
+
+void XGUI_Workshop::synchronizeResultTree(const ResultBodyPtr& theRes, bool theUpdateViewer)
+{
+ if (theRes->numberOfSubs() > 0)
+ for (int i = 0; i < theRes->numberOfSubs(); i++) {
+ ResultBodyPtr aRes = theRes->subResult(i);
+ if (aRes.get())
+ synchronizeResultTree(aRes, theUpdateViewer);
+ }
+ else
+ myDisplayer->display(theRes, theUpdateViewer);
+}
#endif
//******************************************************
aMgr->blockAutoUpdate(!isBlocked);
}
-//void XGUI_Workshop::updateAutoComputeState()
-//{
-// SessionPtr aMgr = ModelAPI_Session::get();
-// bool isComputeBlocked = aMgr->isAutoUpdateBlocked();
-//#ifdef HAVE_SALOME
+void XGUI_Workshop::updateAutoComputeState()
+{
+ SessionPtr aMgr = ModelAPI_Session::get();
+ bool isComputeBlocked = aMgr->isAutoUpdateBlocked();
+#ifdef HAVE_SALOME
// QAction* aUpdateCmd;
// QList<QAction*> aCommands = mySalomeConnector->commandList();
// foreach(QAction* aCmd, aCommands) {
// }
// aUpdateCmd->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") :
// QIcon(":pictures/autoapply_start.png"));
-//#else
-// AppElements_MainMenu* aMenuBar = myMainWindow->menuObject();
-// AppElements_Command* aUpdateCmd = aMenuBar->feature("AUTOCOMPUTE_CMD");
-// aUpdateCmd->button()->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") :
-// QIcon(":pictures/autoapply_start.png"));
-//#endif
-//}
+#else
+ AppElements_MainMenu* aMenuBar = myMainWindow->menuObject();
+ AppElements_Command* aUpdateCmd = aMenuBar->feature("AUTOCOMPUTE_CMD");
+ aUpdateCmd->button()->setIcon(isComputeBlocked? QIcon(":pictures/autoapply_stop.png") :
+ QIcon(":pictures/autoapply_start.png"));
+#endif
+}
void XGUI_Workshop::clearTemporaryDir()