Backspace and enter are now dynamic command line functions. Removed

some things from the default window.
This commit is contained in:
bjschuma 2010-01-16 11:52:09 -05:00
parent 90f363d185
commit 17335545d4
4 changed files with 4 additions and 23 deletions

View File

@ -24,8 +24,6 @@ from bt.needle import Needle
def open(): def open():
write("Starting CLI", True) write("Starting CLI", True)
#thread = Needle(cline.loop.loop)
#thread.start()
# Tell settings to run this loop # Tell settings to run this loop
settings.set("loop",cline.loop.loop) settings.set("loop",cline.loop.loop)
settings.set("loopquit",cline.loop.quit) settings.set("loopquit",cline.loop.quit)
@ -40,12 +38,9 @@ def open():
# Called every time the plugin is stopped # Called every time the plugin is stopped
def close(): def close():
#settings.pop("loop")
#settings.pop("loopquit")()
cline.loop.quit() cline.loop.quit()
write("CLI has been stopped", True) write("CLI has been stopped", True)
settings.delete("keyinput") settings.delete("keyinput")
#cline.loop.quit()
def help(): def help():

View File

@ -17,9 +17,6 @@ def addch(input):
stdscr = settings.get("stdscr") stdscr = settings.get("stdscr")
c = stdscr.getch() c = stdscr.getch()
#if c == 10:
# input = enter(input)
if(c >= 32 and c<= 126): if(c >= 32 and c<= 126):
input += curses.keyname(c) input += curses.keyname(c)
@ -27,15 +24,12 @@ def addch(input):
if (c in keys.keys()) == True: if (c in keys.keys()) == True:
input = keys[c](input) input = keys[c](input)
return input return input
# Remove the last character in input # Remove the last character in input
def backspace(input): def backspace(input):
#stdscr = settings.get("stdscr")
#stdscr.deleteln()
l = len(input) l = len(input)
if(l>4): if(l>4):
return input[:l-1] return input[:l-1]

View File

@ -54,7 +54,6 @@ def quit():
curses.nocbreak() curses.nocbreak()
curses.echo() curses.echo()
settings.get("stdscr").keypad(0) settings.get("stdscr").keypad(0)
#stdscr.keypad(0)
curses.endwin() curses.endwin()
# Delete keys that settings no longer needs # Delete keys that settings no longer needs
@ -81,15 +80,12 @@ def loop():
stdscr = settings.get("stdscr") stdscr = settings.get("stdscr")
input = settings.get("prompt") input = settings.get("prompt")
#(y, x) = settings.get("stdscr").getyx()
disp(input) disp(input)
while halt == False: while halt == False:
list = settings.get("everyloop",True) list = settings.get("everyloop",True)
#print list
if not list == None: if not list == None:
for func in list: for func in list:
#write("here!")
func() func()
try: try:
input = addch(input) input = addch(input)

View File

@ -27,10 +27,6 @@ def test(button, name):
write("Test!") write("Test!")
#def hide(item,event):
# item.hide()
def pluginWindow(item): def pluginWindow(item):
plugins = window.PluginWindow() plugins = window.PluginWindow()
@ -50,11 +46,11 @@ def loop():
tools = menu.Item("Tools",None,[plugins]) tools = menu.Item("Tools",None,[plugins])
bar.append(tools) bar.append(tools)
but = button.Button("button",test,None,"I'm a button!") #but = button.Button("button",test,None,"I'm a button!")
vbox.pack(but) #vbox.pack(but)
lab = label.Label("Hello, World!") #lab = label.Label("Hello, World!")
vbox.pack(lab) #vbox.pack(lab)
settings.set("guirunning",True) settings.set("guirunning",True)
gtk.main() gtk.main()