master > master: code - saubereres Display

This commit is contained in:
RD 2021-10-24 12:40:09 +02:00
parent ab0fd15093
commit e03f07d555
2 changed files with 9 additions and 6 deletions

View File

@ -13,9 +13,13 @@ from code.core.log import *;
# METHODS display case
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def DisplayCase(name: Any):
logPlain('');
logInfo('\033[92;1mCASE {}\033[0m'.format(name))
def DisplayStartOfCase(name: Any):
DisplayBar(80);
logPlain('\033[92;1mCASE {}\033[0m'.format(name))
return;
def DisplayEndOfCase():
DisplayBar(80);
return;
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -23,7 +27,6 @@ def DisplayCase(name: Any):
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def DisplayStartOfAlgorithm(name: str, *_: Any, **inputs: Any):
DisplayBar(80);
logPlain('Ausführung vom Algorithmus: \033[92;1m{}\033[0m'.format(name));
logPlain('INPUTS');
for varname, value in inputs.items():
@ -34,7 +37,6 @@ def DisplayEndOfAlgorithm(*_: Any, **outputs: Any):
logPlain('OUTPUTS:')
for varname, value in outputs.items():
logPlain(' - {} = {}'.format(varname, value))
DisplayBar(80);
return;
def DisplayMetrics():

View File

@ -47,7 +47,7 @@ def LoopThroughCases(path: str):
config = ReadConfigFile(path);
cases = GetAttribute(config, 'parts', 'cases', expectedtype=list, default=[]);
for caseindex, case in enumerate(cases):
DisplayCase(caseindex);
DisplayStartOfCase(caseindex);
command = GetAttribute(case, 'command', expectedtype=str, default='');
inputs = GetAttribute(case, 'inputs', expectedtype=dict, default={});
@ -65,6 +65,7 @@ def LoopThroughCases(path: str):
raise ValueError('Command \033[1m{}\033[0m nicht erkannt'.format(command));
except Exception as e:
logError(e);
DisplayEndOfCase();
return;
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~