def __run(self, args=None, with_gui=False): if args is None: args = [] sys.argv = ['runSalome'] + args if with_gui: # :WARNING: NOT TESTED YET sys.argv += ["--gui"] sys.argv += ["--show-desktop=1"] sys.argv += ["--splash=0"] #sys.argv += ["--standalone=study"] #sys.argv += ["--embedded=SalomeAppEngine,cppContainer,registry,moduleCatalog"] else: sys.argv += ["--terminal"] #sys.argv += ["--shutdown-servers=1"] #sys.argv += ["--modules=MED,PARAVIS,GUI"] pass import setenv setenv.main(True) import runSalome runSalome.runSalome() if not with_gui: import salome salome.salome_init() session_server = salome.naming_service.Resolve('/Kernel/Session') if session_server: session_server.emitMessage("connect_to_study") session_server.emitMessage("activate_viewer/ParaView") pass
def _runTests(self, args=None): if args is None: args = [] sys.argv = ['runTests'] import setenv setenv.main(True) import runTests return runTests.runTests(args, exe="salome test")
def _runAppli(self, args=None): if args is None: args = [] # Initialize SALOME environment sys.argv = ['runSalome'] + args import setenv setenv.main(True, exeName="salome start") import runSalome runSalome.runSalome()
def _runConsole(self, args=None): if args is None: args = [] # Initialize SALOME environment sys.argv = ['runConsole'] import setenv setenv.main(True) import runConsole return runConsole.connect(args)
def testHello(self): try: import setenv setenv.main(True) import runSession args = ["hello.py"] params, args = runSession.configureSession(args, exe="salome shell") return runSession.runSession(params, args) except SystemExit, e: if str(e) != '0': logging.error(e)
def _runSession(self, args=None): if args is None: args = [] sys.argv = ['runSession'] + args import runSession params, args = runSession.configureSession(args, exe="salome shell") sys.argv = ['runSession'] + args import setenv setenv.main(True) return runSession.runSession(params, args)
def appli(self, args=None): if args is None: args = [] try: sys.argv = ['runSalome', '-t'] import setenv setenv.main(True, exeName="salome start") import runSalome runSalome.runSalome() except SystemExit, e: if str(e) != '0': logging.error(e) pass
def session(self, args=None): if args is None: args = [] try: import setenv setenv.main(True) import runSession params, args = runSession.configureSession(args, exe="salome shell") return runSession.runSession(params, args) except SystemExit, e: if str(e) != '0': logging.error(e) pass
def session(self, args=None): if args is None: args = [] args = [x.replace("LOGFILE",self.logFile.name) for x in args] try: import setenv setenv.main(True) import runSession params, args = runSession.configureSession(args, exe="salome shell") return runSession.runSession(params, args) except SystemExit, e: if str(e) != '0': logger.error(e) import traceback traceback.print_exc() pass
def session(self, args=None): if args is None: args = [] args = [x.replace("LOGFILE", self.logFile.name) for x in args] try: import setenv setenv.main(True) import runSession params, args = runSession.configureSession(args, exe="salome shell") return runSession.runSession(params, args) except SystemExit, e: if str(e) != '0': logger.error(e) import traceback traceback.print_exc() pass
# Please consider the new salome.py launcher. # ############################################### import os import sys import setenv kernel_root=os.getenv("KERNEL_ROOT_DIR") kernel_root = os.path.realpath(kernel_root) sys.path[:0]=[os.path.join(kernel_root,"bin","salome")] argv = sys.argv[1:] sys.argv = argv[1:] if argv[0] == "-exec": #keep options only for execution del argv[0] sys.argv = [] setenv.main(True); if sys.platform == "win32": if len(argv) >= 2: # Fix a problem of spaces in argv[1] argv[1] = '"%s"'%(argv[1]) pass pass os.execvp(argv[0],argv)
def __connectToInstance(self, port): import setenv setenv.main(True) import runConsole return runConsole.connect(["-p", port, "-c", "exit()"]) # auto-logout