From 874fefdb172065b13031d390ea8e1e3fefe2a35f Mon Sep 17 00:00:00 2001 From: boulant Date: Thu, 10 Nov 2011 14:36:19 +0000 Subject: [PATCH] FIX: padder configuration process for plugin integration --- adm_local/unix/make_common_starter.am | 2 +- src/Tools/padder/doc/Makefile.am | 2 +- src/Tools/padder/spadderpy/configreader.py | 28 ++++++++++++------- src/Tools/padder/spadderpy/plugin/Makefile.am | 6 ++-- .../padder/spadderpy/plugin/smesh_plugins.py | 3 +- 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/adm_local/unix/make_common_starter.am b/adm_local/unix/make_common_starter.am index b772912ec..feb12fc58 100644 --- a/adm_local/unix/make_common_starter.am +++ b/adm_local/unix/make_common_starter.am @@ -43,7 +43,7 @@ salomepyexecdir = $(pyexecdir)/salome smeshpypkgdir = $(salomepythondir)/salome/smesh # Directory for installing SALOME plugins files -salomepluginsdir = $(prefix)/plugins +salomepluginsdir = $(prefix)/share/salome/plugins/@MODULE_NAME@ # Directory for installing idl files salomeidldir = $(prefix)/idl/salome diff --git a/src/Tools/padder/doc/Makefile.am b/src/Tools/padder/doc/Makefile.am index 3cd551685..fa2d6f82e 100755 --- a/src/Tools/padder/doc/Makefile.am +++ b/src/Tools/padder/doc/Makefile.am @@ -26,7 +26,7 @@ EXTRA_DIST += images input # # The simplest way to extend the documentation of SMESH with the # documentation for PADDER is to add path to the padder documentation -# in the SMESH gui documentation +# in the SMESH gui documentation (see the doxyfile). # # For test purpose, we let the user generate a local dosygen diff --git a/src/Tools/padder/spadderpy/configreader.py b/src/Tools/padder/spadderpy/configreader.py index 84d87ba9a..9fc13cd92 100644 --- a/src/Tools/padder/spadderpy/configreader.py +++ b/src/Tools/padder/spadderpy/configreader.py @@ -25,6 +25,8 @@ import ConfigParser from MESHJOB import ConfigParameter from salome.kernel.uiexception import AdminException, UiException +from salome_pluginsmanager import PLUGIN_PATH_PATTERN +CONFIG_RELPATH = os.path.join(PLUGIN_PATH_PATTERN,'smesh') CONFIG_FILENAME = "padder.cfg" TYPE_LOCAL = 'local' TYPE_REMOTE = 'remote' @@ -37,19 +39,25 @@ class ConfigReader: # padder plugin. Then, we have to scan the directories # specified in the SALOME plugins path. self.__configFilename = None - pluginspath=os.environ["SALOME_PLUGINS_PATH"] - for path in pluginspath.split(":"): - filename = os.path.join(path,CONFIG_FILENAME) - if os.path.exists(filename): - self.__configFilename = filename - break - if self.__configFilename is None: - msg = "The configuration file %s can't be found in SALOME_PLUGINS_PATH" - raise AdminException(msg%CONFIG_FILENAME) + try: + smeshpath=os.environ["SMESH_ROOT_DIR"] + except KeyError, ex: + raise AdminException("You should define the variable SALOME_PLUGINS_PATH") + + pluginspath = os.path.join(smeshpath,CONFIG_RELPATH) + filename = os.path.join(pluginspath,CONFIG_FILENAME) + if os.path.exists(filename): + self.__configFilename = filename + else: + msg = "The configuration file %s can't be found in the SMESH plugins path %s" + raise AdminException(msg%(CONFIG_FILENAME,pluginspath)) print "The configuration file is : %s"%self.__configFilename self.__configparser = ConfigParser.RawConfigParser() - self.__configparser.read(self.__configFilename) + try: + self.__configparser.read(self.__configFilename) + except ConfigParser.ParsingError, ex: + raise AdminException(ex.message) def getLocalConfig(self): return self.__getConfig(TYPE_LOCAL) diff --git a/src/Tools/padder/spadderpy/plugin/Makefile.am b/src/Tools/padder/spadderpy/plugin/Makefile.am index 871ef1323..543204a0f 100644 --- a/src/Tools/padder/spadderpy/plugin/Makefile.am +++ b/src/Tools/padder/spadderpy/plugin/Makefile.am @@ -8,5 +8,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am salomeplugins_PYTHON = \ smesh_plugins.py -salomeplugins_DATA = \ - envPlugins.sh +#salomeplugins_DATA = \ +# envPlugins.sh + + diff --git a/src/Tools/padder/spadderpy/plugin/smesh_plugins.py b/src/Tools/padder/spadderpy/plugin/smesh_plugins.py index cff860725..9f79eaba8 100755 --- a/src/Tools/padder/spadderpy/plugin/smesh_plugins.py +++ b/src/Tools/padder/spadderpy/plugin/smesh_plugins.py @@ -31,8 +31,7 @@ def runSpadderPlugin(context): dialog=plugindialog.getDialog() except UiException, err: from PyQt4.QtGui import QMessageBox - QMessageBox.critical(None, - "An error occurs during PADDER configuration", + QMessageBox.critical(None,"An error occurs during PADDER configuration", err.getUIMessage()) return -- 2.30.2