示例#1
0
 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)
示例#2
0
    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
 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)
 def __init__(self):
     self.out = StringIO()
     PrefilterFrontEnd.__init__(self,argv=default_argv())
     # Some more code for isolation (yeah, crazy)
     self._on_enter()
     self.out.flush()
     self.out.reset()
     self.out.truncate()
 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()
    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))
    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))
示例#8
0
 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()
示例#9
0
    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
示例#10
0
    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
示例#11
0
    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
示例#12
0
 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
示例#13
0
 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
示例#14
0
 def callback():
     self.GotoPos(self.GetLength())
     PrefilterFrontEnd.execute(self,
                               python_string,
                               raw_string=raw_string)
示例#15
0
 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)
示例#16
0
 def callback():
     self.GotoPos(self.GetLength())
     PrefilterFrontEnd.execute(self, python_string, raw_string=raw_string)
示例#17
0
 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))
示例#18
0
 def release_output(self):
     __builtin__.raw_input = self.__old_raw_input
     PrefilterFrontEnd.release_output(self)
     self.SetLexer(stc.STC_LEX_PYTHON)
示例#19
0
 def capture_output(self):
     self.SetLexer(stc.STC_LEX_NULL)
     PrefilterFrontEnd.capture_output(self)
     __builtin__.raw_input = self.raw_input
示例#20
0
 def save_output_hooks(self):
     self.__old_raw_input = __builtin__.raw_input
     PrefilterFrontEnd.save_output_hooks(self)
示例#21
0
 def release_output(self):
     __builtin__.raw_input = self.__old_raw_input
     PrefilterFrontEnd.release_output(self)
     self.SetLexer(stc.STC_LEX_PYTHON)
 def _on_enter(self):
     self.input_buffer += '\n'
     PrefilterFrontEnd._on_enter(self)
示例#23
0
 def save_output_hooks(self):
     self.__old_raw_input = __builtin__.raw_input
     PrefilterFrontEnd.save_output_hooks(self)
示例#24
0
 def capture_output(self):
     self.SetLexer(stc.STC_LEX_NULL)
     PrefilterFrontEnd.capture_output(self)
     __builtin__.raw_input = self.raw_input
示例#25
0
 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 = ''
示例#26
0
 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)
 def _on_enter(self):
     self.input_buffer += '\n'
     PrefilterFrontEnd._on_enter(self)
示例#28
0
 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))