commit 6be6738facfaec23c3095b8f273aa56e75bd3483 parent a0455725bd32cc71810c7db353ad1f8f6fba180e Author: ThomasV <thomasv@gitorious> Date: Wed, 20 Feb 2013 15:06:49 +0100 completions Diffstat:
M | lib/qt_console.py | | | 25 | +++++++++++++++++++++++++ |
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git a/lib/qt_console.py b/lib/qt_console.py @@ -166,9 +166,34 @@ class Console(QtGui.QPlainTextEdit): return elif event.key() == QtCore.Qt.Key_L and event.modifiers() == QtCore.Qt.ControlModifier: self.clear() + if event.key() == QtCore.Qt.Key_Tab: + self.completion() + return super(Console, self).keyPressEvent(event) + def completion(self): + cmd = self.getCommand() + path = cmd.split('.') + ns = self.namespace.keys() + + if len(path) == 1: + ns = ns + else: + obj = self.namespace.get(path[0]) + ns = dir(obj) + + + print ns + prefixes = [] + for x in ns: + if x.startswith(cmd): + prefixes.append(x) + + if len(prefixes) == 1: + self.setCommand(prefixes[0]) + + welcome_message = ''' --------------------------------------------------------------- Welcome to a primitive Python interpreter.