本文整理汇总了Python中spyderlib.utils.qthelpers.DialogManager.show方法的典型用法代码示例。如果您正苦于以下问题:Python DialogManager.show方法的具体用法?Python DialogManager.show怎么用?Python DialogManager.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spyderlib.utils.qthelpers.DialogManager
的用法示例。
在下文中一共展示了DialogManager.show方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ExternalPythonShell
# 需要导入模块: from spyderlib.utils.qthelpers import DialogManager [as 别名]
# 或者: from spyderlib.utils.qthelpers.DialogManager import show [as 别名]
class ExternalPythonShell(ExternalShellBase):
"""External Shell widget: execute Python script in a separate process"""
SHELL_CLASS = ExtPythonShellWidget
sig_pdb = Signal(str, int)
open_file = Signal(str, int)
ipython_kernel_start_error = Signal(str)
create_ipython_client = Signal(str)
started = Signal()
sig_finished = Signal()
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
#.........这里部分代码省略.........
示例2: Console
# 需要导入模块: from spyderlib.utils.qthelpers import DialogManager [as 别名]
# 或者: from spyderlib.utils.qthelpers.DialogManager import show [as 别名]
class Console(SpyderPluginWidget):
"""
Console widget
"""
CONF_SECTION = 'internal_console'
focus_changed = Signal()
redirect_stdio = Signal(bool)
edit_goto = Signal(str, int, str)
def __init__(self, parent=None, namespace=None, commands=[], message=None,
exitfunc=None, profile=False, multithreaded=False):
if PYQT5:
SpyderPluginWidget.__init__(self, parent, main = parent)
else:
SpyderPluginWidget.__init__(self, parent)
debug_print(" ..internal console: initializing")
self.dialog_manager = DialogManager()
# Shell
light_background = self.get_option('light_background')
self.shell = InternalShell(parent, namespace, commands, message,
self.get_option('max_line_count'),
self.get_plugin_font(), exitfunc, profile,
multithreaded,
light_background=light_background)
self.shell.status.connect(lambda msg: self.show_message.emit(msg, 0))
self.shell.go_to_error.connect(self.go_to_error)
self.shell.focus_changed.connect(lambda: self.focus_changed.emit())
# Redirecting some signals:
self.shell.redirect_stdio.connect(lambda state:
self.redirect_stdio.emit(state))
# Initialize plugin
self.initialize_plugin()
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.set_editor(self.shell)
self.find_widget.hide()
self.register_widget_shortcuts("Editor", self.find_widget)
# Main layout
layout = QVBoxLayout()
layout.addWidget(self.shell)
layout.addWidget(self.find_widget)
self.setLayout(layout)
# Parameters
self.shell.toggle_wrap_mode(self.get_option('wrap'))
# Accepting drops
self.setAcceptDrops(True)
#------ Private API --------------------------------------------------------
def set_historylog(self, historylog):
"""Bind historylog instance to this console
Not used anymore since v2.0"""
historylog.add_history(self.shell.history_filename)
self.shell.append_to_history.connect(historylog.append_to_history)
def set_inspector(self, inspector):
"""Bind inspector instance to this console"""
self.shell.inspector = inspector
#------ SpyderPluginWidget API ---------------------------------------------
def get_plugin_title(self):
"""Return widget title"""
return _('Internal console')
def get_focus_widget(self):
"""
Return the widget to give focus to when
this plugin's dockwidget is raised on top-level
"""
return self.shell
def closing_plugin(self, cancelable=False):
"""Perform actions before parent main window is closed"""
self.dialog_manager.close_all()
self.shell.exit_interpreter()
return True
def refresh_plugin(self):
pass
def get_plugin_actions(self):
"""Return a list of actions related to plugin"""
quit_action = create_action(self, _("&Quit"),
icon='exit.png', tip=_("Quit"),
triggered=self.quit)
self.register_shortcut(quit_action, "_", "Quit", "Ctrl+Q")
run_action = create_action(self, _("&Run..."), None,
'run_small.png', _("Run a Python script"),
triggered=self.run_script)
environ_action = create_action(self,
_("Environment variables..."),
icon = 'environ.png',
tip=_("Show and edit environment variables"
#.........这里部分代码省略.........
示例3: ExternalPythonShell
# 需要导入模块: from spyderlib.utils.qthelpers import DialogManager [as 别名]
# 或者: from spyderlib.utils.qthelpers.DialogManager import show [as 别名]
class ExternalPythonShell(ExternalShellBase):
"""External Shell widget: execute Python script in a separate process"""
SHELL_CLASS = ExtPythonShellWidget
def __init__(self, parent=None, fname=None, wdir=None,
interact=False, debug=False, path=[], python_args='',
ipython_shell=False, ipython_kernel=False,
arguments='', stand_alone=None,
umd_enabled=True, umd_namelist=[], umd_verbose=True,
pythonstartup=None, pythonexecutable=None,
monitor_enabled=True, mpl_patch_enabled=True,
mpl_backend=None, ets_backend='qt4', qt_api=None, pyqt_api=0,
install_qt_inputhook=True, 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.pythonstartup = pythonstartup
self.pythonexecutable = pythonexecutable
self.monitor_enabled = monitor_enabled
self.mpl_patch_enabled = mpl_patch_enabled
self.mpl_backend = mpl_backend
self.ets_backend = ets_backend
self.qt_api = qt_api
self.pyqt_api = pyqt_api
self.install_qt_inputhook = install_qt_inputhook
self.ignore_sip_setapi_errors = ignore_sip_setapi_errors
self.merge_output_channels = merge_output_channels
self.colorize_sys_stderr = colorize_sys_stderr
self.umd_enabled = umd_enabled
self.umd_namelist = umd_namelist
self.umd_verbose = umd_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, 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)
self.python_args = None
if python_args:
assert isinstance(python_args, basestring)
self.python_args = python_args
assert isinstance(arguments, basestring)
self.arguments = arguments
self.is_ipython_shell = ipython_shell
self.is_ipython_kernel = ipython_kernel
if self.is_ipython_shell or self.is_ipython_kernel:
interact = False
# Running our custom startup script for IPython sessions:
# (see spyderlib/widgets/externalshell/startup.py)
self.fname = get_module_source_path(
'spyderlib.widgets.externalshell', 'startup.py')
else:
self.fname = fname
self.shell.set_externalshell(self)
self.toggle_globals_explorer(False)
self.interact_action.setChecked(interact)
self.debug_action.setChecked(debug)
self.introspection_socket = None
self.is_interpreter = fname is None
if self.is_interpreter:
self.terminate_button.hide()
# Additional python path list
self.path = path
def set_introspection_socket(self, introspection_socket):
self.introspection_socket = introspection_socket
if self.namespacebrowser is not None:
settings = self.namespacebrowser.get_view_settings()
communicate(introspection_socket,
'set_remote_view_settings()', settings=[settings])
def set_autorefresh_timeout(self, interval):
if self.introspection_socket is not None:
#.........这里部分代码省略.........