moved color printing

This commit is contained in:
Ryan Bakkes 2023-11-11 18:58:13 +01:00
parent 9047eff8a3
commit 9b34bf0b3f
2 changed files with 33 additions and 11 deletions

View File

@ -5,17 +5,6 @@ from helpers import BlockHelper as blockHelper
from helpers import TaskHelper as taskHelper
from helpers import UtilityHelper as utilityHelper
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
class MenuHelper:
def __init__(self, db):
self.db = db

View File

@ -3,6 +3,16 @@ import hashlib
import os
from helpers import BlockHelper as blockHelper
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def computeHash(data):
hash = hashlib.sha256()
@ -47,4 +57,27 @@ def loginStartup(self):
blockHelper.validateMinedBlock(self)
# TODO - check if there are any notifcations
def printError(text):
print(f"{bcolors.FAIL}{text}{bcolors.ENDC}")
def printSuccess(text):
print(f"{bcolors.OKGREEN}{text}{bcolors.ENDC}")
def printWarning(text):
print(f"{bcolors.WARNING}{text}{bcolors.ENDC}")
def printInfo(text):
print(f"{bcolors.OKBLUE}{text}{bcolors.ENDC}")
def printBold(text):
print(f"{bcolors.BOLD}{text}{bcolors.ENDC}")
def printUnderline(text):
print(f"{bcolors.UNDERLINE}{text}{bcolors.ENDC}")
def printHeader(text):
print(f"{bcolors.HEADER}{text}{bcolors.ENDC}")