Browse Source

util.py,tw.py: minor bugfixes, cleanups

MMGen 7 years ago
parent
commit
a512423f7f
2 changed files with 14 additions and 14 deletions
  1. 8 8
      mmgen/tw.py
  2. 6 6
      mmgen/util.py

+ 8 - 8
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'):

+ 6 - 6
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):