Exemplo n.º 1
0
    def __init__(self, flist=None):
        self.interp = ModifiedInterpreter(self)
        if flist is None:
            root = Tk()
            fixwordbreaks(root)
            root.withdraw()
            flist = PyShellFileList(root)

        OutputWindow.__init__(self, flist, None, None)

        import __builtin__
        __builtin__.quit = __builtin__.exit = "To exit, type Ctrl-D."

        self.auto = self.extensions["AutoIndent"] # Required extension
        self.auto.config(prefertabs=1)

        text = self.text
        text.configure(wrap="char")
        text.bind("<<newline-and-indent>>", self.enter_callback)
        text.bind("<<plain-newline-and-indent>>", self.linefeed_callback)
        text.bind("<<interrupt-execution>>", self.cancel_callback)
        text.bind("<<beginning-of-line>>", self.home_callback)
        text.bind("<<end-of-file>>", self.eof_callback)
        text.bind("<<open-stack-viewer>>", self.open_stack_viewer)
        text.bind("<<toggle-debugger>>", self.toggle_debugger)
        text.bind("<<open-python-shell>>", self.flist.open_shell)
        text.bind("<<toggle-jit-stack-viewer>>", self.toggle_jit_stack_viewer)

        sys.stdout = PseudoFile(self, "stdout")
        sys.stderr = PseudoFile(self, "stderr")
        sys.stdin = self
        self.console = PseudoFile(self, "console")

        self.history = self.History(self.text)
Exemplo n.º 2
0
 def __init__(self, flist=None):
     if use_subprocess:
         ms = self.menu_specs
         if ms[2][0] != "shell":
             ms.insert(2, ("shell", "_Shell"))
     self.interp = ModifiedInterpreter(self)
     if flist is None:
         root = Tk()
         fixwordbreaks(root)
         root.withdraw()
         flist = PyShellFileList(root)
     #
     OutputWindow.__init__(self, flist, None, None)
     #
     import __builtin__
     __builtin__.quit = __builtin__.exit = "To exit, type Ctrl-D."
     #
     self.config(usetabs=1, indentwidth=8, context_use_ps1=1)
     #
     text = self.text
     text.configure(wrap="char")
     text.bind("<<newline-and-indent>>", self.enter_callback)
     text.bind("<<plain-newline-and-indent>>", self.linefeed_callback)
     text.bind("<<interrupt-execution>>", self.cancel_callback)
     text.bind("<<beginning-of-line>>", self.home_callback)
     text.bind("<<end-of-file>>", self.eof_callback)
     text.bind("<<open-stack-viewer>>", self.open_stack_viewer)
     text.bind("<<toggle-debugger>>", self.toggle_debugger)
     text.bind("<<open-python-shell>>", self.flist.open_shell)
     text.bind("<<toggle-jit-stack-viewer>>", self.toggle_jit_stack_viewer)
     if use_subprocess:
         text.bind("<<view-restart>>", self.view_restart_mark)
         text.bind("<<restart-shell>>", self.restart_shell)
     #
     self.save_stdout = sys.stdout
     self.save_stderr = sys.stderr
     self.save_stdin = sys.stdin
     import IOBinding
     self.stdout = PseudoFile(self, "stdout", IOBinding.encoding)
     self.stderr = PseudoFile(self, "stderr", IOBinding.encoding)
     self.console = PseudoFile(self, "console", IOBinding.encoding)
     if not use_subprocess:
         sys.stdout = self.stdout
         sys.stderr = self.stderr
         sys.stdin = self
     #
     self.history = self.History(self.text)
     #
     self.pollinterval = 50  # millisec
     if use_subprocess:
         self.interp.start_subprocess()
Exemplo n.º 3
0
 def __init__(self, flist=None):
     if use_subprocess:
         ms = self.menu_specs
         if ms[2][0] != "shell":
             ms.insert(2, ("shell", "_Shell"))
     self.interp = ModifiedInterpreter(self)
     if flist is None:
         root = Tk()
         fixwordbreaks(root)
         root.withdraw()
         flist = PyShellFileList(root)
     #
     OutputWindow.__init__(self, flist, None, None)
     #
     import __builtin__
     __builtin__.quit = __builtin__.exit = "To exit, type Ctrl-D."
     #
     self.config(usetabs=1, indentwidth=8, context_use_ps1=1)
     #
     text = self.text
     text.configure(wrap="char")
     text.bind("<<newline-and-indent>>", self.enter_callback)
     text.bind("<<plain-newline-and-indent>>", self.linefeed_callback)
     text.bind("<<interrupt-execution>>", self.cancel_callback)
     text.bind("<<beginning-of-line>>", self.home_callback)
     text.bind("<<end-of-file>>", self.eof_callback)
     text.bind("<<open-stack-viewer>>", self.open_stack_viewer)
     text.bind("<<toggle-debugger>>", self.toggle_debugger)
     text.bind("<<open-python-shell>>", self.flist.open_shell)
     text.bind("<<toggle-jit-stack-viewer>>", self.toggle_jit_stack_viewer)
     if use_subprocess:
         text.bind("<<view-restart>>", self.view_restart_mark)
         text.bind("<<restart-shell>>", self.restart_shell)
     #
     self.save_stdout = sys.stdout
     self.save_stderr = sys.stderr
     self.save_stdin = sys.stdin
     import IOBinding
     self.stdout = PseudoFile(self, "stdout", IOBinding.encoding)
     self.stderr = PseudoFile(self, "stderr", IOBinding.encoding)
     self.console = PseudoFile(self, "console", IOBinding.encoding)
     if not use_subprocess:
         sys.stdout = self.stdout
         sys.stderr = self.stderr
         sys.stdin = self
     #
     self.history = self.History(self.text)
     #
     self.pollinterval = 50  # millisec
     if use_subprocess:
         self.interp.start_subprocess()
Exemplo n.º 4
0
#! /usr/bin/env python