本文整理汇总了Python中spyderlib.widgets.externalshell.baseshell.ExternalShellBase类的典型用法代码示例。如果您正苦于以下问题:Python ExternalShellBase类的具体用法?Python ExternalShellBase怎么用?Python ExternalShellBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExternalShellBase类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finished
def finished(self, exit_code, exit_status):
"""Reimplement ExternalShellBase method"""
if self.is_ipykernel and exit_code == 1:
self.emit(SIGNAL("ipython_kernel_start_error(QString)"),
self.shell.get_text_with_eol())
ExternalShellBase.finished(self, exit_code, exit_status)
self.introspection_socket = None
示例2: get_options_menu
def get_options_menu(self):
ExternalShellBase.get_options_menu(self)
self.interact_action = create_action(self, _("Interact"))
self.interact_action.setCheckable(True)
self.debug_action = create_action(self, _("Debug"))
self.debug_action.setCheckable(True)
self.args_action = create_action(self, _("Arguments..."),
triggered=self.get_arguments)
self.post_mortem_action = create_action(self, _("Post Mortem Debug"))
self.post_mortem_action.setCheckable(True)
run_settings_menu = QMenu(_("Run settings"), self)
add_actions(run_settings_menu,
(self.interact_action, self.debug_action, self.args_action,
self.post_mortem_action))
self.cwd_button = create_action(self, _("Working directory"),
icon=get_std_icon('DirOpenIcon'),
tip=_("Set current working directory"),
triggered=self.set_current_working_directory)
self.env_button = create_action(self, _("Environment variables"),
icon=get_icon('environ.png'),
triggered=self.show_env)
self.syspath_button = create_action(self,
_("Show sys.path contents"),
icon=get_icon('syspath.png'),
triggered=self.show_syspath)
actions = [run_settings_menu, self.show_time_action, None,
self.cwd_button, self.env_button, self.syspath_button]
if self.menu_actions is not None:
actions += [None]+self.menu_actions
return actions
示例3: __init__
def __init__(
self,
parent=None,
wdir=None,
path=[],
light_background=True,
menu_actions=None,
show_buttons_inside=True,
show_elapsed_time=True,
):
ExternalShellBase.__init__(
self,
parent=parent,
fname=None,
wdir=wdir,
history_filename=".history",
light_background=light_background,
menu_actions=menu_actions,
show_buttons_inside=show_buttons_inside,
show_elapsed_time=show_elapsed_time,
)
# Additional python path list
self.path = path
# For compatibility with the other shells that can live in the external
# console
self.is_ipykernel = False
self.connection_file = None
示例4: get_toolbar_buttons
def get_toolbar_buttons(self):
ExternalShellBase.get_toolbar_buttons(self)
if self.namespacebrowser_button is None and self.stand_alone is not None:
self.namespacebrowser_button = create_toolbutton(
self,
text=_("Variables"),
icon=get_icon("dictedit.png"),
tip=_("Show/hide global variables explorer"),
toggled=self.toggle_globals_explorer,
text_beside_icon=True,
)
if self.terminate_button is None:
self.terminate_button = create_toolbutton(
self,
text=_("Terminate"),
icon=get_icon("stop.png"),
tip=_(
"Attempts to stop the process. The process\n"
"may not exit as a result of clicking this\n"
"button (it is given the chance to prompt\n"
"the user for any unsaved files, etc)."
),
)
buttons = []
if self.namespacebrowser_button is not None:
buttons.append(self.namespacebrowser_button)
buttons += [self.run_button, self.terminate_button, self.kill_button, self.options_button]
return buttons
示例5: __init__
def __init__(self, parent=None, wdir=None, path=[], light_background=True,
menu_actions=None, show_buttons_inside=True,
show_elapsed_time=True):
ExternalShellBase.__init__(self, parent, wdir,
history_filename='.history',
light_background=light_background,
menu_actions=menu_actions,
show_buttons_inside=show_buttons_inside,
show_elapsed_time=show_elapsed_time)
# Additional python path list
self.path = path
示例6: set_buttons_runnning_state
def set_buttons_runnning_state(self, state):
ExternalShellBase.set_buttons_runnning_state(self, state)
self.interact_action.setEnabled(not state and not self.is_interpreter)
self.debug_action.setEnabled(not state and not self.is_interpreter)
self.args_action.setEnabled(not state and not self.is_interpreter)
if state:
if self.arguments:
argstr = _("Arguments: %s") % self.arguments
else:
argstr = _("No argument")
else:
argstr = _("Arguments...")
self.args_action.setText(argstr)
self.terminate_button.setVisible(not self.is_interpreter and state)
if not state:
self.toggle_globals_explorer(False)
for btn in (self.cwd_button, self.env_button, self.syspath_button):
btn.setEnabled(state and self.monitor_enabled)
if self.namespacebrowser_button is not None:
self.namespacebrowser_button.setEnabled(state)
示例7: __init__
def __init__(self, parent=None):
ExternalShellBase.__init__(self, parent=parent, fname=None, wdir='.',
history_filename='.history',
light_background=True,
menu_actions=None,
show_buttons_inside=False,
show_elapsed_time=False)
self.setObjectName('SpyderShellWidget')
# capture tab key
#self.shell._key_tab = self._key_tab
self.shell.set_pythonshell_font(QFont('Mono'))
# Additional python path list
self.path = []
# For compatibility with the other shells that can live in the external console
self.is_ipython_kernel = False
self.connection_file = None
self.create_process()
示例8: closeEvent
def closeEvent(self, event):
self.quit_monitor()
ExternalShellBase.closeEvent(self, event)
示例9: __init__
def __init__(self, parent=None, fname=None, wdir=None,
interact=False, debug=False, post_mortem=False,
path=[], python_args='',
ipykernel=False, arguments='', stand_alone=None,
umr_enabled=True, umr_namelist=[], umr_verbose=True,
pythonstartup=None, pythonexecutable=None,
monitor_enabled=True, mpl_backend=None, ets_backend='qt4',
qt_api=None, pyqt_api=0,
ignore_sip_setapi_errors=False, merge_output_channels=False,
colorize_sys_stderr=False, autorefresh_timeout=3000,
autorefresh_state=True, light_background=True,
menu_actions=None, show_buttons_inside=True,
show_elapsed_time=True):
assert qt_api in (None, 'pyqt', 'pyside')
self.namespacebrowser = None # namespace browser widget!
self.dialog_manager = DialogManager()
self.stand_alone = stand_alone # stand alone settings (None: plugin)
self.interact = interact
self.is_ipykernel = ipykernel
self.pythonstartup = pythonstartup
self.pythonexecutable = pythonexecutable
self.monitor_enabled = monitor_enabled
self.mpl_backend = mpl_backend
self.ets_backend = ets_backend
self.qt_api = qt_api
self.pyqt_api = pyqt_api
self.ignore_sip_setapi_errors = ignore_sip_setapi_errors
self.merge_output_channels = merge_output_channels
self.colorize_sys_stderr = colorize_sys_stderr
self.umr_enabled = umr_enabled
self.umr_namelist = umr_namelist
self.umr_verbose = umr_verbose
self.autorefresh_timeout = autorefresh_timeout
self.autorefresh_state = autorefresh_state
self.namespacebrowser_button = None
self.cwd_button = None
self.env_button = None
self.syspath_button = None
self.terminate_button = None
self.notification_thread = None
ExternalShellBase.__init__(self, parent=parent, fname=fname, wdir=wdir,
history_filename='history.py',
light_background=light_background,
menu_actions=menu_actions,
show_buttons_inside=show_buttons_inside,
show_elapsed_time=show_elapsed_time)
if self.pythonexecutable is None:
self.pythonexecutable = get_python_executable()
self.python_args = None
if python_args:
assert is_text_string(python_args)
self.python_args = python_args
assert is_text_string(arguments)
self.arguments = arguments
self.connection_file = None
if self.is_ipykernel:
self.interact = False
# Running our custom startup script for IPython kernels:
# (see spyderlib/widgets/externalshell/start_ipython_kernel.py)
self.fname = get_module_source_path(
'spyderlib.widgets.externalshell', 'start_ipython_kernel.py')
self.shell.set_externalshell(self)
self.toggle_globals_explorer(False)
self.interact_action.setChecked(self.interact)
self.debug_action.setChecked(debug)
self.introspection_socket = None
self.is_interpreter = fname is None
if self.is_interpreter:
self.terminate_button.hide()
self.post_mortem_action.setChecked(post_mortem and not self.is_interpreter)
# Additional python path list
self.path = path
self.shell.path = path
示例10: transcode
def transcode(self, qba):
if os.name == 'nt':
return to_text_string( CP850_CODEC.toUnicode(qba.data()) )
else:
return ExternalShellBase.transcode(self, qba)
示例11: transcode
def transcode(self, bytes):
if os.name == 'nt':
return encoding.transcode(str(bytes.data()), 'cp850')
else:
return ExternalShellBase.transcode(self, bytes)