34 from python_qt_binding.QtCore
import qVersion
41 if qVersion().startswith(
'5.'):
42 raise ImportError(
'embedding is not support with Qt 5')
43 from xterm_widget
import XTermWidget, is_xterm_available
49 if qVersion().startswith(
'5.'):
50 raise ImportError(
'spyderlib does not support Qt 5 yet')
51 from spyder_shell_widget
import SpyderShellWidget
54 SpyderShellWidget =
None
55 _has_spyderlib =
False
60 Plugin providing an interactive shell
66 'widget_class': XTermWidget,
67 'description':
'Fully functional embedded XTerm (needs xterm, only works on X11 with Qt 4).',
68 'enabled': _has_xterm,
71 'title':
'SpyderShell',
72 'widget_class': SpyderShellWidget,
73 'description':
'Advanced shell (needs spyderlib, only works with Qt 4).',
74 'enabled': _has_spyderlib,
77 'title':
'SimpleShell',
78 'widget_class': ShellWidget,
79 'description':
'Simple shell for executing non-interactive finite commands.',
87 self.setObjectName(
'Shell')
93 parser = argparse.ArgumentParser(prog=
'rqt_shell')
94 Shell.add_arguments(parser)
95 return parser.parse_args(argv)
99 group = parser.add_argument_group(
'Options for rqt_shell plugin')
100 group.add_argument(
'-i',
'--init-script',
101 help=
"Executes this script before staring a $SHELL subshell. \
102 Doesn't work for SimpleShell. \
103 Always export any variables you intend on using in $SHELL")
112 if hasattr(self.
_widget,
'close_signal'):
117 self.
_widget = selected_shell[
'widget_class'](script_path=self.
_args.init_script)
118 self.
_widget.setWindowTitle(selected_shell[
'title'])
119 if self.
_context.serial_number() > 1:
122 if hasattr(self.
_widget,
'close_signal'):
135 shell_type = dialog.get_settings()[0]
136 if shell_type
is not None and self.
_shell_type_index != shell_type[
'selected_index']:
141 if self.
_widget is not None and hasattr(self.
_widget,
'shutdown'):