ddd_session_nam = "ddd_session"
valgrind_session_nam = "valgrind_session"
shutdown_servers_nam = "shutdown_servers"
+wake_up_session_nam = "wake_up_session"
# values in XML configuration file giving specific module parameters (<module_name> section)
# which are stored in opts with key <module_name>_<parameter> (eg SMESH_plugins)
dest="shutdown_servers",
help=help_str)
+ # wake up session
+ help_str = "Wake up a previously closed session. "
+ help_str += "The session object is found in the naming service pointed by the variable OMNIORB_CONFIG. "
+ help_str += "If this variable is not setted, the last configuration is taken. "
+ o_wake_up = optparse.Option("--wake-up-session",
+ action="store_true",
+ dest="wake_up_session", default=False,
+ help=help_str)
+
# All options
opt_list = [o_t,o_g, # GUI/Terminal
o_d,o_o, # Desktop
o_ddd,
o_valgrind,
o_shutdown,
+ o_wake_up,
]
#std_options = ["gui", "desktop", "log_file", "py_scripts", "resources",
args[shutdown_servers_nam] = cmd_opts.shutdown_servers
pass
+ # wake up session
+ if cmd_opts.wake_up_session is not None:
+ args[wake_up_session_nam] = cmd_opts.wake_up_session
+
####################################################
# Add <theAdditionalOptions> values to args
for add_opt in theAdditionalOptions:
if verbose(): print "Launch Naming Service++",
# On lance le Naming Server (doit etre dans le PATH)
- NamingServer(args).run()
+ test = True
+ if args['wake_up_session']:
+ test = False
+ pass
+ if test:
+ NamingServer(args).run()
+ pass
print "Searching Naming Service ",
ncount=0
delta=0.1
if verbose(): print "startSalome ", args
+ #
+ # Wake up session option
+ #
+ if args['wake_up_session']:
+ if "OMNIORB_CONFIG" not in os.environ:
+ from salome_utils import generateFileName
+ home = os.getenv("HOME")
+ appli = os.getenv("APPLI")
+ kwargs={}
+ if appli is not None:
+ home = os.path.join(home, appli,"USERS")
+ kwargs["with_username"] = True
+ pass
+ last_running_config = generateFileName(home, prefix="omniORB",
+ suffix="last",
+ extension="cfg",
+ hidden=True,
+ **kwargs)
+ os.environ['OMNIORB_CONFIG'] = last_running_config
+ pass
+ pass
+
#
# Initialisation ORB and Naming Service
#
clt=orbmodule.client(args)
+
+ #
+ # Wake up session option
+ #
+ if args['wake_up_session']:
+ import Engines
+ import SALOME
+ import SALOMEDS
+ import SALOME_ModuleCatalog
+ import SALOME_Session_idl
+ session = clt.waitNS("/Kernel/Session",SALOME.Session)
+ status = session.GetStatSession()
+ if status.activeGUI:
+ msg = "Session GUI is already active"
+ raise Exception(msg)
+ session.GetInterface()
+ return clt
+
# Save Naming service port name into
# the file args["ns_port_log_file"]
if args.has_key('ns_port_log_file'):
save_config = True
if args.has_key('save_config'):
save_config = args['save_config']
- searchFreePort(args, save_config)
+ # --
+ test = True
+ if args['wake_up_session']:
+ test = False
+ pass
+ if test:
+ searchFreePort(args, save_config)
+ pass
+ # --
#setenv.main()
setenv.set_env(args, modules_list, modules_root_dir)
clt = useSalome(args, modules_list, modules_root_dir)