Exemplo n.º 1
0
 def __init__(self, parent):
     BaseShell.__init__(self, parent)
     
     # Set style to Python, or autocompletion does not work
     self.setParser('python')
     
     # Change background color to make the logger look different from shell
     # Use color as if all lines are highlighted
     f1 = self.getStyleElementFormat('Editor.text')
     f2 = self.getStyleElementFormat('Editor.Highlight current line')
     newStyle = 'back:%s, fore:%s' % (f2.back.name(), f1.fore.name())
     self.setStyle(editor_text=newStyle)
     
     # Create namespace for logger interpreter
     locals = {'pyzo':pyzo, 'sys':sys, 'os':os}
     # Include linguist tools
     for name in ['linguist', 'lrelease', 'lupdate', 'lhelp']:
         locals[name] = getattr(pyzo.util._locale, name)
     
     # Create interpreter to run code        
     self._interpreter = code.InteractiveConsole(locals, "<logger>")
     
     # Show welcome text
     moreBanner = "This is the Pyzo logger shell." 
     self.write("Python %s on %s - %s\n\n" %
                    (sys.version[:5], sys.platform, moreBanner))
     self.write(str(sys.ps1), 2)
     
     # Split console
     history = splitConsole(self.write, self.writeErr)
     self.write(history)
Exemplo n.º 2
0
    def __init__(self, parent):
        BaseShell.__init__(self, parent)

        # Set style to Python, or autocompletion does not work
        self.setParser('python')

        # Change background color to make the logger look different from shell
        # Use color as if all lines are highlighted
        f1 = self.getStyleElementFormat('Editor.text')
        f2 = self.getStyleElementFormat('Editor.Highlight current line')
        newStyle = 'back:%s, fore:%s' % (f2.back.name(), f1.fore.name())
        self.setStyle(editor_text=newStyle)

        # Create namespace for logger interpreter
        locals = {'pyzo': pyzo, 'sys': sys, 'os': os}
        # Include linguist tools
        for name in ['linguist', 'lrelease', 'lupdate', 'lhelp']:
            locals[name] = getattr(pyzo.util._locale, name)

        # Create interpreter to run code
        self._interpreter = code.InteractiveConsole(locals, "<logger>")

        # Show welcome text
        moreBanner = "This is the Pyzo logger shell."
        self.write("Python %s on %s - %s\n\n" %
                   (sys.version[:5], sys.platform, moreBanner))
        self.write(str(sys.ps1), 2)

        # Split console
        history = splitConsole(self.write, self.writeErr)
        self.write(history)