FIX: padder configuration process for plugin integration

This commit is contained in:
boulant 2011-11-10 14:36:19 +00:00
parent eb3e26bcdb
commit 874fefdb17
5 changed files with 25 additions and 16 deletions

View File

@ -43,7 +43,7 @@ salomepyexecdir = $(pyexecdir)/salome
smeshpypkgdir = $(salomepythondir)/salome/smesh smeshpypkgdir = $(salomepythondir)/salome/smesh
# Directory for installing SALOME plugins files # Directory for installing SALOME plugins files
salomepluginsdir = $(prefix)/plugins salomepluginsdir = $(prefix)/share/salome/plugins/@MODULE_NAME@
# Directory for installing idl files # Directory for installing idl files
salomeidldir = $(prefix)/idl/salome salomeidldir = $(prefix)/idl/salome

View File

@ -26,7 +26,7 @@ EXTRA_DIST += images input
# #
# The simplest way to extend the documentation of SMESH with the # The simplest way to extend the documentation of SMESH with the
# documentation for PADDER is to add path to the padder documentation # 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 # For test purpose, we let the user generate a local dosygen

View File

@ -25,6 +25,8 @@ import ConfigParser
from MESHJOB import ConfigParameter from MESHJOB import ConfigParameter
from salome.kernel.uiexception import AdminException, UiException 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" CONFIG_FILENAME = "padder.cfg"
TYPE_LOCAL = 'local' TYPE_LOCAL = 'local'
TYPE_REMOTE = 'remote' TYPE_REMOTE = 'remote'
@ -37,19 +39,25 @@ class ConfigReader:
# padder plugin. Then, we have to scan the directories # padder plugin. Then, we have to scan the directories
# specified in the SALOME plugins path. # specified in the SALOME plugins path.
self.__configFilename = None self.__configFilename = None
pluginspath=os.environ["SALOME_PLUGINS_PATH"] try:
for path in pluginspath.split(":"): smeshpath=os.environ["SMESH_ROOT_DIR"]
filename = os.path.join(path,CONFIG_FILENAME) 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): if os.path.exists(filename):
self.__configFilename = filename self.__configFilename = filename
break else:
if self.__configFilename is None: msg = "The configuration file %s can't be found in the SMESH plugins path %s"
msg = "The configuration file %s can't be found in SALOME_PLUGINS_PATH" raise AdminException(msg%(CONFIG_FILENAME,pluginspath))
raise AdminException(msg%CONFIG_FILENAME)
print "The configuration file is : %s"%self.__configFilename print "The configuration file is : %s"%self.__configFilename
self.__configparser = ConfigParser.RawConfigParser() self.__configparser = ConfigParser.RawConfigParser()
try:
self.__configparser.read(self.__configFilename) self.__configparser.read(self.__configFilename)
except ConfigParser.ParsingError, ex:
raise AdminException(ex.message)
def getLocalConfig(self): def getLocalConfig(self):
return self.__getConfig(TYPE_LOCAL) return self.__getConfig(TYPE_LOCAL)

View File

@ -8,5 +8,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
salomeplugins_PYTHON = \ salomeplugins_PYTHON = \
smesh_plugins.py smesh_plugins.py
salomeplugins_DATA = \ #salomeplugins_DATA = \
envPlugins.sh # envPlugins.sh

View File

@ -31,8 +31,7 @@ def runSpadderPlugin(context):
dialog=plugindialog.getDialog() dialog=plugindialog.getDialog()
except UiException, err: except UiException, err:
from PyQt4.QtGui import QMessageBox from PyQt4.QtGui import QMessageBox
QMessageBox.critical(None, QMessageBox.critical(None,"An error occurs during PADDER configuration",
"An error occurs during PADDER configuration",
err.getUIMessage()) err.getUIMessage())
return return