From a512423f7f53b22425cd381c706a8611b232b58e Mon Sep 17 00:00:00 2001 From: MMGen Date: Sat, 26 May 2018 20:40:53 +0000 Subject: [PATCH] util.py,tw.py: minor bugfixes, cleanups --- mmgen/tw.py | 16 ++++++++-------- mmgen/util.py | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mmgen/tw.py b/mmgen/tw.py index 2922139e..afa84dad 100755 --- a/mmgen/tw.py +++ b/mmgen/tw.py @@ -33,15 +33,15 @@ class TwUnspentOutputs(MMGenObject): class MMGenTwUnspentOutput(MMGenListItem): # attrs = 'txid','vout','amt','label','twmmid','addr','confs','scriptPubKey','days','skip' txid = MMGenImmutableAttr('txid','CoinTxID') - vout = MMGenImmutableAttr('vout',int,typeconv=False), - amt = MMGenImmutableAttr('amt',g.proto.coin_amt.__name__), - label = MMGenListItemAttr('label','TwComment',reassign_ok=True), + vout = MMGenImmutableAttr('vout',int,typeconv=False) + amt = MMGenImmutableAttr('amt',g.proto.coin_amt.__name__) + label = MMGenListItemAttr('label','TwComment',reassign_ok=True) twmmid = MMGenImmutableAttr('twmmid','TwMMGenID') - addr = MMGenImmutableAttr('addr','CoinAddr'), - confs = MMGenImmutableAttr('confs',int,typeconv=False), + addr = MMGenImmutableAttr('addr','CoinAddr') + confs = MMGenImmutableAttr('confs',int,typeconv=False) scriptPubKey = MMGenImmutableAttr('scriptPubKey','HexStr') - days = MMGenListItemAttr('days',int,typeconv=False), - skip = MMGenListItemAttr('skip',bool,typeconv=False,reassign_ok=True), + days = MMGenListItemAttr('days',int,typeconv=False) + skip = MMGenListItemAttr('skip',str,typeconv=False,reassign_ok=True) wmsg = { 'no_spendable_outputs': """ @@ -151,7 +151,7 @@ watch-only wallet using '{}-addrimport' and then re-run this program. tx_w = min(64,self.cols-addr_w-28-col1_w) # min=7 txdots = ('','..')[tx_w < 64] - for i in unsp: i.skip = None + for i in unsp: i.skip = '' if self.group and (self.sort_key in ('addr','txid','twmmid')): for a,b in [(unsp[i],unsp[i+1]) for i in range(len(unsp)-1)]: for k in ('addr','txid','twmmid'): diff --git a/mmgen/util.py b/mmgen/util.py index 4743c47d..6ef921a3 100755 --- a/mmgen/util.py +++ b/mmgen/util.py @@ -753,7 +753,8 @@ def prompt_and_get_char(prompt,chars,enter_ok=False,verbose=False): def do_pager(text): - pagers,shell = ['less','more'],False + pagers = ['less','more'] + end_msg = '\n(end of text)\n\n' # --- Non-MSYS Windows code deleted --- # raw, chop, horiz scroll 8 chars, disable buggy line chopping in MSYS os.environ['LESS'] = (('--shift 8 -RS'),('-cR -#1'))[g.platform=='win'] @@ -762,16 +763,15 @@ def do_pager(text): pagers = [os.environ['PAGER']] + pagers for pager in pagers: - end = ('\n(end of text)\n','')[pager=='less'] try: - from subprocess import Popen,PIPE,STDOUT - p = Popen([pager], stdin=PIPE, shell=shell) + from subprocess import Popen,PIPE + p = Popen([pager],stdin=PIPE,shell=False) except: pass else: - p.communicate(text.encode('utf8')+end+'\n') + p.communicate(text.encode('utf8')+(end_msg,'')[pager=='less']) msg_r('\r') break - else: Msg(text+end) + else: Msg(text+end_msg) def do_license_msg(immed=False):