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'):
113 self._widget.close_signal.disconnect(self._context.close_plugin)
114 self._context.remove_widget(self.
_widget)
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:
120 self._widget.setWindowTitle(self._widget.windowTitle() + (
' (%d)' % self._context.serial_number()))
121 self._context.add_widget(self.
_widget)
122 if hasattr(self.
_widget,
'close_signal'):
123 self._widget.close_signal.connect(self._context.close_plugin)
135 shell_type = dialog.get_settings()[0]
136 if shell_type
is not None and self.
_shell_type_index != shell_type[
'selected_index']:
138 self._context.reload_plugin()
141 if self.
_widget is not None and hasattr(self.
_widget,
'shutdown'):
142 self._widget.shutdown()
def trigger_configuration(self)
def add_arguments(parser)
def shutdown_plugin(self)
def save_settings(self, plugin_settings, instance_settings)
def _parse_args(self, argv)
def __init__(self, context)
def restore_settings(self, plugin_settings, instance_settings)
def _switch_shell_widget(self)