4 # commands is in the form (key, command_name)
11 def __init__(self, window):
14 def updateGeometry(self):
15 (self.my, self.mx) = self.w.getmaxyx()
16 (self.y, self.x) = self.w.getbegyx()
17 self.numCols = self.mx/self.colWidth
18 numRows = len(self.commands)/self.numCols +1
19 self.y += self.my - numRows
22 self.w.resize(self.my,self.mx)
23 self.w.mvwin(self.y,self.x)
30 for key,command in self.commands:
31 self.w.addnstr(r,c,key+" "+command+" "*self.colWidth,self.colWidth-1)
32 self.w.chgat(r,c,2,curses.A_REVERSE)
34 if c > self.colWidth*self.numCols:
45 self.w.addstr(0,0,"/")
51 if ch == curses.KEY_ENTER or ch == 10:
53 elif ch == 27: # escape
55 elif ch == curses.KEY_BACKSPACE and string !="":
56 self.w.addstr(0,1," "*len(string))
57 string = string[0:len(string)-1]
58 self.w.addstr(0,1,string)
59 elif ch>=32 and ch<=126:
60 char = curses.keyname(ch)
61 string = string + char
62 self.w.addstr(0,1,string)
66 def display(self,string):
68 self.w.addstr(0,1,string)