Improve history output
This commit is contained in:
parent
5f50429a2d
commit
820f2d970c
|
@ -103,9 +103,10 @@ class History:
|
|||
trans[i].append(bloc['writtenTime'])
|
||||
if sens in ('sent','sending'):
|
||||
trans[i].append(outPubkey)
|
||||
amount = int('-' + output.split(':')[0])
|
||||
else:
|
||||
trans[i].append(bloc['issuers'][0])
|
||||
amount = int(output.split(':')[0])
|
||||
amount = int(output.split(':')[0])
|
||||
base = int(output.split(':')[1])
|
||||
applyBase = base-currentBase
|
||||
amount = round(amount*pow(10,applyBase)/100, 2)
|
||||
|
@ -148,7 +149,7 @@ class History:
|
|||
else:
|
||||
isBold = '\033[1m'
|
||||
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='')
|
||||
for t in trans:
|
||||
if t[0] == "received": color = "green"
|
||||
|
@ -157,19 +158,11 @@ class History:
|
|||
else: color = "blue"
|
||||
if noColors:
|
||||
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'):
|
||||
comment = '(EN ATTENTE) ' + t[5]
|
||||
else:
|
||||
comment = t[5]
|
||||
else:
|
||||
amount = t[3]
|
||||
amountUD = t[4]
|
||||
comment = t[5]
|
||||
|
||||
date = datetime.fromtimestamp(t[1]).strftime("%d/%m/%Y à %H:%M")
|
||||
|
@ -180,11 +173,11 @@ class History:
|
|||
print('|', end='')
|
||||
print('-'.center(rows-1, '-'))
|
||||
print('|', end='')
|
||||
printKey = t[2][0:8] + '\u2026\u2026' + t[2][-3:]
|
||||
printKey = t[2][0:8] + '\u2026' + t[2][-3:]
|
||||
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:
|
||||
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('-'.center(rows-1, '-'))
|
||||
print('|', end='')
|
||||
|
|
Reference in New Issue