void Model_Session::closeAll()
{
Model_Application::getApplication()->deleteAllDocuments();
+ static const Events_ID aDocChangeEvent = Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED);
+ static std::shared_ptr<Events_Message> aMsg(new Events_Message(aDocChangeEvent));
+ Events_Loop::loop()->send(aMsg);
+ Events_Loop::loop()->flush(aDocChangeEvent);
}
void Model_Session::startOperation(const std::string& theId, const bool theAttachedToNested)
#include <ModelAPI_Session.h>
#include <ModelAPI_Tools.h>
#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Events.h>
//--------------------------------------------------------------------------------------
#include <Config_ModuleReader.h>
//--------------------------------------------------------------------------------------
// close all before importation of the script
theSession->closeAll();
-
// execute the dumped
PyGILState_STATE gstate = PyGILState_Ensure(); /* acquire python thread */
static char aReadMode[] = "r";
SessionPtr aMgr = ModelAPI_Session::get();
DocumentPtr aActiveDoc = aMgr->activeDocument();
- // workaround for #2431 (SISGSEGV when launching some unit tests from GUI)
- //if (myActivePartIndex.isValid())
- // aTreeView->setExpanded(myActivePartIndex, false);
+
+ // Clear active part index if there is no Part documents
+ // It could be not null if document was closed and opened a new
+ // without closeDocument call
+ if (aMgr->allOpenedDocuments().size() <= 1)
+ myActivePartIndex = QModelIndex();
XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel();
QModelIndex aOldActive = myActivePartIndex;
Qt::ItemFlags PartSet_PartRootNode::flags(int theColumn) const
{
if (myObject->isDisabled())
- return (theColumn == 2) ? Qt::ItemIsSelectable : aNullFlag;
+ return (theColumn == 2) ? Qt::ItemIsSelectable : aDefaultFlag;
SessionPtr aSession = ModelAPI_Session::get();
DocumentPtr aActiveDoc = aSession->activeDocument();