Back to index

salome-kernel  6.5.0
Namespaces | Functions | Variables
KERNEL_PY Namespace Reference

Namespaces

namespace  batchmode_salome
namespace  Help
namespace  import_hook
namespace  iparameters
namespace  kernel
namespace  kernel_shared_modules
namespace  omnipatch
namespace  PyInterp
namespace  salome_ComponentGUI
namespace  salome_genericobj
namespace  salome_iapp
namespace  salome_kernel
namespace  salome_notebook
namespace  salome_pynode
namespace  salome_shared_modules
namespace  salome_study
namespace  salome_test
namespace  salome_version

Functions

def extend_path
def setCurrentStudy
def setCurrentStudyId
def salome_init

Variables

string ROOT_PYTHONPACKAGE_NAME = "salome"
string MATCH_ENDING_PATTERN = "site-packages"
 flags = None

Function Documentation

def KERNEL_PY.extend_path (   pname)

Definition at line 111 of file __init__.py.

00111 
00112 def extend_path(pname):
00113     for dir in sys.path:
00114         if not isinstance(dir, basestring) or not os.path.isdir(dir) or not dir.endswith(MATCH_ENDING_PATTERN):
00115             continue
00116         subdir = os.path.join(dir, pname)
00117         # XXX This may still add duplicate entries to path on
00118         # case-insensitive filesystems
00119         if os.path.isdir(subdir) and subdir not in __path__:
00120             if verbose(): print "INFO - The directory %s is appended to sys.path" % subdir
00121             __path__.append(subdir)
00122 
00123 extend_path(ROOT_PYTHONPACKAGE_NAME)
00124 # ==========================================================================
00125 #

def KERNEL_PY.salome_init (   theStudyId = 0,
  embedded = 0 
)
Performs only once SALOME general purpose intialisation for scripts.
optional argument : theStudyId
  When in embedded interpreter inside IAPP, theStudyId is not used
  When used without GUI (external interpreter)
    0      : create a new study (default).
    n (>0) : try connection to study with Id = n, or create a new one
             if study not found.
             If study creation, its Id may be different from theStudyId !
Provides:
orb             reference to CORBA
lcc             a LifeCycleCorba instance
naming_service  a naming service instance
cm              reference to the container manager
sg              access to SALOME GUI (when linked with IAPP GUI)
myStudyManager  the study manager
myStudyId       active study identifier
myStudy         active study itself (CORBA reference)
myStudyName     active study name

Definition at line 193 of file __init__.py.

00193 
00194 def salome_init(theStudyId=0,embedded=0):
00195     """
00196     Performs only once SALOME general purpose intialisation for scripts.
00197     optional argument : theStudyId
00198       When in embedded interpreter inside IAPP, theStudyId is not used
00199       When used without GUI (external interpreter)
00200         0      : create a new study (default).
00201         n (>0) : try connection to study with Id = n, or create a new one
00202                  if study not found.
00203                  If study creation, its Id may be different from theStudyId !
00204     Provides:
00205     orb             reference to CORBA
00206     lcc             a LifeCycleCorba instance
00207     naming_service  a naming service instance
00208     cm              reference to the container manager
00209     sg              access to SALOME GUI (when linked with IAPP GUI)
00210     myStudyManager  the study manager
00211     myStudyId       active study identifier
00212     myStudy         active study itself (CORBA reference)
00213     myStudyName     active study name
00214     """
00215     global salome_initial
00216     global orb, lcc, naming_service, cm
00217     global sg
00218     global myStudyManager, myStudyId, myStudy, myStudyName
00219 
00220     try:
00221         if salome_initial:
00222             salome_initial=0
00223             sg = salome_iapp_init(embedded)
00224             orb, lcc, naming_service, cm = salome_kernel_init()
00225             myStudyManager, myStudyId, myStudy, myStudyName =salome_study_init(theStudyId)
00226             pass
00227         pass
00228     except RuntimeError, inst:
00229         # wait a little to avoid trace mix
00230         import time
00231         time.sleep(0.2)
00232         x = inst
00233         print "salome.salome_init():", x
00234         print """
00235         ============================================
00236         May be there is no running SALOME session
00237         salome.salome_init() is intented to be used
00238         within an already running session
00239         ============================================
00240         """
00241         raise
00242 
00243 #to expose all objects to pydoc
00244 __all__=dir()

Here is the call graph for this function:

def KERNEL_PY.setCurrentStudy (   theStudy)
Change current study : an existing one given by a study object.

:param theStudy: the study CORBA object to set as current study

Definition at line 171 of file __init__.py.

00171 
00172 def setCurrentStudy(theStudy):
00173     """
00174     Change current study : an existing one given by a study object.
00175 
00176     :param theStudy: the study CORBA object to set as current study
00177     """
00178     global myStudyId, myStudy, myStudyName
00179     myStudyId, myStudy, myStudyName =salome_study.setCurrentStudy(theStudy)

def KERNEL_PY.setCurrentStudyId (   theStudyId = 0)
Change current study : an existing or new one given by Id.

:param theStudyId: the study Id (optional argument)
       0      : create a new study (default).
       n (>0) : try connection to study with Id = n, or create a new one
                  if study not found.

Definition at line 180 of file __init__.py.

00180 
00181 def setCurrentStudyId(theStudyId=0):
00182     """
00183     Change current study : an existing or new one given by Id.
00184 
00185     :param theStudyId: the study Id (optional argument)
00186            0      : create a new study (default).
00187            n (>0) : try connection to study with Id = n, or create a new one
00188                       if study not found.
00189     """
00190     global myStudyId, myStudy, myStudyName
00191     myStudyId, myStudy, myStudyName =salome_study.setCurrentStudyId(theStudyId)
00192 
salome_initial=1

Variable Documentation

Definition at line 137 of file __init__.py.

string KERNEL_PY.MATCH_ENDING_PATTERN = "site-packages"

Definition at line 109 of file __init__.py.

Definition at line 91 of file __init__.py.