Created a command line function for adding characters to the input

string
This commit is contained in:
bjschuma 2009-12-19 23:28:21 -05:00
parent 2086a927e1
commit 14cb66767f
4 changed files with 29 additions and 7 deletions

View File

@ -37,6 +37,8 @@ def open():
# Set these values in settings class for use elsewhere
settings.set("stdscr", stdscr)
settings.set("maxxy", maxxy)
settings.set("clinex", 0)
settings.set("cliney", 0)
# Start loop in new thread
thread = bt.needle.Needle(cline.loop.loop)

View File

@ -2,4 +2,4 @@ __author__="bjschuma"
__date__ ="$Dec 19, 2009 9:13:05 PM$"
__all__ = ["loop"]
__all__ = ["addch", "loop"]

21
src/core/cline/addch.py Normal file
View File

@ -0,0 +1,21 @@
#! /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
def addch(input):
stdscr = settings.get("stdscr")
c = stdscr.getch()
if(c >= 32 and c<= 126):
input += curses.keyname(c)
return input

View File

@ -6,11 +6,12 @@
__author__="bjschuma"
__date__ ="$Dec 19, 2009 9:39:37 PM$"
import curses
from bt.message import write
import manager
import settings
# Command line related imports
from addch import addch
global halt
@ -20,14 +21,12 @@ def loop():
write("Beginning command line loop",True)
global halt
stdscr = settings.get("stdscr")
#stdscr = settings.get("stdscr")
input = ""
while halt == False:
c = stdscr.getch()
input = addch(input)
if(c >= 32 and c<= 126):
input += curses.keyname(c)
#input=input[:x-4]+curses.keyname(c)+input[x-4:]
#self.changeLine(y)
#self.stdscr.move(y,x+1)