tror den fungerer bedre nå

This commit is contained in:
Trygve Magnus Ræder 2011-03-07 13:39:54 +00:00
parent 4c5404389f
commit ee943404af
2 changed files with 8 additions and 8 deletions

BIN
data

Binary file not shown.

View File

@ -174,12 +174,14 @@ class Menu():
elif result == 'c': elif result == 'c':
os.system('echo -e "\033['+str(random.randint(40,49))+';'+str(random.randint(30,37))+';5m"') os.system('echo -e "\033['+str(random.randint(40,49))+';'+str(random.randint(30,37))+';5m"')
os.system('clear') os.system('clear')
return None self.show_context()
# 'cs' i hovedmenyen for å sette standardfarger # 'cs' i hovedmenyen for å sette standardfarger
elif result == 'cs': elif result == 'cs':
os.system('echo -e "\033[0m"') os.system('echo -e "\033[0m"')
os.system('clear') os.system('clear')
return None self.show_context()
else: else:
try: try:
choice = int(result) choice = int(result)
@ -400,13 +402,11 @@ it by putting money in the box and using the "Adjust credit" menu.
return None return None
for i in range(len(self.items)): for i in range(len(self.items)):
self.printc(line_format % (i+1, self.item_name(i))) self.printc(line_format % (i+1, self.item_name(i)))
item_i = self.input_choice(len(self.items), prompt=self.prompt) item_i = self.input_choice(len(self.items), prompt=self.prompt) -1
if item_i==None: if self.item_is_submenu(item_i):
return self.execute() self.items[item_i].execute()
if self.item_is_submenu(item_i-1):
self.items[item_i-1].execute()
else: else:
return self.item_value(item_i-1) return self.item_value(item_i)
class Selector(Menu): class Selector(Menu):