1 diff --git a/src/SalomeApp/pluginsdemo/salome_plugins.py b/src/SalomeApp/pluginsdemo/salome_plugins.py
2 index 451b944e4..f8fbda4a9 100755
3 --- a/src/SalomeApp/pluginsdemo/salome_plugins.py
4 +++ b/src/SalomeApp/pluginsdemo/salome_plugins.py
5 @@ -261,17 +261,16 @@ if DEMO_IS_ACTIVATED:
6 def runSalomeShellSession(context):
9 + from PyQt5.Qt import QMessageBox
10 + from SalomePyQt import SalomePyQt
11 version = salome_version.getVersion(full=True)
12 kernel_appli_dir = os.environ['KERNEL_ROOT_DIR']
14 - if os.path.exists("/usr/bin/gnome-terminal"):
15 - command = 'gnome-terminal -t "SALOME %s - Shell session" -e "%s/salome shell" &'%(version,kernel_appli_dir)
16 - elif os.path.exists("/usr/bin/konsole"):
17 - command = 'PATH="/usr/bin:/sbin:/bin" LD_LIBRARY_PATH="" konsole -e "%s/salome shell" &'%(kernel_appli_dir)
18 - elif os.path.exists("/usr/bin/xterm"):
19 - command = 'xterm -T "SALOME %s - Shell session" -e "%s/salome shell" &'%(version,kernel_appli_dir)
20 + if os.path.exists("/usr/bin/xterm"):
21 + command = 'xterm -T "SALOME %s - Shell session" -e "%s" shell &' % (version, command)
23 - print("Neither xterm nor gnome-terminal nor konsole is installed.")
24 + QMessageBox.critical(SalomePyQt.getDesktop(), "Error", "xterm does not seem to be installed")
29 @@ -283,3 +282,25 @@ def runSalomeShellSession(context):
30 salome_pluginsmanager.AddFunction('SALOME shell session',
31 'Execute a SALOME shell session in an external xterm',
32 runSalomeShellSession)
33 +# Example 4: run CODE
34 +def runCodeEditor(context):
35 + import os,subprocess
36 + import salome_version
38 + from PyQt5.Qt import QMessageBox
39 + from SalomePyQt import SalomePyQt
41 + command = shutil.which('code')
44 + subprocess.check_call(command, shell = True)
45 + except Exception as e:
48 + QMessageBox.critical(SalomePyQt.getDesktop(), "Error", "Visual Studio Code executable is not found")
49 + except Exception as e:
52 +salome_pluginsmanager.AddFunction('Launch VS Code (debugger)',
53 + 'Execute Visual Studio Code',