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 -*- # -*- coding: utf-8 -*-
import os
import random
import re import re
import sys import sys
from select import select from select import select
@ -174,19 +172,6 @@ class Menu(object):
result = self.input_str(prompt, end_prompt) result = self.input_str(prompt, end_prompt)
if result == '': if result == '':
print('Please enter something') 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: else:
if result.isdigit(): if result.isdigit():
choice = int(result) choice = int(result)

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
import random
import sys import sys
from db import Session from db import Session
@ -43,6 +43,16 @@ class MainMenu(Menu):
restart() restart()
pass pass
return True 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 return False
def invalid_menu_choice(self, in_str): def invalid_menu_choice(self, in_str):