proto.*.tw.unspent: move methods and classes to parent class
This commit is contained in:
parent
abdb00f49f
commit
3e85988878
3 changed files with 40 additions and 50 deletions
|
|
@ -16,6 +16,14 @@ from ....tw.unspent import TwUnspentOutputs
|
|||
|
||||
class BitcoinTwUnspentOutputs(TwUnspentOutputs):
|
||||
|
||||
class display_type(TwUnspentOutputs.display_type):
|
||||
|
||||
class squeezed(TwUnspentOutputs.display_type.squeezed):
|
||||
cols = ('num', 'txid', 'vout', 'addr', 'mmid', 'comment', 'amt', 'amt2', 'date')
|
||||
|
||||
class detail(TwUnspentOutputs.display_type.detail):
|
||||
cols = ('num', 'txid', 'vout', 'addr', 'mmid', 'amt', 'amt2', 'block', 'date_time', 'comment')
|
||||
|
||||
class MMGenTwUnspentOutput(TwUnspentOutputs.MMGenTwUnspentOutput):
|
||||
# required by gen_unspent(); setting valid_attrs explicitly is also more efficient
|
||||
valid_attrs = {
|
||||
|
|
@ -47,21 +55,11 @@ class BitcoinTwUnspentOutputs(TwUnspentOutputs):
|
|||
prompt_fs_repl = {
|
||||
'BCH': (1, 'Column options: toggle [D]ate/confs, cas[h]addr, gr[o]up, show [m]mgen addr')
|
||||
}
|
||||
key_mappings = {
|
||||
't':'s_txid',
|
||||
'a':'s_amt',
|
||||
'd':'s_addr',
|
||||
'A':'s_age',
|
||||
'M':'s_twmmid',
|
||||
'r':'s_reverse',
|
||||
extra_key_mappings = {
|
||||
'D':'d_days',
|
||||
'o':'d_group',
|
||||
'm':'d_mmid',
|
||||
'e':'d_redraw',
|
||||
'p':'a_print_detail',
|
||||
'v':'a_view',
|
||||
'w':'a_view_detail',
|
||||
'l':'i_comment_add'}
|
||||
't':'s_txid',
|
||||
'A':'s_age'}
|
||||
|
||||
sort_funcs = {
|
||||
'addr': lambda i: '{} {:010} {:024.12f}'.format(i.addr, 0xffffffff - abs(i.confs), i.amt),
|
||||
|
|
|
|||
|
|
@ -27,43 +27,14 @@ from .view import EthereumTwView
|
|||
# No unspent outputs with Ethereum, but naming must be consistent
|
||||
class EthereumTwUnspentOutputs(EthereumTwView, TwUnspentOutputs):
|
||||
|
||||
class display_type(TwUnspentOutputs.display_type):
|
||||
|
||||
class squeezed(TwUnspentOutputs.display_type.squeezed):
|
||||
cols = ('num', 'addr', 'mmid', 'comment', 'amt', 'amt2')
|
||||
|
||||
class detail(TwUnspentOutputs.display_type.detail):
|
||||
cols = ('num', 'addr', 'mmid', 'amt', 'amt2', 'comment')
|
||||
|
||||
class MMGenTwUnspentOutput(TwUnspentOutputs.MMGenTwUnspentOutput):
|
||||
valid_attrs = {'txid', 'vout', 'amt', 'amt2', 'comment', 'twmmid', 'addr', 'confs', 'skip'}
|
||||
invalid_attrs = {'proto'}
|
||||
|
||||
has_age = False
|
||||
can_group = False
|
||||
hdr_lbl = 'tracked accounts'
|
||||
desc = 'account balances'
|
||||
item_desc = 'account'
|
||||
dump_fn_pfx = 'balances'
|
||||
prompt_fs_in = [
|
||||
'Sort options: [a]mount, a[d]dr, [M]mgen addr, [r]everse',
|
||||
'Display options: show [m]mgen addr, r[e]draw screen',
|
||||
'View/Print: pager [v]iew, [w]ide pager view, [p]rint to file{s}',
|
||||
'Actions: [q]uit menu, [D]elete addr, add [l]abel, [R]efresh balance:']
|
||||
key_mappings = {
|
||||
'a':'s_amt',
|
||||
'd':'s_addr',
|
||||
'r':'s_reverse',
|
||||
'M':'s_twmmid',
|
||||
'm':'d_mmid',
|
||||
'e':'d_redraw',
|
||||
'p':'a_print_detail',
|
||||
'v':'a_view',
|
||||
'w':'a_view_detail',
|
||||
'l':'i_comment_add',
|
||||
'D':'i_addr_delete',
|
||||
'R':'i_balance_refresh'}
|
||||
|
||||
no_data_errmsg = 'No accounts in tracking wallet!'
|
||||
|
||||
def get_column_widths(self, data, *, wide, interactive):
|
||||
|
|
|
|||
|
|
@ -36,14 +36,8 @@ from .view import TwView
|
|||
|
||||
class TwUnspentOutputs(TwView):
|
||||
|
||||
class display_type(TwView.display_type):
|
||||
|
||||
class squeezed(TwView.display_type.squeezed):
|
||||
cols = ('num', 'txid', 'vout', 'addr', 'mmid', 'comment', 'amt', 'amt2', 'date')
|
||||
|
||||
class detail(TwView.display_type.detail):
|
||||
cols = ('num', 'txid', 'vout', 'addr', 'mmid', 'amt', 'amt2', 'block', 'date_time', 'comment')
|
||||
|
||||
has_age = False
|
||||
can_group = False
|
||||
show_mmid = True
|
||||
no_rpcdata_errmsg = """
|
||||
No spendable outputs found! Import addresses with balances into your
|
||||
|
|
@ -52,6 +46,33 @@ class TwUnspentOutputs(TwView):
|
|||
update_widths_on_age_toggle = False
|
||||
print_output_types = ('detail',)
|
||||
mod_subpath = 'tw.unspent'
|
||||
prompt_fs_in = [
|
||||
'Sort options: [a]mount, a[d]dr, [M]mgen addr, [r]everse',
|
||||
'Display options: show [m]mgen addr, r[e]draw screen',
|
||||
'View/Print: pager [v]iew, [w]ide pager view, [p]rint to file{s}',
|
||||
'Actions: [q]uit menu, [D]elete addr, add [l]abel, [R]efresh balance:']
|
||||
key_mappings = {
|
||||
'a':'s_amt',
|
||||
'd':'s_addr',
|
||||
'r':'s_reverse',
|
||||
'M':'s_twmmid',
|
||||
'm':'d_mmid',
|
||||
'e':'d_redraw',
|
||||
'p':'a_print_detail',
|
||||
'v':'a_view',
|
||||
'w':'a_view_detail',
|
||||
'l':'i_comment_add'}
|
||||
extra_key_mappings = {
|
||||
'D':'i_addr_delete',
|
||||
'R':'i_balance_refresh'}
|
||||
|
||||
class display_type(TwView.display_type):
|
||||
|
||||
class squeezed(TwView.display_type.squeezed):
|
||||
cols = ('num', 'addr', 'mmid', 'comment', 'amt', 'amt2')
|
||||
|
||||
class detail(TwView.display_type.detail):
|
||||
cols = ('num', 'addr', 'mmid', 'amt', 'amt2', 'comment')
|
||||
|
||||
class MMGenTwUnspentOutput(MMGenListItem):
|
||||
txid = ListItemAttr(CoinTxID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue