@ -1,4 +1,4 @@
import curses , datetime
import curses , datetime , locale
from decimal import Decimal
from decimal import Decimal
_ = lambda x : x
_ = lambda x : x
#from i18n import _
#from i18n import _
@ -37,6 +37,9 @@ class ElectrumGui:
self . set_cursor ( 0 )
self . set_cursor ( 0 )
self . w = curses . newwin ( 10 , 50 , 5 , 5 )
self . w = curses . newwin ( 10 , 50 , 5 , 5 )
locale . setlocale ( locale . LC_ALL , ' ' )
self . encoding = locale . getpreferredencoding ( )
set_verbosity ( False )
set_verbosity ( False )
self . tab = 0
self . tab = 0
self . pos = 0
self . pos = 0
@ -140,8 +143,9 @@ class ElectrumGui:
self . print_list ( messages , " %19s %25s " % ( " Address " , " Label " ) )
self . print_list ( messages , " %19s %25s " % ( " Address " , " Label " ) )
def print_receive ( self ) :
def print_receive ( self ) :
messages = map ( lambda addr : " %30s %30s " % ( addr , self . wallet . labels . get ( addr , " " ) ) , self . wallet . addresses ( ) )
fmt = " %-35s %-30s "
self . print_list ( messages , " %19s %25s " % ( " Address " , " Label " ) )
messages = map ( lambda addr : fmt % ( addr , self . wallet . labels . get ( addr , " " ) ) , self . wallet . addresses ( ) )
self . print_list ( messages , fmt % ( " Address " , " Label " ) )
def print_edit_line ( self , y , label , text , index , size ) :
def print_edit_line ( self , y , label , text , index , size ) :
text + = " " * ( size - len ( text ) )
text + = " " * ( size - len ( text ) )
@ -160,7 +164,6 @@ class ElectrumGui:
def print_banner ( self ) :
def print_banner ( self ) :
self . print_list ( self . network . banner . split ( ' \n ' ) )
self . print_list ( self . network . banner . split ( ' \n ' ) )
def print_list ( self , list , firstline = None ) :
def print_list ( self , list , firstline = None ) :
self . maxpos = len ( list )
self . maxpos = len ( list )
if not self . maxpos : return
if not self . maxpos : return
@ -170,7 +173,9 @@ class ElectrumGui:
for i in range ( self . maxy - 4 ) :
for i in range ( self . maxy - 4 ) :
msg = list [ i ] if i < len ( list ) else " "
msg = list [ i ] if i < len ( list ) else " "
msg + = " " * ( self . maxx - 2 - len ( msg ) )
msg + = " " * ( self . maxx - 2 - len ( msg ) )
self . stdscr . addstr ( i + 2 , 1 , msg [ 0 : self . maxx - 2 ] , curses . A_REVERSE if i == ( self . pos % self . maxpos ) else 0 )
m = msg [ 0 : self . maxx - 2 ]
m = m . encode ( self . encoding )
self . stdscr . addstr ( i + 2 , 1 , m , curses . A_REVERSE if i == ( self . pos % self . maxpos ) else 0 )
def refresh ( self ) :
def refresh ( self ) :
if self . tab == - 1 : return
if self . tab == - 1 : return