-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.py
62 lines (49 loc) · 1.55 KB
/
console.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
import shutil
import os
import sys
# Colorama
from colorama import init as colorama_init
from colorama import Fore
from colorama import Style
class Main:
terminal = ""
X = "" # COLUMNS
Y = "" # ROWS
class Types:
Success = 1
Error = 2
Warning = 3
Info = "None"
# Further customizations
OutputTypes = {
1: f"[{Fore.GREEN}+{Fore.WHITE}]",
2: f"[{Fore.RED}/{Fore.WHITE}]",
3: f"[{Fore.YELLOW}!{Fore.WHITE}]",
"None": f"[{Fore.CYAN}?{Fore.WHITE}]"
}
logo = """
__ __ _
\ \ / /__ _ _ _ __ | | ___ __ _ ___
\ V / _ \| | | | '__| | | / _ \ / _` |/ _ \
| | (_) | |_| | | | |__| (_) | (_| | (_) |
|_|\___/ \__,_|_| |_____\___/ \__, |\___/
|___/
"""
def __init__(self):
self.terminal = shutil.get_terminal_size()
self.X = self.terminal[0]
self.Y = self.terminal[1]
os.system("cls")
return
def showLogo(self):
temp = ""
for line in self.logo.splitlines():
temp += str(f"{line}\n").center(25 + int(self.X / 2))
print(temp)
def output(self, type, text):
try:
self.centerText(f"{self.OutputTypes[type]} {text}")
except:
self.centerText(f"{self.OutputTypes['None']} {text}")
def centerText(self, text):
print(str(f"{text}").center(12 + int(self.X)))