From 50c0ccb84aa5d196a71a8edac332cfcc21bb5462 Mon Sep 17 00:00:00 2001 From: Alexey Kondratyev Date: Mon, 18 Oct 2021 11:12:43 +0300 Subject: [PATCH] bos #26446 Customize study opening; bos #26447 Customize script execution * Add tab "General" in Preferences window. * Add algorithm to update displaying elements depending of settings. * Update opening file algorithm to activating parts depending of settings. * Update activating part algorithm to display elements depending of settings. * Update activating part algorithm to display elements depending of sub elements. * Update the documentation. --- doc/gui/General/Introduction.rst | 36 +++++++- doc/gui/images/general_preferences.png | Bin 0 -> 18751 bytes src/ModelHighAPI/CMakeLists.txt | 2 + src/ModelHighAPI/ModelHighAPI_Interface.cpp | 2 +- src/ModelHighAPI/ModelHighAPI_Services.cpp | 5 +- src/ModuleBase/ModuleBase_Preferences.cpp | 60 +++++++++++++ src/ModuleBase/ModuleBase_Preferences.h | 6 ++ src/ModuleBase/ModuleBase_Tools.cpp | 93 +++++++++++++++++++ src/ModuleBase/ModuleBase_Tools.h | 5 ++ src/ModuleBase/ModuleBase_msg_fr.ts | 56 +++++++++++- src/PartSet/PartSet_MenuMgr.cpp | 6 ++ src/SHAPERGUI/resources/LightApp.xml.in | 6 ++ src/XGUI/SHAPER.xml | 6 ++ src/XGUI/XGUI_Workshop.cpp | 31 +++++++ src/XGUI/XGUI_WorkshopListener.cpp | 94 ++++++++++++-------- src/XGUI/XGUI_WorkshopListener.h | 3 + 16 files changed, 369 insertions(+), 42 deletions(-) create mode 100644 doc/gui/images/general_preferences.png diff --git a/doc/gui/General/Introduction.rst b/doc/gui/General/Introduction.rst index 35e17284c..3cb1c45b2 100644 --- a/doc/gui/General/Introduction.rst +++ b/doc/gui/General/Introduction.rst @@ -451,6 +451,7 @@ To call **Preferences** dialog box: SHAPER preferences contains the following tabs: +- :ref:`general_preferences`; - :ref:`visualization_preferences`; - :ref:`plugins_preferences`; - :ref:`shortcuts_preferences`; @@ -458,10 +459,43 @@ SHAPER preferences contains the following tabs: - :ref:`sketch_preferences`. - :ref:`viewer_preferences`. -Visualization tab is activated by default when **Preferences** dialog box is opened in the active SHAPER module. +General tab is activated by default when **Preferences** dialog box is opened in the active SHAPER module. Other tabs are activated by click on tab header. +.. _general_preferences: + +General tab +^^^^^^^^^^^ + +This tab defines what parts to be activated and what elements to be visible after opening a study or a script. + +.. figure:: /images/general_preferences.png + :align: center + + **Preferences**: General tab + +**Input fields**: + +- **Activate** relates to activation of part when opening a HDF document. Its could be one of the following: + + - "Last part" - activate last part in the document (**default value**); + - "All parts" - activate all parts within the document; + - "No activation" - do not activate any part. + +- **Display** in "Opening a study". It specifies the shapes, which should be visualized when activating a part. It could be one of the following: + + - "As stored in HDF" - display only the shapes visible before the document is saved (**default value**); + - "Last item in each folder" - show only the last result in each folder of the part: Constructions, Results, Groups, Fields; + - "All items" - show all shapes from each folder; + - "No visualization" - do not display any shape. + +- **Display** in "Launching a python script". It specifies the shapes, which should be visualized when loading a script using "File -> Load Script..." menu. It could be one of the following: + + - "Last item in each folder" - show only the last result in each folder of the part: Constructions, Results, Groups, Fields; + - "All items" - show all shapes from each folder(**default value**); + - "No visualization" - do not display any shape. + .. _visualization_preferences: Visualization tab diff --git a/doc/gui/images/general_preferences.png b/doc/gui/images/general_preferences.png new file mode 100644 index 0000000000000000000000000000000000000000..e7eee1721dfa4896351afd9cdf0e1fea2129cd42 GIT binary patch literal 18751 zcmeIaXIN8P+b$ZHOVOo(iqat}Dk5Ea3o1(xX#&zqkVp$PbV5R`ptRTk=}SR+k&cu^ zgd|Ff^qvS25JC$f1PDn^e82PU^PRoFz5kr+{Cj_J<;s|3W@gMWp69vm=f3CjJC-K= ze~JGE008(+Z~bip02~AY0DnXrIm{brZnIG2y&MR$F}VS#>X%&Nz4_DUy2W(>pay+x z|K1_q`=cSZoWcMAfzIE52MEC>_W^)g!=`^noI>X=Q=7p5qL;ZR4=2^_c(;DY4 zbV-+19u=A@%=%;D&XGX=_B+{`pK{(o&XUj}AjBnzRka3C0Rr{Q{L@GLk-K=6RMpe; ze_nrn@#bv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G!(1`*vvt$X~Y-bpMTEE-5vB+@iq@GNA8gW33+C!xN$cF(Q94wnro%vY5 zJ0sa2%$)U=49ZZwONSY|)~aVgHK2B(Fj6Kz`q7H+I-u+lBT&t+ry=kh~GM?2f} z&gG&ahltYMyMF})SK_IYZ}P1X0GHMlPwJqVK#k$AGAL6MB`60W`iAPsA zMx>3^bL@UOkV-&SCq3ca>wc4&Bq1{&>3ubUi4kltb^#|s;& zp}tkrm({hrcv=yeLLxu0$7ZWOBCmCRyOrwqYHuAzxz4z*Qk3Opf!P^#t~74nD~Zf} zA{>a3CE%JGKb;zVR}~OCGW_>NyMhmD$4kZRXct#z;{50{&JjO?9Z0^LnJ`jsrWg1X zteVEQ+zU6SwqJFw;j!t>zDro?au9d-NHn;)*#`P3k8?4mm16hm4e@-yE&F0 zHb7AZ{MKCz#-<%(Ng9-DWecZcch>=+-mL6&aua7NE(kg_wH6wYGPUth{~JIBlST;V z$7cBbO2i9U2F3{`9$bEi&FU^B@; zpWFz04bAV@C*qdQsxsJt9M1;%;Pfg2d&v)G6|cPTb~=vo^(`r`lZ}!3+bGcRLFYsA zWJd}MlJ*9SlmRm2zdYhcw7yg4u|%2BsmFEfZ8R_29G;2;Bpk$^F`~P)qMQS@#y~oOrke5 literal 0 HcmV?d00001 diff --git a/src/ModelHighAPI/CMakeLists.txt b/src/ModelHighAPI/CMakeLists.txt index 2d7a4917f..07adac9db 100644 --- a/src/ModelHighAPI/CMakeLists.txt +++ b/src/ModelHighAPI/CMakeLists.txt @@ -58,6 +58,7 @@ SET(PROJECT_LIBRARIES Locale ModelAPI ModelGeomAlgo + ModuleBase ) ADD_DEFINITIONS(-DMODELHIGHAPI_EXPORTS -DWNT) @@ -87,6 +88,7 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/Locale ${PROJECT_SOURCE_DIR}/src/ModelAPI ${PROJECT_SOURCE_DIR}/src/ModelGeomAlgo + ${PROJECT_SOURCE_DIR}/src/ModuleBase ${PROJECT_SOURCE_DIR}/src/PartSetPlugin ${OpenCASCADE_INCLUDE_DIR} ) diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.cpp b/src/ModelHighAPI/ModelHighAPI_Interface.cpp index 82423fb0b..bd87cd0e4 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Interface.cpp @@ -82,7 +82,7 @@ void ModelHighAPI_Interface::execute(bool isForce) Events_Loop* aLoop = Events_Loop::loop(); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); - //aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); //aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); } diff --git a/src/ModelHighAPI/ModelHighAPI_Services.cpp b/src/ModelHighAPI/ModelHighAPI_Services.cpp index 09dea983c..763798c8b 100644 --- a/src/ModelHighAPI/ModelHighAPI_Services.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Services.cpp @@ -26,6 +26,8 @@ #include #include +#include + #include #include @@ -106,8 +108,9 @@ void begin() aNbTransactions = aNbUndo; ++aTransactionID; } + static std::string anOperationPrefix(ModuleBase_Tools::translate("", "Operation").toStdString()); std::ostringstream aTransactionName; - aTransactionName << "Operation_" << aTransactionID; + aTransactionName << anOperationPrefix << "_" << aTransactionID; ModelAPI_Session::get()->startOperation(aTransactionName.str()); } diff --git a/src/ModuleBase/ModuleBase_Preferences.cpp b/src/ModuleBase/ModuleBase_Preferences.cpp index c651c7d46..229603f83 100644 --- a/src/ModuleBase/ModuleBase_Preferences.cpp +++ b/src/ModuleBase/ModuleBase_Preferences.cpp @@ -35,6 +35,7 @@ const QString ModuleBase_Preferences::VIEWER_SECTION = "Viewer"; const QString ModuleBase_Preferences::MENU_SECTION = "Menu"; +const QString ModuleBase_Preferences::GENERAL_SECTION = "General"; SUIT_ResourceMgr* ModuleBase_Preferences::myResourceMgr = 0; @@ -115,6 +116,7 @@ void ModuleBase_Preferences::loadCustomProps() void ModuleBase_Preferences::createEditContent(ModuleBase_IPrefMgr* thePref, int thePage) { thePref->prefMgr()->setItemIcon(thePage, QIcon(":pictures/module.png")); + createGeneralTab(thePref, thePage); createCustomPage(thePref, thePage); } @@ -150,6 +152,64 @@ void ModuleBase_Preferences::resetConfigPropPreferences(SUIT_PreferenceMgr* theP } } +void ModuleBase_Preferences::createGeneralTab(ModuleBase_IPrefMgr* thePref, int thePageId) +{ + int generalTab = thePref->addPreference(QObject::tr("General"), thePageId, + SUIT_PreferenceMgr::Auto, QString(), QString()); + thePref->setItemProperty("columns", 2, generalTab); + + QStringList actItemList; + actItemList << QObject::tr("Last part") + << QObject::tr("All parts") + << QObject::tr("No activation"); + + QList actIdList; + actIdList << 0 << 1 << 2; + + // Group related to opening a study + int group = thePref->addPreference(QObject::tr("Opening a study"), generalTab, + SUIT_PreferenceMgr::Auto, QString(), QString()); + + int actId = thePref->addPreference(QObject::tr("Activate"), group, SUIT_PreferenceMgr::Selector, + ModuleBase_Preferences::GENERAL_SECTION, + "part_activation_study"); + thePref->setItemProperty("strings", actItemList, actId); + thePref->setItemProperty("indexes", actIdList, actId); + + QStringList visuItemList; + visuItemList << QObject::tr("As stored in HDF") + << QObject::tr("Last item in each folder") + << QObject::tr("All items") + << QObject::tr("No visualization"); + + QList visuIdList; + visuIdList << 0 << 1 << 2 << 3; + + int visuId = thePref->addPreference(QObject::tr("Display"), group, SUIT_PreferenceMgr::Selector, + ModuleBase_Preferences::GENERAL_SECTION, + "part_visualization_study"); + thePref->setItemProperty("strings", visuItemList, visuId); + thePref->setItemProperty("indexes", visuIdList, visuId); + + // Group related to running a python script + group = thePref->addPreference(QObject::tr("Launching a python script"), generalTab, + SUIT_PreferenceMgr::Auto, QString(), QString()); + + visuItemList.clear(); + visuItemList << QObject::tr("Last item in each folder") + << QObject::tr("All items") + << QObject::tr("No visualization"); + + visuIdList.clear(); + visuIdList << 0 << 1 << 2; + + visuId = thePref->addPreference(QObject::tr("Display"), group, SUIT_PreferenceMgr::Selector, + ModuleBase_Preferences::GENERAL_SECTION, + "part_visualization_script"); + thePref->setItemProperty("strings", visuItemList, visuId); + thePref->setItemProperty("indexes", visuIdList, visuId); +} + void ModuleBase_Preferences::createCustomPage(ModuleBase_IPrefMgr* thePref, int thePageId) { SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr(); diff --git a/src/ModuleBase/ModuleBase_Preferences.h b/src/ModuleBase/ModuleBase_Preferences.h index 985262569..65b2a2d7a 100644 --- a/src/ModuleBase/ModuleBase_Preferences.h +++ b/src/ModuleBase/ModuleBase_Preferences.h @@ -47,6 +47,9 @@ class MODULEBASE_EXPORT ModuleBase_Preferences /// Name of preferences of menu section static const QString MENU_SECTION; + /// Name of preferences of general section + static const QString GENERAL_SECTION; + /// Shows a dialog box to edit preferences /// \param theModified a list of modified preferences static bool editPreferences(ModuleBase_Prefs& theModified); @@ -83,6 +86,9 @@ private: /// Set default values to the Config_PropManager properties static void resetConfig(); + /// Creates a content for General tab, which defines behavior of loading parts and displaying shapes + static void createGeneralTab(ModuleBase_IPrefMgr* thePref, int thePageId); + /// Creates content of preferences editing widget static void createCustomPage(ModuleBase_IPrefMgr* thePref, int thePageId); diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index b014d60de..1b5bfc9a3 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -36,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +55,12 @@ #include +#ifdef HAVE_SALOME +#include +#include +#include +#endif + #include #include #include @@ -108,6 +116,51 @@ namespace ModuleBase_Tools { //****************************************************************** + //! Waits for REDISPLAY message and set the Visible flag to the entities + //! according to Preferences choice. + class ModuleBase_RedisplayListener : public Events_Listener + { + public: + static std::shared_ptr instance() + { + static std::shared_ptr + anInstance(new ModuleBase_RedisplayListener); + return anInstance; + } + + void processEvent(const std::shared_ptr& theMessage) + { + if (theMessage->eventID() == Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)) + { +#if HAVE_SALOME + // If the python script is being loaded now, the preferences should be used + // to display the required object + SUIT_Application * app = SUIT_Session::session()->activeApplication(); + QVariant aVar = app->property("IsLoadedScript"); + if (!aVar.isNull() && aVar.toBool()) { + DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); + int aSize = aRootDoc->size(ModelAPI_ResultPart::group()); + if (aSize > 0) { + ObjectPtr anPartObject = aRootDoc->object(ModelAPI_ResultPart::group(), aSize - 1); + ResultPartPtr aPart = std::dynamic_pointer_cast(anPartObject); + ModuleBase_Tools::setDisplaying(aPart, true); + } + } +#endif + } + } + + private: + ModuleBase_RedisplayListener() + { + Events_Loop::loop()->registerListener(this, + Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + } + }; + + static std::shared_ptr + RL = ModuleBase_RedisplayListener::instance(); + //****************************************************************** void adjustMargins(QWidget* theWidget) @@ -1342,6 +1395,46 @@ qreal currentPixelRatio() } +// Set displaying status to every element on group +static void setDisplayingByLoop(DocumentPtr theDoc, int theSize, + std::string theGroup, bool theDisplayFromScript) +{ + int aDisplayingId = -1; + if (theDisplayFromScript) { + aDisplayingId = ModuleBase_Preferences::resourceMgr()->integerValue("General", + "part_visualization_script", -1); + // Increase ID to prevert using "As stored in HDF" + ++aDisplayingId; + } + else { + aDisplayingId = ModuleBase_Preferences::resourceMgr()->integerValue("General", + "part_visualization_study", -1); + + // if chosen "As stored in HDF" then don't change displaying + if (aDisplayingId == 0) + return; + } + + for (int anIndex = theSize - 1; anIndex >= 0; --anIndex) { + ObjectPtr anObject = theDoc->object(theGroup, anIndex); + anObject->setDisplayed((aDisplayingId == 1 && anIndex == theSize - 1) || aDisplayingId == 2); + } +} + +void setDisplaying(ResultPartPtr thePart, bool theDisplayFromScript) +{ + DocumentPtr aDoc = thePart->partDoc(); + int aConstructionSize = aDoc->size(ModelAPI_ResultConstruction::group()); + int aGroupSize = aDoc->size(ModelAPI_ResultGroup::group()); + int aFieldSize = aDoc->size(ModelAPI_ResultField::group()); + int aResultSize = aDoc->size(ModelAPI_ResultBody::group()); + setDisplayingByLoop(aDoc, aConstructionSize, + ModelAPI_ResultConstruction::group(), theDisplayFromScript); + setDisplayingByLoop(aDoc, aGroupSize, ModelAPI_ResultGroup::group(), theDisplayFromScript); + setDisplayingByLoop(aDoc, aFieldSize, ModelAPI_ResultField::group(), theDisplayFromScript); + setDisplayingByLoop(aDoc, aResultSize, ModelAPI_ResultBody::group(), theDisplayFromScript); +} + } // namespace ModuleBase_Tools diff --git a/src/ModuleBase/ModuleBase_Tools.h b/src/ModuleBase/ModuleBase_Tools.h index a68f2ee9e..cae27a1d9 100644 --- a/src/ModuleBase/ModuleBase_Tools.h +++ b/src/ModuleBase/ModuleBase_Tools.h @@ -406,6 +406,11 @@ std::wstring MODULEBASE_EXPORT generateName(const AttributePtr& theAttribute, /// Returns pixel ratio of a screen where main window is displayed qreal MODULEBASE_EXPORT currentPixelRatio(); + +/// Set displaying status for elements from part depending on the settings +/// \param thePart a pointer of part +void MODULEBASE_EXPORT setDisplaying(std::shared_ptr thePart, + bool theDisplayFromScript = false); } #endif diff --git a/src/ModuleBase/ModuleBase_msg_fr.ts b/src/ModuleBase/ModuleBase_msg_fr.ts index 050f6abb6..39de141b1 100644 --- a/src/ModuleBase/ModuleBase_msg_fr.ts +++ b/src/ModuleBase/ModuleBase_msg_fr.ts @@ -278,13 +278,61 @@ Replace Remplacer - - Trihedron arrows constant size - Flèche trièdre de taille constante - + + Trihedron arrows constant size + Flèche trièdre de taille constante + Keep trihedron arrows view size constant Maintenir la taille de la vue des flèches trièdres constante + + General + Général + + + Opening a study + Ouverture d'une étude + + + Launching a python script + Lancement d'un script python + + + Activate + Activation + + + Display + Visualisation + + + Last part + Dernière pièce + + + All parts + Toutes les pièces + + + No activation + Aucune + + + As stored in HDF + Comme dans le HDF + + + Last item in each folder + Le dernier élément de chaque dossier + + + All items + Tous les éléments + + + No visualization + Aucune visualisation + diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index ce5f478a3..b0cf3a6dc 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -495,15 +496,20 @@ void PartSet_MenuMgr::onActivatePart(bool) void PartSet_MenuMgr::activatePart(ResultPartPtr thePart) const { bool isFirstLoad = !thePart->partDoc().get(); + ModuleBase_Tools::blockUpdateViewer(true); thePart->activate(); if (isFirstLoad) { XGUI_Workshop* aWorkshop = myModule->getWorkshop(); XGUI_ObjectsBrowser* aObjBrowser = aWorkshop->objectBrowser(); + ModuleBase_Tools::setDisplaying(thePart); + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + aObjBrowser->onSelectionChanged(); DocumentPtr aDoc = thePart->partDoc(); std::list aStates; aDoc->restoreNodesState(aStates); aObjBrowser->setStateForDoc(aDoc, aStates); } + ModuleBase_Tools::blockUpdateViewer(false); } void PartSet_MenuMgr::onActivateAllParts() diff --git a/src/SHAPERGUI/resources/LightApp.xml.in b/src/SHAPERGUI/resources/LightApp.xml.in index 33908724f..0a0028ab8 100644 --- a/src/SHAPERGUI/resources/LightApp.xml.in +++ b/src/SHAPERGUI/resources/LightApp.xml.in @@ -22,6 +22,12 @@ +
+ + + + +
diff --git a/src/XGUI/SHAPER.xml b/src/XGUI/SHAPER.xml index 879498824..94ff4fcc6 100644 --- a/src/XGUI/SHAPER.xml +++ b/src/XGUI/SHAPER.xml @@ -4,6 +4,12 @@
+
+ + + + +
diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 4342023ae..f95053cbd 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1067,6 +1067,37 @@ void XGUI_Workshop::openFile(const QString& theDirectory) } #endif + int anActivationId = + ModuleBase_Preferences::resourceMgr()->integerValue("General", "part_activation_study", -1); + int aSize = aRootDoc->size(ModelAPI_ResultPart::group()); + + if (anActivationId == 0 && aSize > 0) { + ObjectPtr anObject = aRootDoc->object(ModelAPI_ResultPart::group(), aSize - 1); + ResultPartPtr aPart = std::dynamic_pointer_cast(anObject); + if (aPart.get()) { + aPart->activate(); + ModuleBase_Tools::setDisplaying(aPart); + } + } + else if (anActivationId == 1) { + for (int anIndex = 0; anIndex < aSize; ++anIndex) { + ObjectPtr anObject = aRootDoc->object(ModelAPI_ResultPart::group(), anIndex); + ResultPartPtr aPart = std::dynamic_pointer_cast(anObject); + if (aPart.get()) { + aPart->activate(); + ModuleBase_Tools::setDisplaying(aPart); + + if (anIndex < aSize - 1) { + SessionPtr aMgr = ModelAPI_Session::get(); + aMgr->startOperation("Activation"); + aMgr->setActiveDocument(aMgr->moduleDocument()); + aMgr->finishOperation(); + updateCommandStatus(); + viewer()->update(); + } + } + } + } QApplication::restoreOverrideCursor(); } diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index b1092af83..34b87d99a 100644 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -50,6 +50,11 @@ #include #include +#ifdef HAVE_SALOME +#include +#include +#endif + #include "XGUI_ActionsMgr.h" #include "XGUI_Displayer.h" #include "XGUI_ErrorMgr.h" @@ -57,7 +62,6 @@ #include "XGUI_OperationMgr.h" #include "XGUI_ModuleConnector.h" #include "XGUI_PropertyPanel.h" - #include "XGUI_QtEvents.h" #include "XGUI_SalomeConnector.h" #include "XGUI_SelectionMgr.h" @@ -373,6 +377,7 @@ void XGUI_WorkshopListener:: } } } + // this processing should be moved in another place in order to do not cause problems in // flush messages chain //if (aHiddenObjects.size() > 0) @@ -392,6 +397,10 @@ void XGUI_WorkshopListener:: void XGUI_WorkshopListener:: onFeatureCreatedMsg(const std::shared_ptr& theMsg) { + SUIT_Application * app = SUIT_Session::session()->activeApplication(); + + QVariant aVar = app->property("IsLoadedScript"); + std::set anObjects = theMsg->objects(); std::set::const_iterator aIt; #ifdef DEBUG_FEATURE_CREATED @@ -406,46 +415,32 @@ void XGUI_WorkshopListener:: //bool aHasPart = false; bool aDisplayed = false; - for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { - ObjectPtr anObject = *aIt; + if (aVar.isNull() || !aVar.toBool()) { + for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { + ObjectPtr anObject = *aIt; #ifdef DEBUG_RESULT_COMPSOLID - ResultPtr aRes = std::dynamic_pointer_cast(anObject); - if (aRes.get()) { - ResultCompSolidPtr aCompSolidRes = std::dynamic_pointer_cast(aRes); - if (aCompSolidRes.get()) { - qDebug(QString("COMPSOLID, numberOfSubs = %1") - .arg(aCompSolidRes->numberOfSubs()).toStdString().c_str()); + ResultPtr aRes = std::dynamic_pointer_cast(anObject); + if (aRes.get()) { + ResultCompSolidPtr aCompSolidRes = std::dynamic_pointer_cast(aRes); + if (aCompSolidRes.get()) { + qDebug(QString("COMPSOLID, numberOfSubs = %1") + .arg(aCompSolidRes->numberOfSubs()).toStdString().c_str()); + } + if (ModelAPI_Tools::compSolidOwner(aRes)) + qDebug("COMPSOLID sub-object"); } - if (ModelAPI_Tools::compSolidOwner(aRes)) - qDebug("COMPSOLID sub-object"); - } #endif - // the validity of the data should be checked here in order to avoid display of the objects, - // which were created, then deleted, but flush for the creation event happens after that - // we should not display disabled objects - bool aHide = !anObject->data()->isValid() || - anObject->isDisabled() || - !anObject->isDisplayed(); - if (!aHide) { // check that this is not hidden result - ResultPtr aRes = std::dynamic_pointer_cast(anObject); - aHide = aRes && aRes->isConcealed(); - // Hide the presentation with an empty shape. But isDisplayed state of the object should not - // be changed to the object becomes visible when the shape becomes not empty - if (!aHide && aRes.get()) - aHide = !aRes->shape().get() || aRes->shape()->isNull(); - } - if (!aHide) { - // setDisplayed has to be called in order to synchronize internal state of the object - // with list of displayed objects - if (myWorkshop->module()->canDisplayObject(anObject)) { - anObject->setDisplayed(true); - aDisplayed = displayObject(anObject); - } else - anObject->setDisplayed(false); + + ResultBodyPtr aRes = std::dynamic_pointer_cast(anObject); + + if (aRes.get() && aRes->numberOfSubs() > 0) + for (int anIndex = 0; anIndex < aRes->numberOfSubs(); ++anIndex) + setDisplayed(aRes->subResult(anIndex), aDisplayed); + else + setDisplayed(anObject, aDisplayed); } } - MAYBE_UNUSED bool isCustomized = customizeFeature(anObjects, aDisplayed); //if (myObjectBrowser) @@ -558,3 +553,32 @@ XGUI_Workshop* XGUI_WorkshopListener::workshop() const { return myWorkshop; } + + +void XGUI_WorkshopListener::setDisplayed(ObjectPtr theObject, bool& theDisplayed) +{ + // the validity of the data should be checked here in order to avoid display of the objects, + // which were created, then deleted, but flush for the creation event happens after that + // we should not display disabled objects + bool aHide = !theObject->data()->isValid() || + theObject->isDisabled() || + !theObject->isDisplayed(); + if (!aHide) { // check that this is not hidden result + ResultPtr aRes = std::dynamic_pointer_cast(theObject); + aHide = aRes && aRes->isConcealed(); + // Hide the presentation with an empty shape. But isDisplayed state of the object should not + // be changed to the object becomes visible when the shape becomes not empty + if (!aHide && aRes.get()) + aHide = !aRes->shape().get() || aRes->shape()->isNull(); + } + if (!aHide) { + // setDisplayed has to be called in order to synchronize internal state of the object + // with list of displayed objects + if (myWorkshop->module()->canDisplayObject(theObject)) { + theObject->setDisplayed(true); + theDisplayed = displayObject(theObject); + } + else + theObject->setDisplayed(false); + } +} diff --git a/src/XGUI/XGUI_WorkshopListener.h b/src/XGUI/XGUI_WorkshopListener.h index d8827d57b..dcedeb713 100644 --- a/src/XGUI/XGUI_WorkshopListener.h +++ b/src/XGUI/XGUI_WorkshopListener.h @@ -103,6 +103,9 @@ protected: XGUI_Workshop* workshop() const; private: + + void setDisplayed(ObjectPtr theObject, bool& theDisplayed); + XGUI_Workshop* myWorkshop; // the current workshop bool myUpdatePrefs; -- 2.39.2