From 378dc84bc14eeda952341c4f5c0ac5a32068bb82 Mon Sep 17 00:00:00 2001 From: DUC ANH HOANG Date: Tue, 28 Mar 2023 15:02:40 +0200 Subject: [PATCH] Some correction for salome_on_demand: Install all modules in only one directory ("__SALOME_EXT__") Hide extension button with env var "SALOME_ON_DEMAND" --- src/LightApp/LightApp_Application.cxx | 10 +++------- src/LightApp/LightApp_ModuleAction.cxx | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 8702a1f97..454bf37c9 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -23,7 +23,6 @@ // File: LightApp_Application.cxx // Created: 6/20/2005 18:39:45 PM // Author: Natalia Donis - #ifdef WIN32 // E.A. : On windows with python 2.6, there is a conflict // E.A. : between pymath.h and Standard_math.h which define @@ -953,8 +952,8 @@ void LightApp_Application::onExtAdding() SCRUTE(extRootDir); // We'll load all the extensions modules from this path - auto extModulesDir = QDir::cleanPath(QString(extRootDir) + QDir::separator() + "__SALOME_EXT__"); - SCRUTE(extModulesDir.toStdString()); + auto SalomeExtDir = QDir::cleanPath(QString(extRootDir) + QDir::separator() + "__SALOME_EXT__"); + SCRUTE(SalomeExtDir.toStdString()); // Import Python module that manages SALOME extensions. // It seems to be faster to lock and unlock once than on each iteration, @@ -983,10 +982,7 @@ void LightApp_Application::onExtAdding() QString moduleName(PyUnicode_AsUTF8(moduleNameItem)); SCRUTE(moduleName.toStdString()); - QString moduleDir = QDir::cleanPath(extModulesDir + QDir::separator() + moduleName); - SCRUTE(moduleDir.toStdString()); - - addUserModule(moduleName, moduleDir, true); + addUserModule(moduleName, SalomeExtDir, true); } // Add an extension to GUI diff --git a/src/LightApp/LightApp_ModuleAction.cxx b/src/LightApp/LightApp_ModuleAction.cxx index f42bcf1cd..60bc3f02c 100644 --- a/src/LightApp/LightApp_ModuleAction.cxx +++ b/src/LightApp/LightApp_ModuleAction.cxx @@ -609,10 +609,20 @@ void LightApp_ModuleAction::update() for ( QList::const_iterator it = lst.begin(); it != lst.end(); ++it ) update( *it ); + myCombo->setVisible( myMode & List ); - myAdd->setVisible( myMode & AddRemove ); - myRemove->setVisible( myMode & AddRemove ); - myInfo->setVisible( myMode & All ); + if ( QString::compare(getenv("SALOME_ON_DEMAND"),"HIDE", Qt::CaseInsensitive) != 0) + { + myAdd->setVisible( myMode & AddRemove ); + myRemove->setVisible( myMode & AddRemove ); + myInfo->setVisible( myMode & All ); + } + else + { + myAdd->setVisible(false); + myRemove->setVisible( false ); + myInfo->setVisible( false ); + } mySet->setVisible( myMode & Buttons ); } -- 2.39.2