#! /usr/bin/python # To change this template, choose Tools | Templates # and open the template in the editor. __author__="bjschuma" __date__ ="$Dec 19, 2009 11:19:43 PM$" import curses import settings from run import run # (Sometimes) add a character to the input string def addch(input): stdscr = settings.get("stdscr") c = stdscr.getch() if c == 10: input = enter(input) elif(c >= 32 and c<= 126): input += curses.keyname(c) elif c == 127: input = backspace(input) return input # Remove the last character in input def backspace(input): stdscr = settings.get("stdscr") stdscr.deleteln() l = len(input) if(l>4): return input[:l-1] else: return input # Attempt to run a command def enter(input): input = run(input) return input