From 3a598d56610d7891c90e7d62ccce64333854bdd3 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 24 Nov 2025 12:48:48 +0000 Subject: [PATCH] tw.view: variable, method renames --- mmgen/tw/addresses.py | 2 +- mmgen/tw/txhistory.py | 2 +- mmgen/tw/unspent.py | 2 +- mmgen/tw/view.py | 22 +++++++++++----------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mmgen/tw/addresses.py b/mmgen/tw/addresses.py index 444eb0fd..355c14a3 100755 --- a/mmgen/tw/addresses.py +++ b/mmgen/tw/addresses.py @@ -169,7 +169,7 @@ class TwAddresses(TwView): skip = '') for twmmid, data in rpc_data.items()) - def filter_data(self): + def get_disp_data(self): if self.usr_addr_list: return (d for d in self.data if d.twmmid.obj in self.usr_addr_list) else: diff --git a/mmgen/tw/txhistory.py b/mmgen/tw/txhistory.py index 29cefd97..51d388c5 100755 --- a/mmgen/tw/txhistory.py +++ b/mmgen/tw/txhistory.py @@ -51,7 +51,7 @@ class TwTxHistory(TwView): return 'No transaction history {}found!'.format( f'from block {self.sinceblock} ' if self.sinceblock else '') - def filter_data(self): + def get_disp_data(self): return (d for d in self.data if d.confirmations > 0 or self.show_unconfirmed) def set_amt_widths(self, data): diff --git a/mmgen/tw/unspent.py b/mmgen/tw/unspent.py index fe535465..d3471f13 100755 --- a/mmgen/tw/unspent.py +++ b/mmgen/tw/unspent.py @@ -138,7 +138,7 @@ class TwUnspentOutputs(TwView): 'confirmations': minconf, } for d in wl] - def filter_data(self): + def get_disp_data(self): data = self.data.copy() diff --git a/mmgen/tw/view.py b/mmgen/tw/view.py index 69ed7411..a244960e 100755 --- a/mmgen/tw/view.py +++ b/mmgen/tw/view.py @@ -288,7 +288,7 @@ class TwView(MMGenObject, metaclass=AsyncInit): await self.gen_data(rpc_data, lbl_id) if isAsync(self.gen_data) else self.gen_data(rpc_data, lbl_id)) - self.disp_data = list(self.filter_data()) + self.disp_data = tuple(self.get_disp_data()) if not self.data: die(1, f'No {self.item_desc_pl} in tracking wallet!') @@ -461,20 +461,20 @@ class TwView(MMGenObject, metaclass=AsyncInit): yield spc * self.term_width - if data and dt.colhdr_fmt_method: + if self.disp_data and dt.colhdr_fmt_method: col_hdr = getattr(self, dt.colhdr_fmt_method)(cw, hdr_fs, color) yield col_hdr.rstrip() if line_processing == 'print' else col_hdr def get_body(method): if line_processing: return getattr(self.line_processing, line_processing).do( - method, data, cw, fs, color, getattr(self, dt.line_fmt_method)) + method, self.disp_data, cw, fs, color, getattr(self, dt.line_fmt_method)) else: - return method(data, cw, fs, color, getattr(self, dt.line_fmt_method)) + return method(self.disp_data, cw, fs, color, getattr(self, dt.line_fmt_method)) - if data and dt.need_column_widths: - self.set_amt_widths(data) - cw = self.get_column_widths(data, wide=dt.detail, interactive=interactive) + if self.disp_data and dt.need_column_widths: + self.set_amt_widths(self.disp_data) + cw = self.get_column_widths(self.disp_data, wide=dt.detail, interactive=interactive) cwh = cw._asdict() fp = self.fs_params rfill = ' ' * (self.term_width - self.cols) if scroll else '' @@ -488,7 +488,7 @@ class TwView(MMGenObject, metaclass=AsyncInit): return ( tuple(gen_hdr(spc='' if line_processing == 'print' else ' ')), tuple( - get_body(getattr(self, dt.fmt_method)) if data else + get_body(getattr(self, dt.fmt_method)) if self.disp_data else [(nocolor, yellow)[color](self.nodata_msg.ljust(self.term_width))])) if not gv.stdout.isatty(): @@ -506,10 +506,10 @@ class TwView(MMGenObject, metaclass=AsyncInit): if self.has_age and (self.age_fmt in self.age_fmts_date_dependent or dt.detail): await self.set_dates(self.data) - dsave = self.disp_data - data = self.disp_data = list(self.filter_data()) # method could be a generator + disp_data_save = self.disp_data + self.disp_data = tuple(self.get_disp_data()) # method could be a generator - if data != dsave: + if self.disp_data != disp_data_save: self.pos = 0 display_hdr, display_body = make_display()