From d34fc9cfb9d6a6f1d2a39696b709bf62eae3e961 Mon Sep 17 00:00:00 2001 From: rnv Date: Thu, 16 May 2019 12:42:53 +0300 Subject: [PATCH] Fix for "16850 [CEA 16749] Macros toolbars: ShowSalomeObject" issue. --- src/PVGUI/PVGUI_Module.cxx | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index 566f29b3..be201adf 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -124,6 +124,7 @@ #include #include #include +#include #if PY_VERSION_HEX < 0x03050000 static char* @@ -191,20 +192,6 @@ PVGUI_Module::PVGUI_Module() Q_INIT_RESOURCE( PVGUI ); #endif ParavisModule = this; - - // Clear old copies of embedded macros files - QString aDestPath = QString( "%1/.config/%2/Macros" ).arg( QDir::homePath() ).arg( QApplication::applicationName() ); - QStringList aFilter; - aFilter << "*.py"; - - QDir aDestDir(aDestPath); - QStringList aDestFiles = aDestDir.entryList(aFilter, QDir::Files); - foreach (QString aMacrosPath, getEmbeddedMacrosList()) { - QString aMacrosName = QFileInfo(aMacrosPath).fileName(); - if (aDestFiles.contains(aMacrosName)) { - aDestDir.remove(aMacrosName); - } - } } /*! @@ -270,8 +257,25 @@ void PVGUI_Module::initialize( CAM_Application* app ) // Initialize ParaView client and associated behaviors // and connect to externally launched pvserver PVViewer_Core::ParaviewInitApp(aDesktop); + + // Clear old copies of embedded macros files + //QString aDestPath = QString( "%1/.config/%2/Macros" ).arg( QDir::homePath() ).arg( QApplication::applicationName() ); + QString aDestPath = pqCoreUtilities::getParaViewUserDirectory() + "/Macros"; + QStringList aFilter; + aFilter << "*.py"; + + QDir aDestDir(aDestPath); + QStringList aDestFiles = aDestDir.entryList(aFilter, QDir::Files); + foreach(QString aMacrosPath, getEmbeddedMacrosList()) { + QString aMacrosName = QFileInfo(aMacrosPath).fileName(); + if (aDestFiles.contains(aMacrosName)) { + aDestDir.remove(aMacrosName); + } + } + myGuiElements = PVViewer_GUIElements::GetInstance(aDesktop); + // [ABN]: careful with the order of the GUI element creation, the loading of the configuration // and the connection to the server. This order is very sensitive if one wants to make // sure all menus, etc ... are correctly populated. -- 2.39.2