-
Notifications
You must be signed in to change notification settings - Fork 1
/
colored.py
73 lines (56 loc) · 2.24 KB
/
colored.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import os
import platform
from datetime import datetime
from colorama import Back, Fore, Style, init
def info(item):
'''
Bright green output for normal information
'''
item = str(item)
print(Style.BRIGHT + Fore.GREEN + '[Info] ' + item + Style.RESET_ALL)
def logoInfo():
'''
Bright green logo output
'''
print(Style.BRIGHT + Fore.GREEN + '''
/██ /██ /██ /██ /██ /██
| ███ /███|__/| ██ | ██ | ██
| ████ /████ /██| ███████ /██████ /██████ /██████ | ██
| ██ ██/██ ██| ██| ██__ ██ /██__ ██|_ ██_/ /██__ ██| ██
| ██ ███| ██| ██| ██ \ ██| ██ \ ██ | ██ | ████████| ██
| ██\ █ | ██| ██| ██ | ██| ██ | ██ | ██ /██| ██_____/| ██
| ██ \/ | ██| ██| ██ | ██| ██████/ | ████/| ███████| ██
|__/ |__/|__/|__/ |__/ \______/ \___/ \_______/|__/
''' + Style.RESET_ALL)
def debugInfo(item):
'''
Bright red output for debug information
'''
item = str(item)
print(Style.BRIGHT + Fore.RED + '[Debug] ' + item + Style.RESET_ALL)
def stateInfo(item):
'''
Bright output for state information
'''
item = str(item)
print(Style.BRIGHT + Fore.MAGENTA + '[State] ' + item + Style.RESET_ALL)
def commandInfo(item):
'''
Bright blue output for movement information
'''
item = str(item)
print(Style.BRIGHT + Fore.BLUE + '[Command] ' + item + Style.RESET_ALL)
def detectedInfo(item):
'''
Bright yellow output for detected object information
'''
item = str(item)
print(Style.BRIGHT + Fore.YELLOW + '[Detected] ' + item + Style.RESET_ALL)
def clock():
'''
return now time in format of hour:minute:second
'''
return 'time: ' + datetime.utcnow().strftime('%H:%M:%S.%f')
# FIXME: unknown bug... without this output seems stuck
if (platform.system() is 'Windows') and ('WEBOTS_SERVER' in os.environ):
init()