Fikset printing av menyer så det ser greit ut med mer enn ti elementer.

This commit is contained in:
Øystein Ingmar Skartsæterhagen 2010-06-04 21:07:47 +00:00
parent 7bcb9275b3
commit 29f5c42513
1 changed files with 2 additions and 1 deletions

View File

@ -349,6 +349,7 @@ it by putting money in the box and using the "Adjust credit" menu.
self.session = None self.session = None
def _execute(self): def _execute(self):
line_format = '%' + str(len(str(len(self.items)))) + 'd ) %s'
while True: while True:
self.print_header() self.print_header()
self.set_context(None) self.set_context(None)
@ -357,7 +358,7 @@ it by putting money in the box and using the "Adjust credit" menu.
self.pause() self.pause()
return None return None
for i in range(len(self.items)): for i in range(len(self.items)):
self.printc('%d ) %s' % (i+1, self.item_name(i))) self.printc(line_format % (i+1, self.item_name(i)))
item_i = self.input_int(self.prompt, (1,len(self.items)))-1 item_i = self.input_int(self.prompt, (1,len(self.items)))-1
if self.item_is_submenu(item_i): if self.item_is_submenu(item_i):
self.items[item_i].execute() self.items[item_i].execute()