From 4cab864ea0561fc9045c3df0e5febfb6c3710c46 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 13 Aug 2014 09:07:18 +0200 Subject: [PATCH] console: Add 'self' to locals. --- qutebrowser/widgets/console.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qutebrowser/widgets/console.py b/qutebrowser/widgets/console.py index 116004061..d1498d946 100644 --- a/qutebrowser/widgets/console.py +++ b/qutebrowser/widgets/console.py @@ -39,7 +39,7 @@ class ConsoleLineEdit(CommandLineEdit): write = pyqtSignal(str) - def __init__(self, parent=None): + def __init__(self, parent): if not hasattr(sys, 'ps1'): sys.ps1 = '>>> ' if not hasattr(sys, 'ps2'): @@ -53,6 +53,9 @@ class ConsoleLineEdit(CommandLineEdit): '__name__': '__console__', '__doc__': None, 'qApp': QApplication.instance(), + # We use parent as self here because the user "feels" the whole + # console, not just the line edit. + 'self': parent, } self._interpreter = InteractiveInterpreter(interpreter_locals) self.history = History() @@ -158,7 +161,7 @@ class ConsoleWidget(QWidget): def __init__(self, parent=None): super().__init__(parent) - self.lineedit = ConsoleLineEdit() + self.lineedit = ConsoleLineEdit(self) self.output = ConsoleTextEdit() self.lineedit.write.connect(self.output.append) self.vbox = QVBoxLayout()