-
Notifications
You must be signed in to change notification settings - Fork 90
/
faxListOutput.py
32 lines (29 loc) · 952 Bytes
/
faxListOutput.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
from mColorsAndChars import \
COLOR_DIM, \
COLOR_INFO, \
COLOR_NORMAL;
def faxListOutput(
asData,
sAndOr,
a0sImportantData = None,
uImportantDataColor = COLOR_INFO,
uNonImportantDataColor = COLOR_DIM,
uNormalColor = COLOR_NORMAL, \
):
asData = [str(x) for x in asData];
asImportantData = (
a0sImportantData if a0sImportantData is not None
else asData
);
def faxColoredData(sData):
return [uImportantDataColor if sData in asImportantData else uNonImportantDataColor, sData];
if len(asData) == 1:
asOutput = [faxColoredData(asData[0]), uNormalColor];
elif len(asData) == 2:
asOutput = [faxColoredData(asData[0]), uNormalColor, " %s " % sAndOr, faxColoredData(asData[1]), uNormalColor];
else:
asOutput = [];
for sData in asData[:-1]:
asOutput += [faxColoredData(sData), uNormalColor, ", "];
asOutput += ["and ", faxColoredData(asData[-1]), uNormalColor];
return asOutput;