|
|
@@ -31,12 +31,13 @@ class MoneroTwUnspentOutputs(MoneroTwView, TwUnspentOutputs):
|
|
|
nice_addr_w = {'addr': 20}
|
|
|
|
|
|
prompt_fs_in = [
|
|
|
- 'Sort options: [a]mount, a[d]dr, [M]mgen addr, [r]everse',
|
|
|
+ 'Sort options: [a]mount, [A]ge, a[d]dr, [M]mgen addr, [r]everse',
|
|
|
'Display options: r[e]draw screen',
|
|
|
'View/Print: pager [v]iew, [w]ide pager view, [p]rint to file{s}',
|
|
|
'Actions: [q]uit menu, add [l]abel, [R]efresh balances:']
|
|
|
extra_key_mappings = {
|
|
|
- 'R': 'a_sync_wallets'}
|
|
|
+ 'R': 'a_sync_wallets',
|
|
|
+ 'A': 's_age'}
|
|
|
|
|
|
sort_disp = {
|
|
|
'addr': 'Addr',
|
|
|
@@ -47,7 +48,7 @@ class MoneroTwUnspentOutputs(MoneroTwView, TwUnspentOutputs):
|
|
|
# NB: For account-based views, ALL sort keys MUST begin with acct_sort_key!
|
|
|
sort_funcs = {
|
|
|
'addr': lambda i: '{}:{}'.format(i.twmmid.obj.acct_sort_key, i.addr),
|
|
|
- 'age': lambda i: i.twmmid.sort_key, # dummy (age sort not supported)
|
|
|
+ 'age': lambda i: '{}:{:020}'.format(i.twmmid.obj.acct_sort_key, 0 - i.confs),
|
|
|
'amt': lambda i: '{}:{:050}'.format(i.twmmid.obj.acct_sort_key, i.amt.to_unit('atomic')),
|
|
|
'twmmid': lambda i: i.twmmid.sort_key} # sort_key begins with acct_sort_key
|
|
|
|
|
|
@@ -63,32 +64,36 @@ class MoneroTwUnspentOutputs(MoneroTwView, TwUnspentOutputs):
|
|
|
addr = data['addr'],
|
|
|
confs = data['confs'],
|
|
|
comment = data['lbl'].comment,
|
|
|
- amt = data['amt'])
|
|
|
+ amt = data['amt'],
|
|
|
+ unlocked_amt = data['unlocked_amt'])
|
|
|
for twmmid, data in rpc_data.items())
|
|
|
|
|
|
def get_disp_data(self):
|
|
|
chk_fail_msg = 'For account-based views, ALL sort keys MUST begin with acct_sort_key!'
|
|
|
- ad = namedtuple('accts_data', ['idx', 'acct_idx', 'total', 'data'])
|
|
|
+ ad = namedtuple('accts_data', ['idx', 'acct_idx', 'total', 'unlocked_total', 'data'])
|
|
|
bd = namedtuple('accts_data_data', ['disp_data_idx', 'data'])
|
|
|
def gen_accts_data():
|
|
|
- idx, acct_idx, total, d_acc = (None, None, 0, {})
|
|
|
+ idx, acct_idx = (None, None)
|
|
|
+ total, unlocked_total, d_acc = (0, 0, {})
|
|
|
chk_acc = [] # check for out-of-order accounts (developer idiot-proofing)
|
|
|
for n, d in enumerate(self.data):
|
|
|
m = d.twmmid.obj
|
|
|
if idx != m.idx or acct_idx != m.acct_idx:
|
|
|
if idx:
|
|
|
- yield ad(idx, acct_idx, total, d_acc)
|
|
|
+ yield ad(idx, acct_idx, total, unlocked_total, d_acc)
|
|
|
chk_acc.append((m.idx, m.acct_idx))
|
|
|
idx = m.idx
|
|
|
acct_idx = m.acct_idx
|
|
|
total = d.amt
|
|
|
+ unlocked_total = d.unlocked_amt
|
|
|
d_acc = {m.addr_idx: bd(n, d)}
|
|
|
else:
|
|
|
total += d.amt
|
|
|
+ unlocked_total += d.unlocked_amt
|
|
|
d_acc[m.addr_idx] = bd(n, d)
|
|
|
if idx:
|
|
|
assert len(set(chk_acc)) == len(chk_acc), chk_fail_msg
|
|
|
- yield ad(idx, acct_idx, total, d_acc)
|
|
|
+ yield ad(idx, acct_idx, total, unlocked_total, d_acc)
|
|
|
self.accts_data = tuple(gen_accts_data())
|
|
|
return super().get_disp_data()
|
|
|
|
|
|
@@ -129,7 +134,10 @@ class MoneroTwUnspentOutputs(MoneroTwView, TwUnspentOutputs):
|
|
|
str(n + 1) + ')',
|
|
|
d.idx.fmt(6, color=color),
|
|
|
d.acct_idx.fmt(7, color=color),
|
|
|
- d.total.hl(color=color)).ljust(self.term_width)
|
|
|
+ d.total.hl2(
|
|
|
+ color = color,
|
|
|
+ color_override = None if d.total == d.unlocked_total else 'orange'
|
|
|
+ )).ljust(self.term_width)
|
|
|
for v in d.data.values():
|
|
|
yield fmt_method(None, v.data, cw, fs, color, None, None)
|
|
|
|
|
|
@@ -138,7 +146,11 @@ class MoneroTwUnspentOutputs(MoneroTwView, TwUnspentOutputs):
|
|
|
I = d.twmmid.obj.addr_idx.fmt(cw.addr_idx, color=color),
|
|
|
a = d.addr.fmt(self.addr_view_pref, cw.addr, color=color),
|
|
|
c = d.comment.fmt2(cw.comment, color=color, nullrepl='-'),
|
|
|
- A = d.amt.fmt(cw.iwidth, color=color, prec=self.disp_prec))
|
|
|
+ A = d.amt.fmt2(
|
|
|
+ cw.iwidth,
|
|
|
+ color = color,
|
|
|
+ color_override = None if d.amt == d.unlocked_amt else 'orange',
|
|
|
+ prec = self.disp_prec))
|
|
|
|
|
|
async def get_idx_from_user(self):
|
|
|
if res := await self.get_idx(f'{self.item_desc} number', self.accts_data):
|