Move c and cs commands to the mainmenu class

This makes it so that it only works on the main menu, too.
This commit is contained in:
Robert Maikher 2018-08-31 13:48:06 +02:00
parent 33a9f12ac0
commit a9e5985f90
2 changed files with 11 additions and 16 deletions

View File

@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
import os
import random
import re
import sys
from select import select
@ -174,19 +172,6 @@ class Menu(object):
result = self.input_str(prompt, end_prompt)
if result == '':
print('Please enter something')
#TODO: Move this into mainmenu.py special options
# 'c' in main menu to change colours
elif result == 'c':
os.system('echo -e "\033[' + str(random.randint(40, 49)) + ';' + str(random.randint(30, 37)) + ';5m"')
os.system('clear')
self.show_context()
# 'cs' in main menu to change colours back to default
elif result == 'cs':
os.system('echo -e "\033[0m"')
os.system('clear')
self.show_context()
else:
if result.isdigit():
choice = int(result)

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import os
import random
import sys
from db import Session
@ -43,6 +43,16 @@ class MainMenu(Menu):
restart()
pass
return True
elif result == 'c':
os.system('echo -e "\033[' + str(random.randint(40, 49)) + ';' + str(random.randint(30, 37)) + ';5m"')
os.system('clear')
self.show_context()
return True
elif result == 'cs':
os.system('echo -e "\033[0m"')
os.system('clear')
self.show_context()
return True
return False
def invalid_menu_choice(self, in_str):