# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2014 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
# 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.
+# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
from salome_utils import verbose, setVerbose, getPortNumber, getHomeDir
-from salomeLauncherUtils import getScriptsAndArgs
+from salomeContextUtils import getScriptsAndArgs
# names of tags in XML configuration file
doc_tag = "document"
shutdown_servers_nam = "shutdown_servers"
foreground_nam = "foreground"
wake_up_session_nam = "wake_up_session"
+siman_nam = "siman"
+siman_study_nam = "siman_study"
+siman_scenario_nam = "siman_scenario"
+siman_user_nam = "siman_user"
# 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)
o_port = optparse.Option("--port",
metavar="<port>",
type="int",
- action="store",
+ action="store",
dest="use_port",
- help=help_str)
+ help=help_str)
+
+ # SIMAN launch mode
+ help_str = "Special mode for interacting with SIMAN."
+ o_siman = optparse.Option("--siman",
+ action="store_true",
+ dest="siman",
+ help=help_str)
+
+ # SIMAN study
+ help_str = "SIMAN study identifier."
+ o_siman_study = optparse.Option("--siman-study",
+ metavar="<id>",
+ type="string",
+ action="store",
+ dest="siman_study",
+ help=help_str)
+
+ # SIMAN scenario
+ help_str = "SIMAN scenario identifier."
+ o_siman_scenario = optparse.Option("--siman-scenario",
+ metavar="<id>",
+ type="string",
+ action="store",
+ dest="siman_scenario",
+ help=help_str)
+
+ # SIMAN user
+ help_str = "SIMAN user identifier."
+ o_siman_user = optparse.Option("--siman-user",
+ metavar="<id>",
+ type="string",
+ action="store",
+ dest="siman_user",
+ help=help_str)
# All options
opt_list = [o_t,o_g, # GUI/Terminal
o_wake_up,
o_slm, # Server launch mode
o_port, # Use port
+ o_siman, # Siman launch mode
+ o_siman_study, # Siman study
+ o_siman_scenario,# Siman scenario
+ o_siman_user, # Siman user
]
#std_options = ["gui", "desktop", "log_file", "resources",
from searchFreePort import searchFreePort
searchFreePort({})
print "port:%s"%(os.environ['NSPORT'])
- import PortManager
- PortManager.releasePort(os.environ['NSPORT'])
+
+ try:
+ import PortManager
+ PortManager.releasePort(os.environ['NSPORT'])
+ except ImportError:
+ pass
+
sys.exit(0)
pass
# Python scripts
args[script_nam] = getScriptsAndArgs(cmd_args)
new_args = []
- if args[gui_nam]:
+ if args[gui_nam] and args["session_gui"]:
for d in args[script_nam]:
for s, a in d.items():
v = re.sub(r'^python.*\s+', r'', s)
if cmd_opts.wake_up_session is not None:
args[wake_up_session_nam] = cmd_opts.wake_up_session
+ # siman options
+ if cmd_opts.siman is not None:
+ args[siman_nam] = cmd_opts.siman
+ if cmd_opts.siman_study is not None:
+ args[siman_study_nam] = cmd_opts.siman_study
+ if cmd_opts.siman_scenario is not None:
+ args[siman_scenario_nam] = cmd_opts.siman_scenario
+ if cmd_opts.siman_user is not None:
+ args[siman_user_nam] = cmd_opts.siman_user
+
####################################################
# Add <theAdditionalOptions> values to args
for add_opt in theAdditionalOptions: