Salome HOME
Issue #1896: Do not send message about errors in initConfig script
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 17 Jan 2017 08:58:16 +0000 (11:58 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 17 Jan 2017 08:58:16 +0000 (11:58 +0300)
src/Config/Config_ModuleReader.cpp
src/Config/Config_ModuleReader.h
src/Model/Model_Session.cpp

index ddb2742407438828378759086cc03fde739aff55..9e8549cdb43bd7d7aea303add9f452ed95bf922c 100644 (file)
@@ -172,7 +172,7 @@ void Config_ModuleReader::loadPlugin(const std::string& thePluginName)
   }
 }
 
-void Config_ModuleReader::loadScript(const std::string& theFileName)
+void Config_ModuleReader::loadScript(const std::string& theFileName, bool theSendErr)
 {
   /* acquire python thread */
   PyGILState_STATE gstate = PyGILState_Ensure();
@@ -195,7 +195,8 @@ void Config_ModuleReader::loadScript(const std::string& theFileName)
       Py_XDECREF(pvalue);
       Py_XDECREF(ptraceback);
     }
-    Events_InfoMessage("Config_ModuleReader", anErrorMsg).send();
+    if (theSendErr)
+      Events_InfoMessage("Config_ModuleReader", anErrorMsg).send();
   }
 
   /* release python thread */
index 881a10d2db1e293adb24fca476bc5493df4a2438..75aa0f6364bf1a2120d51630bf8512a9c1f0227a 100644 (file)
@@ -49,7 +49,9 @@ class Config_ModuleReader : public Config_XMLReader
   /// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform
   CONFIG_EXPORT static void loadLibrary(const std::string& theLibName);
   /// loads the python module with specified name
-  CONFIG_EXPORT static void loadScript(const std::string& theFileName);
+  /// \param theFileName name of the script
+  /// \param theSendErr send error message in case of faile
+  CONFIG_EXPORT static void loadScript(const std::string& theFileName, bool theSendErr = true);
   /*!
    * Extends set of modules,  used for dependency checking (if there is no
    * required module in the set, a plugin will not be loaded)
index cbe0e6a523da9f3ebc457e5f65ebf67ec3088a4f..ee29017f4a82f52015d66d2253215adb31f3e273 100644 (file)
@@ -435,7 +435,7 @@ void Model_Session::LoadPluginsInfo()
 {
   if (myPluginsInfoLoaded)  // nothing to do
     return;
-  Config_ModuleReader::loadScript("salome.shaper.initConfig");
+  Config_ModuleReader::loadScript("salome.shaper.initConfig", false);
   // Read plugins information from XML files
   Config_ModuleReader aModuleReader(Config_FeatureMessage::MODEL_EVENT());
   aModuleReader.readAll();