Back to index

salome-smesh  6.5.0
Public Member Functions | Private Member Functions | Private Attributes
spadderpy.configreader.ConfigReader Class Reference

List of all members.

Public Member Functions

def __init__
def getLocalConfig
def getRemoteConfig
def getDefaultConfig

Private Member Functions

def __getConfig
def __getDefaultType

Private Attributes

 __configFilename
 __configparser

Detailed Description

Definition at line 35 of file configreader.py.


Constructor & Destructor Documentation

Definition at line 36 of file configreader.py.

00036 
00037     def __init__(self):
00038         # The first step is to look for the config file. This file
00039         # is supposed to be located in the same directory than the
00040         # padder plugin. Then, we have to scan the directories
00041         # specified in the SALOME plugins path.
00042         self.__configFilename = None
00043         try:
00044             smeshpath=os.environ["SMESH_ROOT_DIR"]
00045         except KeyError, ex:
00046             raise AdminException("You should define the variable SMESH_ROOT_DIR")
00047 
00048         pluginspath = os.path.join(smeshpath,CONFIG_RELPATH)
00049         filename    = os.path.join(pluginspath,CONFIG_FILENAME)
00050         if os.path.exists(filename):
00051             self.__configFilename = filename
00052         else:
00053             msg = "The configuration file %s can't be found in the SMESH plugins path %s"
00054             raise AdminException(msg%(CONFIG_FILENAME,pluginspath))
00055 
00056         print "The configuration file is : %s"%self.__configFilename
00057         self.__configparser = ConfigParser.RawConfigParser()
00058         try:
00059             self.__configparser.read(self.__configFilename)
00060         except ConfigParser.ParsingError, ex:
00061             raise AdminException(ex.message)


Member Function Documentation

def spadderpy.configreader.ConfigReader.__getConfig (   self,
  type = TYPE_LOCAL 
) [private]

Definition at line 72 of file configreader.py.

00072 
00073     def __getConfig(self, type=TYPE_LOCAL):
00074         configName = self.__configparser.get('resources', type)
00075         resname = self.__configparser.get(configName, 'resname')
00076         binpath = self.__configparser.get(configName, 'binpath')
00077         envpath = self.__configparser.get(configName, 'envpath')
00078         config = ConfigParameter(resname, binpath, envpath)
00079         config.resname = resname
00080         return config

Here is the caller graph for this function:

This returns the default type read in the config file ([resources], default)

Definition at line 81 of file configreader.py.

00081 
00082     def __getDefaultType(self):
00083         '''This returns the default type read in the config file ([resources], default)'''
00084         defaultType = self.__configparser.get('preferences', 'defaultres')
00085         if defaultType not in TYPES:
00086             return TYPE_LOCAL
00087         return defaultType
00088 

Here is the caller graph for this function:

Definition at line 68 of file configreader.py.

00068 
00069     def getDefaultConfig(self):
00070         defaultType = self.__getDefaultType()
00071         return self.__getConfig(defaultType)
        

Here is the call graph for this function:

Definition at line 62 of file configreader.py.

00062 
00063     def getLocalConfig(self):
00064         return self.__getConfig(TYPE_LOCAL)
    

Here is the call graph for this function:

Definition at line 65 of file configreader.py.

00065 
00066     def getRemoteConfig(self):
00067         return self.__getConfig(TYPE_REMOTE)

Here is the call graph for this function:


Member Data Documentation

Definition at line 41 of file configreader.py.

Definition at line 56 of file configreader.py.


The documentation for this class was generated from the following file: