La til restart-funksjon

This commit is contained in:
Vegard Aksland Sjonfjell 2013-02-11 19:08:31 +00:00
parent 007773be1a
commit 8419f814ce
1 changed files with 7 additions and 2 deletions

View File

@ -182,6 +182,11 @@ class Menu():
os.system('clear') os.system('clear')
self.show_context() self.show_context()
# Reloader dibbler fullstending
elif result == 'crash':
print "Reloading ..."
os.execl(sys.argv[0])
else: else:
if result.isdigit(): if result.isdigit():
choice = int(result) choice = int(result)
@ -198,11 +203,11 @@ class Menu():
def input_int(self, prompt=None, allowed_range=(None,None), null_allowed=False, default=None): def input_int(self, prompt=None, allowed_range=(None,None), null_allowed=False, default=None):
if prompt == None: if prompt == None:
prompt = self.prompt prompt = self.prompt
if default: if default is not None:
prompt += ("[%s] " % default) prompt += ("[%s] " % default)
while True: while True:
result = self.input_str(prompt) result = self.input_str(prompt)
if default: if default is not None:
return default return default
elif null_allowed and result == '': elif null_allowed and result == '':
return False return False