示例#1
0
  def initNS( self, args ) :
    """
    Obtains a reference to the root naming context
    """
    try :
      # Try to connect to the existing SALOME session 
      obj = self.orb.resolve_initial_references( "NameService" )
      self.rootContext = obj._narrow( CosNaming.NamingContext )

      # Try to connect to already existing SALOME study
      from salome import salome_init
      salome_init( theStudyId = 1 )
    except :
      # Try to launch a new session of SALOME 

      # Obtain SALOME configuration parameters
      from setenv import get_config
      args, modules_list, modules_root_dir = get_config()

      from runSalome import kill_salome
      kill_salome( args )

      # To generate a new SALOME configuration
      from runSalome import searchFreePort
      searchFreePort( args, 0 )

      # Starting of SALOME application 
      from runSalome import startSalome
      startSalome( args, modules_list, modules_root_dir )

      # To call the carresponding method of base class
      orbmodule.client.initNS( self, args )

      # Try to create a new SALOME study
      from salome import salome_init
      salome_init( theStudyId = 0 )
      pass

    self.showNS() # Prints debug information (can be commented)

    # It is necessary to wait untill it will be possible 
    # to get access to some important SALOME services
    self.waitNS( "/Kernel/Session" )
    self.waitNS( "/Kernel/ModulCatalog" )
    self.waitNS( "/myStudyManager" )

    pass
# -----------------------------------------------------------------------------

def main(exeName=None):
    """Salome launch as a main application"""

    # define folder to store omniorb config (initially in virtual application folder)
    try:
        from salomeContextUtils import setOmniOrbUserPath
        setOmniOrbUserPath()
    except Exception, e:
        print e
        sys.exit(1)

    from salome_utils import getHostName
    args, modules_list, modules_root_dir = setenv.get_config(exeName=exeName)
    print "runSalome running on %s" % getHostName()

    kill_salome(args)
    save_config = True
    if args.has_key('save_config'):
        save_config = args['save_config']
    # --
    test = True
    if args['wake_up_session']:
        test = False
        pass
    if test:
        from searchFreePort import searchFreePort
        searchFreePort(args, save_config, args.get('useport'))
        pass
# 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
#
# See http://www.salome-platform.org/ or email : [email protected]
#

import sys, signal,string,commands
import subprocess
import runSalome
import setenv

# get SALOME environment :
# here we need KERNEL_ROOT_DIR, PATH, LD_LIBRARY_PATH

args, modules_list, modules_root_dir = setenv.get_config()
setenv.set_env(args, modules_list, modules_root_dir)

# execute Unit Test

command = ['./TestSALOMELocalTrace']
ret = subprocess.call(command)

# no process to kill
exit(ret)
示例#4
0
# 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
#
# See http://www.salome-platform.org/ or email : [email protected]
#

import sys, signal, string, commands
import subprocess
import runSalome
import setenv

# get SALOME environment :
# here we need KERNEL_ROOT_DIR, PATH, LD_LIBRARY_PATH

args, modules_list, modules_root_dir = setenv.get_config()
setenv.set_env(args, modules_list, modules_root_dir)

# execute Unit Test

command = ['./TestSALOMELocalTrace']
ret = subprocess.call(command)

# no process to kill
exit(ret)
示例#5
0
# -----------------------------------------------------------------------------


def main(exeName=None):
    """Salome launch as a main application"""

    # define folder to store omniorb config (initially in virtual application folder)
    try:
        from salomeContextUtils import setOmniOrbUserPath
        setOmniOrbUserPath()
    except Exception, e:
        print e
        sys.exit(1)

    from salome_utils import getHostName
    args, modules_list, modules_root_dir = setenv.get_config(exeName=exeName)
    print "runSalome running on %s" % getHostName()

    kill_salome(args)
    save_config = True
    if args.has_key('save_config'):
        save_config = args['save_config']
    # --
    test = True
    if args['wake_up_session']:
        test = False
        pass
    if test:
        from searchFreePort import searchFreePort
        searchFreePort(args, save_config, args.get('useport'))
        pass