tw.view: new extra_key_mappings attribute
This commit is contained in:
parent
279e901d0d
commit
9d33ae3d07
4 changed files with 17 additions and 24 deletions
|
|
@ -29,20 +29,10 @@ class BitcoinTwAddresses(TwAddresses, BitcoinTwRPC):
|
|||
prompt_fs_repl = {
|
||||
'BCH': (1, 'Column options: toggle [D]ays/date/confs/block, cas[h]addr')
|
||||
}
|
||||
key_mappings = {
|
||||
'a':'s_amt',
|
||||
extra_key_mappings = {
|
||||
'A':'s_age',
|
||||
'M':'s_twmmid',
|
||||
'r':'s_reverse',
|
||||
'D':'d_days',
|
||||
'e':'d_redraw',
|
||||
'E':'d_showempty',
|
||||
'u':'d_showused',
|
||||
'L':'d_all_labels',
|
||||
'v':'a_view',
|
||||
'w':'a_view_detail',
|
||||
'p':'a_print_detail',
|
||||
'l':'i_comment_add'}
|
||||
'u':'d_showused'}
|
||||
|
||||
async def get_rpc_data(self):
|
||||
|
||||
|
|
|
|||
|
|
@ -25,18 +25,6 @@ class EthereumTwAddresses(TwAddresses, EthereumTwView, EthereumTwRPC):
|
|||
'Filters: show [E]mpty addrs, show all [L]abels',
|
||||
'View/Print: pager [v]iew, [w]ide pager view, [p]rint{s}',
|
||||
'Actions: [q]uit menu, r[e]draw, [D]elete addr, add [l]abel:']
|
||||
key_mappings = {
|
||||
'a':'s_amt',
|
||||
'M':'s_twmmid',
|
||||
'r':'s_reverse',
|
||||
'e':'d_redraw',
|
||||
'E':'d_showempty',
|
||||
'L':'d_all_labels',
|
||||
'l':'i_comment_add',
|
||||
'D':'i_addr_delete',
|
||||
'v':'a_view',
|
||||
'w':'a_view_detail',
|
||||
'p':'a_print_detail'}
|
||||
|
||||
def get_column_widths(self, data, *, wide, interactive):
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,19 @@ class TwAddresses(TwView):
|
|||
no_data_errmsg = 'No addresses in tracking wallet!'
|
||||
mod_subpath = 'tw.addresses'
|
||||
|
||||
key_mappings = {
|
||||
'a':'s_amt',
|
||||
'M':'s_twmmid',
|
||||
'r':'s_reverse',
|
||||
'e':'d_redraw',
|
||||
'E':'d_showempty',
|
||||
'L':'d_all_labels',
|
||||
'l':'i_comment_add',
|
||||
'D':'i_addr_delete',
|
||||
'v':'a_view',
|
||||
'w':'a_view_detail',
|
||||
'p':'a_print_detail'}
|
||||
|
||||
class display_type(TwView.display_type):
|
||||
|
||||
class squeezed(TwView.display_type.squeezed):
|
||||
|
|
|
|||
|
|
@ -186,6 +186,7 @@ class TwView(MMGenObject, metaclass=AsyncInit):
|
|||
}
|
||||
}
|
||||
scroll_keys['darwin'] = scroll_keys['linux']
|
||||
extra_key_mappings = {}
|
||||
|
||||
def __new__(cls, cfg, proto, *args, **kwargs):
|
||||
return MMGenObject.__new__(proto.base_proto_subclass(cls, cls.mod_subpath))
|
||||
|
|
@ -201,6 +202,7 @@ class TwView(MMGenObject, metaclass=AsyncInit):
|
|||
if repl := self.prompt_fs_repl.get(self.proto.coin):
|
||||
self.prompt_fs_in[repl[0]] = repl[1]
|
||||
self.prompt_fs = '\n'.join(self.prompt_fs_in)
|
||||
self.key_mappings.update(self.extra_key_mappings)
|
||||
if self.proto.coin == 'BCH':
|
||||
self.key_mappings.update({'h': 'd_addr_view_pref'})
|
||||
self.addr_view_pref = 1 if not self.cfg.cashaddr else not self.proto.cashaddr
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue