Improve history output
This commit is contained in:
parent
5f50429a2d
commit
820f2d970c
|
@ -103,6 +103,7 @@ class History:
|
||||||
trans[i].append(bloc['writtenTime'])
|
trans[i].append(bloc['writtenTime'])
|
||||||
if sens in ('sent','sending'):
|
if sens in ('sent','sending'):
|
||||||
trans[i].append(outPubkey)
|
trans[i].append(outPubkey)
|
||||||
|
amount = int('-' + output.split(':')[0])
|
||||||
else:
|
else:
|
||||||
trans[i].append(bloc['issuers'][0])
|
trans[i].append(bloc['issuers'][0])
|
||||||
amount = int(output.split(':')[0])
|
amount = int(output.split(':')[0])
|
||||||
|
@ -148,7 +149,7 @@ class History:
|
||||||
else:
|
else:
|
||||||
isBold = '\033[1m'
|
isBold = '\033[1m'
|
||||||
isBoldEnd = '\033[0m'
|
isBoldEnd = '\033[0m'
|
||||||
print(isBold + "|{: <19} | {: <14} | {: <7} | {: <7} | {: <30}".format(" Date"," De / À"," {0}".format(currency)," DU/{0}".format(currency.lower()),"Commentaire") + isBoldEnd)
|
print(isBold + "|{: <19} | {: <12} | {: <7} | {: <7} | {: <30}".format(" Date"," De / À"," {0}".format(currency)," DU/{0}".format(currency.lower()),"Commentaire") + isBoldEnd)
|
||||||
print('|', end='')
|
print('|', end='')
|
||||||
for t in trans:
|
for t in trans:
|
||||||
if t[0] == "received": color = "green"
|
if t[0] == "received": color = "green"
|
||||||
|
@ -157,19 +158,11 @@ class History:
|
||||||
else: color = "blue"
|
else: color = "blue"
|
||||||
if noColors:
|
if noColors:
|
||||||
color = None
|
color = None
|
||||||
if t[0] in ('sent','sending'):
|
|
||||||
amount = '-' + str(t[3])
|
|
||||||
amountUD = '-' + str(t[4])
|
|
||||||
else:
|
|
||||||
amount = t[3]
|
|
||||||
amountUD = t[4]
|
|
||||||
if t[0] in ('receiving','sending'):
|
if t[0] in ('receiving','sending'):
|
||||||
comment = '(EN ATTENTE) ' + t[5]
|
comment = '(EN ATTENTE) ' + t[5]
|
||||||
else:
|
else:
|
||||||
comment = t[5]
|
comment = t[5]
|
||||||
else:
|
else:
|
||||||
amount = t[3]
|
|
||||||
amountUD = t[4]
|
|
||||||
comment = t[5]
|
comment = t[5]
|
||||||
|
|
||||||
date = datetime.fromtimestamp(t[1]).strftime("%d/%m/%Y à %H:%M")
|
date = datetime.fromtimestamp(t[1]).strftime("%d/%m/%Y à %H:%M")
|
||||||
|
@ -180,11 +173,11 @@ class History:
|
||||||
print('|', end='')
|
print('|', end='')
|
||||||
print('-'.center(rows-1, '-'))
|
print('-'.center(rows-1, '-'))
|
||||||
print('|', end='')
|
print('|', end='')
|
||||||
printKey = t[2][0:8] + '\u2026\u2026' + t[2][-3:]
|
printKey = t[2][0:8] + '\u2026' + t[2][-3:]
|
||||||
if noColors:
|
if noColors:
|
||||||
print(" {: <18} | {: <14} | {: <7} | {: <7} | {: <30}".format(date, printKey, amount, amountUD, comment))
|
print(" {: <18} | {: <12} | {: <7} | {: <7} | {: <30}".format(date, printKey, t[3], t[4], comment))
|
||||||
else:
|
else:
|
||||||
print(colored(" {: <18} | {: <14} | {: <7} | {: <7} | {: <30}".format(date, printKey, amount, amountUD, comment), color))
|
print(colored(" {: <18} | {: <12} | {: <7} | {: <7} | {: <30}".format(date, printKey, t[3], t[4], comment), color))
|
||||||
print('|', end='')
|
print('|', end='')
|
||||||
print('-'.center(rows-1, '-'))
|
print('-'.center(rows-1, '-'))
|
||||||
print('|', end='')
|
print('|', end='')
|
||||||
|
|
Reference in New Issue