Browse Source

completions

283
ThomasV 12 years ago
parent
commit
6be6738fac
  1. 25
      lib/qt_console.py

25
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.

Loading…
Cancel
Save