本文整理汇总了Python中qtpy.QtCore.QEventLoop.exit方法的典型用法代码示例。如果您正苦于以下问题:Python QEventLoop.exit方法的具体用法?Python QEventLoop.exit怎么用?Python QEventLoop.exit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtCore.QEventLoop
的用法示例。
在下文中一共展示了QEventLoop.exit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: InternalShell
# 需要导入模块: from qtpy.QtCore import QEventLoop [as 别名]
# 或者: from qtpy.QtCore.QEventLoop import exit [as 别名]
class InternalShell(PythonShellWidget):
"""Shell base widget: link between PythonShellWidget and Interpreter"""
status = Signal(str)
refresh = Signal()
go_to_error = Signal(str)
focus_changed = Signal()
def __init__(self, parent=None, namespace=None, commands=[], message=None,
max_line_count=300, font=None, exitfunc=None, profile=False,
multithreaded=True, light_background=True):
PythonShellWidget.__init__(self, parent,
get_conf_path('history_internal.py'),
profile)
self.set_light_background(light_background)
self.multithreaded = multithreaded
self.setMaximumBlockCount(max_line_count)
if font is not None:
self.set_font(font)
# Allow raw_input support:
self.input_loop = None
self.input_mode = False
# KeyboardInterrupt support
self.interrupted = False # used only for not-multithreaded mode
self.sig_keyboard_interrupt.connect(self.keyboard_interrupt)
# Code completion / calltips
getcfg = lambda option: CONF.get('internal_console', option)
case_sensitive = getcfg('codecompletion/case_sensitive')
self.set_codecompletion_case(case_sensitive)
# keyboard events management
self.eventqueue = []
# Init interpreter
self.exitfunc = exitfunc
self.commands = commands
self.message = message
self.interpreter = None
self.start_interpreter(namespace)
# Clear status bar
self.status.emit('')
# Embedded shell -- requires the monitor (which installs the
# 'open_in_spyder' function in builtins)
if hasattr(builtins, 'open_in_spyder'):
self.go_to_error.connect(self.open_with_external_spyder)
#------ Interpreter
def start_interpreter(self, namespace):
"""Start Python interpreter"""
self.clear()
if self.interpreter is not None:
self.interpreter.closing()
self.interpreter = Interpreter(namespace, self.exitfunc,
SysOutput, WidgetProxy,
get_debug_level())
self.interpreter.stdout_write.data_avail.connect(self.stdout_avail)
self.interpreter.stderr_write.data_avail.connect(self.stderr_avail)
self.interpreter.widget_proxy.sig_set_readonly.connect(self.setReadOnly)
self.interpreter.widget_proxy.sig_new_prompt.connect(self.new_prompt)
self.interpreter.widget_proxy.sig_edit.connect(self.edit_script)
self.interpreter.widget_proxy.sig_wait_input.connect(self.wait_input)
if self.multithreaded:
self.interpreter.start()
# Interpreter banner
banner = create_banner(self.message)
self.write(banner, prompt=True)
# Initial commands
for cmd in self.commands:
self.run_command(cmd, history=False, new_prompt=False)
# First prompt
self.new_prompt(self.interpreter.p1)
self.refresh.emit()
return self.interpreter
def exit_interpreter(self):
"""Exit interpreter"""
self.interpreter.exit_flag = True
if self.multithreaded:
self.interpreter.stdin_write.write(to_binary_string('\n'))
self.interpreter.restore_stds()
def edit_script(self, filename, external_editor):
filename = to_text_string(filename)
if external_editor:
self.external_editor(filename)
else:
self.parent().edit_script(filename)
#.........这里部分代码省略.........