# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : salome.py renamed as __init__.py for python packaging (gboulant)
# Author : Paul RASCLE, EDF
# Module : SALOME
-# $Header$
#
"""
Module salome gives access to Salome ressources.
# be the pieces to be aggregated as a single virtual python package.
#
import os, sys
-MATCH_ENDING_PATTERN="site-packages/salome"
+from salome_utils import verbose
+
+MATCH_ENDING_PATTERN="site-packages" + os.path.sep + "salome"
+
def extend_path(pname):
for dir in sys.path:
if not isinstance(dir, basestring) or not os.path.isdir(dir) or not dir.endswith(MATCH_ENDING_PATTERN):
# XXX This may still add duplicate entries to path on
# case-insensitive filesystems
if os.path.isdir(subdir) and subdir not in __path__:
- print "INFO - The directory %s is appended to sys.path" % subdir
+ if verbose(): print "INFO - The directory %s is appended to sys.path" % subdir
__path__.append(subdir)
extend_path(ROOT_PYTHONPACKAGE_NAME)
from salome_kernel import *
from salome_study import *
from salome_iapp import *
+import salome_study
#
# The next block is workaround for the problem of shared symbols loading for the extension modules (e.g. SWIG-generated)
except:
pass
pass
-
-if flags:
- sys.setdlopenflags(flags)
- pass
+
+# Disable -> bug with scipy, seems very dangerous to do that
+#if flags:
+# sys.setdlopenflags(flags)
+# pass
orb, lcc, naming_service, cm,sg=None,None,None,None,None
myStudyManager, myStudyId, myStudy, myStudyName=None,None,None,None
+def setCurrentStudy(theStudy):
+ """
+ Change current study : an existing one given by a study object.
+
+ :param theStudy: the study CORBA object to set as current study
+ """
+ global myStudyId, myStudy, myStudyName
+ myStudyId, myStudy, myStudyName =salome_study.setCurrentStudy(theStudy)
+
+def 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.
+ """
+ global myStudyId, myStudy, myStudyName
+ myStudyId, myStudy, myStudyName =salome_study.setCurrentStudyId(theStudyId)
+
salome_initial=1
def salome_init(theStudyId=0,embedded=0):
"""