Salome HOME
PV version is now bfaf7b82ed22ee (master of 17th of january 2019)
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 21 Jun 2019 13:49:43 +0000 (15:49 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 21 Jun 2019 13:49:43 +0000 (15:49 +0200)
1  2 
src/PVGUI/PVGUI_Module.cxx

index 05b370d33dcdb84c0bf8edaa2db091700b66bcae,6210acd08bab24929237d9c78e44fa152a5d3a56..02cc591668d560bb81929f488c044615f8ac326e
  #include <pqActiveObjects.h>
  #include <pqHelpReaction.h>
  #include <pqPluginManager.h>
- #include <pqPythonDialog.h>
//#include <pqPythonDialog.h>
  #include <pqPythonManager.h>
  #include <pqLoadDataReaction.h>
  #include <pqPythonScriptEditor.h>
  #include <pqServerManagerModel.h>
  #include <pqAnimationTimeToolbar.h>
  #include <pqPipelineBrowserWidget.h>
 +#include <pqCoreUtilities.h>
  
  #if PY_VERSION_HEX < 0x03050000
  static char*
@@@ -192,6 -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);
 -    }
 -  }
  }
  
  /*!
@@@ -257,25 -270,8 +257,25 @@@ void PVGUI_Module::initialize( CAM_Appl
    // 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.
@@@ -645,8 -641,11 +645,8 @@@ bool PVGUI_Module::deactivateModule( SU
    SUIT_ExceptionHandler::removeCleanUpRoutine( paravisCleanUp );
  
    if (myOldMsgHandler)
 -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
 -    qInstallMsgHandler(myOldMsgHandler);
 -#else
      qInstallMessageHandler(myOldMsgHandler);
 -#endif
 +
    restoreCommonWindowsState();
    
    return LightApp_Module::deactivateModule( study );
@@@ -734,6 -733,19 +734,19 @@@ void PVGUI_Module::stopTrace(
  */
  void PVGUI_Module::executeScript( const char* script )
  {
+   // ???
+   // Not sure this is the right fix, but the PYTHON_MANAGER has a function named
+   // executeScript() which seems to do what the runScript on pyShellDialog() class
+   // was doing.
+ #ifndef WNT
+   pqPythonManager* manager =
+     qobject_cast<pqPythonManager*>(pqApplicationCore::instance()->manager("PYTHON_MANAGER"));
+   if ( manager )  {
+     manager->executeScript(script);
+   }
+ #endif
+   /*
  #ifndef WNT
    pqPythonManager* manager = qobject_cast<pqPythonManager*>(
                               pqApplicationCore::instance()->manager( "PYTHON_MANAGER" ) );
      }
    }
  #endif
+   */
  }
  
  ///**