/// Restart sketcher operations automatically
if (!mySketchReentrantMgr->operationCommitted(theOperation)) {
-
- ModuleBase_OperationFeature* aFOperation =
- dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
- if (aFOperation && !aFOperation->isEditOperation()) {
- // the selection is cleared after commit the create operation
- // in order to do not use the same selected objects in the restarted operation
- // for common behaviour, the selection is cleared even if the operation is not restarted
- getWorkshop()->selector()->clearSelection();
- }
+ getWorkshop()->selector()->clearSelection();
}
}
/// deactivate of overconstraint listener should be performed after Sketch abort (#2176)
if (PartSet_SketcherMgr::isSketchOperation(theOperation))
overconstraintListener()->setActive(false);
+
+ getWorkshop()->selector()->clearSelection();
}
//******************************************************
void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) {
+ SessionPtr aMgr = ModelAPI_Session::get();
+ if (!aMgr->hasModuleDocument()) // if document is closed, do not call the document creation
+ return;
// Do not change activation of parts if an operation active
static QStringList aAllowActivationList;
if (aAllowActivationList.isEmpty())
(!aAllowActivationList.contains(myWorkshop->currentOperation()->id())))
return;
XGUI_Workshop* aWorkshop = getWorkshop();
- XGUI_DataTree* aTreeView = aWorkshop->objectBrowser()->treeView();
- QLabel* aLabel = aWorkshop->objectBrowser()->activeDocLabel();
- QPalette aPalet = aLabel->palette();
+ bool needUpdate = false;
+ XGUI_DataTree* aTreeView;
+ if (aWorkshop->objectBrowser()) {
+ aTreeView = aWorkshop->objectBrowser()->treeView();
+ QLabel* aLabel = aWorkshop->objectBrowser()->activeDocLabel();
+ QPalette aPalet = aLabel->palette();
- SessionPtr aMgr = ModelAPI_Session::get();
- DocumentPtr aActiveDoc = aMgr->activeDocument();
+ DocumentPtr aActiveDoc = aMgr->activeDocument();
- // 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();
+ // 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;
- myActivePartIndex = aDataModel->documentRootIndex(aActiveDoc, 0);
- bool needUpdate = false;
- if (myActivePartIndex.isValid()) {
- needUpdate = aTreeView->isExpanded(myActivePartIndex);
- if (!needUpdate)
- aTreeView->setExpanded(myActivePartIndex, true);
- }
- if ((aOldActive != myActivePartIndex) && (aOldActive.isValid()))
- aTreeView->setExpanded(aOldActive, false);
+ XGUI_DataModel* aDataModel = aWorkshop->objectBrowser()->dataModel();
+ QModelIndex aOldActive = myActivePartIndex;
+ myActivePartIndex = aDataModel->documentRootIndex(aActiveDoc, 0);
+ if (myActivePartIndex.isValid()) {
+ needUpdate = aTreeView->isExpanded(myActivePartIndex);
+ if (!needUpdate)
+ aTreeView->setExpanded(myActivePartIndex, true);
+ }
+ if ((aOldActive != myActivePartIndex) && (aOldActive.isValid()))
+ aTreeView->setExpanded(aOldActive, false);
- aLabel->setPalette(aPalet);
+ aLabel->setPalette(aPalet);
+ }
aWorkshop->updateCommandStatus();
// Update displayed objects in order to update active color