Browse Source

fixes for stdio/text gui

3.3.3.1
SomberNight 6 years ago
parent
commit
43664d5f11
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/gui/stdio.py
  2. 17
      electrum/gui/text.py
  3. 9
      electrum/util.py

2
electrum/gui/stdio.py

@ -88,7 +88,7 @@ class ElectrumGui:
+ "%d"%(width[2]+delta)+"s"+"%"+"%d"%(width[3]+delta)+"s"
messages = []
for tx_hash, tx_mined_status, delta, balance in self.wallet.get_history():
for tx_hash, tx_mined_status, delta, balance in reversed(self.wallet.get_history()):
if tx_mined_status.conf:
timestamp = tx_mined_status.timestamp
try:

17
electrum/gui/text.py

@ -182,8 +182,10 @@ class ElectrumGui:
self.maxpos = 6
def print_banner(self):
if self.network:
self.print_list( self.network.banner.split('\n'))
if self.network and self.network.banner:
banner = self.network.banner
banner = banner.replace('\r', '')
self.print_list(banner.split('\n'))
def print_qr(self, data):
import qrcode
@ -198,9 +200,15 @@ class ElectrumGui:
self.qr.print_ascii(out=s, invert=False)
msg = s.getvalue()
lines = msg.split('\n')
try:
for i, l in enumerate(lines):
l = l.encode("utf-8")
self.stdscr.addstr(i+5, 5, l, curses.color_pair(3))
except curses.error:
m = 'error. screen too small?'
m = m.encode(self.encoding)
self.stdscr.addstr(5, 1, m, 0)
def print_list(self, lst, firstline = None):
lst = list(lst)
@ -301,6 +309,7 @@ class ElectrumGui:
def main(self):
tty.setraw(sys.stdin)
try:
while self.tab != -1:
self.run_tab(0, self.print_history, self.run_history_tab)
self.run_tab(1, self.print_send_tab, self.run_send_tab)
@ -308,7 +317,9 @@ class ElectrumGui:
self.run_tab(3, self.print_addresses, self.run_banner_tab)
self.run_tab(4, self.print_contacts, self.run_contacts_tab)
self.run_tab(5, self.print_banner, self.run_banner_tab)
except curses.error as e:
raise Exception("Error with curses. Is your screen too small?") from e
finally:
tty.setcbreak(sys.stdin)
curses.nocbreak()
self.stdscr.keypad(0)

9
electrum/util.py

@ -23,7 +23,7 @@
import binascii
import os, sys, re, json
from collections import defaultdict
from typing import NamedTuple
from typing import NamedTuple, Union
from datetime import datetime
import decimal
from decimal import Decimal
@ -282,9 +282,12 @@ class DaemonThread(threading.Thread, PrintError):
verbosity = '*'
def set_verbosity(b):
def set_verbosity(filters: Union[str, bool]):
global verbosity
verbosity = b
if type(filters) is bool: # backwards compat
verbosity = '*' if filters else ''
return
verbosity = filters
def print_error(*args):

Loading…
Cancel
Save