PrintColorful增强
This commit is contained in:
@@ -110,6 +110,26 @@ class ConsoleStyleClass(AnsiCodes):
|
|||||||
|
|
||||||
ConsoleStyle = ConsoleStyleClass()
|
ConsoleStyle = ConsoleStyleClass()
|
||||||
|
|
||||||
|
def PrintColorful(color:str, *args, is_reset:bool=True, **kwargs):
|
||||||
|
with lock_guard():
|
||||||
|
if is_reset:
|
||||||
|
print(color,*args,ConsoleStyle.RESET_ALL, **kwargs)
|
||||||
|
else:
|
||||||
|
print(color,*args, **kwargs)
|
||||||
|
|
||||||
|
def PrintAsError(message:str):
|
||||||
|
PrintColorful(ConsoleFrontColor.RED, message)
|
||||||
|
def PrintAsWarning(message:str):
|
||||||
|
PrintColorful(ConsoleFrontColor.YELLOW, message)
|
||||||
|
def PrintAsInfo(message:str):
|
||||||
|
PrintColorful(ConsoleFrontColor.GREEN, message)
|
||||||
|
def PrintAsDebug(message:str):
|
||||||
|
PrintColorful(ConsoleFrontColor.BLUE, message)
|
||||||
|
def PrintAsSuccess(message:str):
|
||||||
|
PrintColorful(ConsoleFrontColor.GREEN, message)
|
||||||
|
def PrintAsLight(message:str):
|
||||||
|
PrintColorful(ConsoleFrontColor.LIGHTMAGENTA_EX, message)
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
|
|
||||||
class NotImplementedError(Exception):
|
class NotImplementedError(Exception):
|
||||||
@@ -137,13 +157,6 @@ def GetInternalDebug() -> bool:
|
|||||||
global INTERNAL_DEBUG
|
global INTERNAL_DEBUG
|
||||||
return INTERNAL_DEBUG
|
return INTERNAL_DEBUG
|
||||||
|
|
||||||
def PrintColorful(color:str, *args, is_reset:bool=True, **kwargs):
|
|
||||||
with lock_guard():
|
|
||||||
if is_reset:
|
|
||||||
print(color,*args,ConsoleStyle.RESET_ALL, **kwargs)
|
|
||||||
else:
|
|
||||||
print(color,*args, **kwargs)
|
|
||||||
|
|
||||||
ImportingFailedSet:Set[str] = set()
|
ImportingFailedSet:Set[str] = set()
|
||||||
def ImportingThrow(
|
def ImportingThrow(
|
||||||
ex: ImportError,
|
ex: ImportError,
|
||||||
|
Reference in New Issue
Block a user