本文整理汇总了Python中IPython.frontend.prefilterfrontend.PrefilterFrontEnd类的典型用法代码示例。如果您正苦于以下问题:Python PrefilterFrontEnd类的具体用法?Python PrefilterFrontEnd怎么用?Python PrefilterFrontEnd使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PrefilterFrontEnd类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.CLIP_CHILDREN|wx.WANTS_CHARS,
styledef=None,
*args, **kwds):
""" Create Shell instance.
Parameters
-----------
styledef : dict, optional
styledef is the dictionary of options used to define the
style.
"""
if styledef is not None:
self.style = styledef
ConsoleWidget.__init__(self, parent, id, pos, size, style)
PrefilterFrontEnd.__init__(self, **kwds)
# Stick in our own raw_input:
self.ipython0.raw_input = self.raw_input
# A time for flushing the write buffer
BUFFER_FLUSH_TIMER_ID = 100
self._buffer_flush_timer = wx.Timer(self, BUFFER_FLUSH_TIMER_ID)
wx.EVT_TIMER(self, BUFFER_FLUSH_TIMER_ID, self._buffer_flush)
if 'debug' in kwds:
self.debug = kwds['debug']
kwds.pop('debug')
# Inject self in namespace, for debug
if self.debug:
self.shell.user_ns['self'] = self
# Inject our own raw_input in namespace
self.shell.user_ns['raw_input'] = self.raw_input
示例2: show_traceback
def show_traceback(self):
start_line = self.GetCurrentLine()
PrefilterFrontEnd.show_traceback(self)
self.ProcessEvent(wx.PaintEvent())
# wx.Yield()
for i in range(start_line, self.GetCurrentLine()):
self._markers[i] = self.MarkerAdd(i, _ERROR_MARKER)
示例3: __init__
def __init__(self):
self.out = StringIO()
PrefilterFrontEnd.__init__(self)
# Some more code for isolation (yeah, crazy)
self._on_enter()
self.out.flush()
self.out.reset()
self.out.truncate()
示例4: __init__
def __init__(self, pydev_host, pydev_client_port, *args, **kwargs):
PrefilterFrontEnd.__init__(self, *args, **kwargs)
# Disable the output trap: we want all that happens to go to the output directly
self.shell.output_trap = Null()
self._curr_exec_lines = []
self._continuation_prompt = ""
# Back channel to PyDev to open editors (in the future other
# info may go back this way. This is the same channel that is
# used to get stdin, see StdIn in pydev_console_utils)
self.ipython0.set_hook("editor", create_editor_hook(pydev_host, pydev_client_port))
示例5: __init__
def __init__(self):
ipython0 = get_ipython0().IP
self.out = StringIO()
PrefilterFrontEnd.__init__(self, ipython0=ipython0)
# Clean up the namespace for isolation between tests
user_ns = self.ipython0.user_ns
# We need to keep references to things so that they don't
# get garbage collected (this stinks).
self.shadow_ns = dict()
for i in self.ipython0.magic_who_ls():
self.shadow_ns[i] = user_ns.pop(i)
# Some more code for isolation (yeah, crazy)
self._on_enter()
self.out.flush()
self.out.reset()
self.out.truncate()
示例6: __init__
def __init__(
self,
parent,
id=wx.ID_ANY,
pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.CLIP_CHILDREN | wx.WANTS_CHARS,
*args,
**kwds
):
""" Create Shell instance.
"""
ConsoleWidget.__init__(self, parent, id, pos, size, style)
PrefilterFrontEnd.__init__(self, **kwds)
# Stick in our own raw_input:
self.ipython0.raw_input = self.raw_input
# Marker for complete buffer.
self.MarkerDefine(_COMPLETE_BUFFER_MARKER, stc.STC_MARK_BACKGROUND, background=_COMPLETE_BUFFER_BG)
# Marker for current input buffer.
self.MarkerDefine(_INPUT_MARKER, stc.STC_MARK_BACKGROUND, background=_INPUT_BUFFER_BG)
# Marker for tracebacks.
self.MarkerDefine(_ERROR_MARKER, stc.STC_MARK_BACKGROUND, background=_ERROR_BG)
# A time for flushing the write buffer
BUFFER_FLUSH_TIMER_ID = 100
self._buffer_flush_timer = wx.Timer(self, BUFFER_FLUSH_TIMER_ID)
wx.EVT_TIMER(self, BUFFER_FLUSH_TIMER_ID, self._buffer_flush)
if "debug" in kwds:
self.debug = kwds["debug"]
kwds.pop("debug")
# Inject self in namespace, for debug
if self.debug:
self.shell.user_ns["self"] = self
# Inject our own raw_input in namespace
self.shell.user_ns["raw_input"] = self.raw_input
示例7: _on_enter
def _on_enter(self):
""" Called on return key down, in readline input_state.
"""
last_line_num = self.LineFromPosition(self.GetLength())
current_line_num = self.LineFromPosition(self.GetCurrentPos())
new_line_pos = (last_line_num - current_line_num)
if self.debug:
print >>sys.__stdout__, repr(self.input_buffer)
self.write('\n', refresh=False)
# Under windows scintilla seems to be doing funny
# stuff to the line returns here, but the getter for
# input_buffer filters this out.
if sys.platform == 'win32':
self.input_buffer = self.input_buffer
old_prompt_num = self.current_prompt_pos
has_executed = PrefilterFrontEnd._on_enter(self,
new_line_pos=new_line_pos)
if old_prompt_num == self.current_prompt_pos:
# No execution has happened
self.GotoPos(self.GetLineEndPosition(current_line_num + 1))
return has_executed
示例8: _on_enter
def _on_enter(self):
self.input_buffer += '\n'
PrefilterFrontEnd._on_enter(self)
示例9: __init__
def __init__(self, *args, **kwargs):
PrefilterFrontEnd.__init__(self, *args, **kwargs)
#Disable the output trap: we want all that happens to go to the output directly
self.shell.output_trap = Null()
self._curr_exec_lines = []
self._continuation_prompt = ''
示例10: _on_enter
def _on_enter(self):
""" Called on return key down, in readline input_state.
"""
if self.debug:
print >>sys.__stdout__, repr(self.input_buffer)
PrefilterFrontEnd._on_enter(self)
示例11: after_execute
def after_execute(self):
PrefilterFrontEnd.after_execute(self)
# Clear the wait cursor
if hasattr(self, "_cursor"):
del self._cursor
self.SetCursor(wx.StockCursor(wx.CURSOR_CHAR))
示例12: release_output
def release_output(self):
__builtin__.raw_input = self.__old_raw_input
PrefilterFrontEnd.release_output(self)
self.SetLexer(stc.STC_LEX_PYTHON)
示例13: capture_output
def capture_output(self):
self.SetLexer(stc.STC_LEX_NULL)
PrefilterFrontEnd.capture_output(self)
__builtin__.raw_input = self.raw_input
示例14: save_output_hooks
def save_output_hooks(self):
self.__old_raw_input = __builtin__.raw_input
PrefilterFrontEnd.save_output_hooks(self)
示例15: callback
def callback():
self.GotoPos(self.GetLength())
PrefilterFrontEnd.execute(self, python_string, raw_string=raw_string)