@ -38,6 +38,7 @@ except:
from wallet import format_satoshis
import bmp , mnemonic , pyqrnative , qrscanner
import exchange_rate
from decimal import Decimal
@ -335,6 +336,9 @@ class ElectrumWindow(QMainWindow):
self . connect ( self , QtCore . SIGNAL ( ' updatesignal ' ) , self . update_wallet )
#self.connect(self, SIGNAL('editamount'), self.edit_amount)
self . history_list . setFocus ( True )
self . exchanger = exchange_rate . Exchanger ( self )
self . connect ( self , SIGNAL ( " refresh_balance() " ) , self . update_wallet )
# dark magic fix by flatfly; https://bitcointalk.org/index.php?topic=73651.msg959913#msg959913
if platform . system ( ) == ' Windows ' :
@ -384,6 +388,7 @@ class ElectrumWindow(QMainWindow):
c , u = self . wallet . get_balance ( )
text = _ ( " Balance " ) + " : %s " % ( format_satoshis ( c , False , self . wallet . num_zeros ) )
if u : text + = " [ %s unconfirmed] " % ( format_satoshis ( u , True , self . wallet . num_zeros ) . strip ( ) )
text + = self . create_quote_text ( Decimal ( c + u ) / 100000000 )
icon = QIcon ( " :icons/status_connected.png " )
else :
text = _ ( " Not connected " )
@ -402,7 +407,15 @@ class ElectrumWindow(QMainWindow):
self . update_contacts_tab ( )
self . update_completions ( )
def create_quote_text ( self , btc_balance ) :
quote_currency = self . config . get ( " currency " , " None " )
quote_balance = self . exchanger . exchange ( btc_balance , quote_currency )
if quote_balance is None :
quote_text = " "
else :
quote_text = " ( %.2f %s ) " % ( quote_balance , quote_currency )
return quote_text
def create_history_tab ( self ) :
self . history_list = l = MyTreeWidget ( self )
l . setColumnCount ( 5 )
@ -1512,16 +1525,16 @@ class ElectrumWindow(QMainWindow):
tabs = QTabWidget ( self )
vbox . addWidget ( tabs )
tab = QWidget ( )
grid_wallet = QGridLayout ( tab )
grid_wallet . setColumnStretch ( 0 , 1 )
tabs . addTab ( tab , _ ( ' Wallet ' ) )
tab2 = QWidget ( )
grid_ui = QGridLayout ( tab2 )
grid_ui . setColumnStretch ( 0 , 1 )
tabs . addTab ( tab2 , _ ( ' Display ' ) )
tab = QWidget ( )
grid_wallet = QGridLayout ( tab )
grid_wallet . setColumnStretch ( 0 , 1 )
tabs . addTab ( tab , _ ( ' Wallet ' ) )
fee_label = QLabel ( _ ( ' Transaction fee ' ) )
grid_wallet . addWidget ( fee_label , 2 , 0 )
fee_e = QLineEdit ( )
@ -1575,23 +1588,19 @@ class ElectrumWindow(QMainWindow):
gui_label = QLabel ( _ ( ' Default GUI ' ) + ' : ' )
grid_ui . addWidget ( gui_label , 7 , 0 )
gui_combo = QComboBox ( )
gui_combo . addItems ( [ ' Lite ' , ' Classic ' , ' Gtk ' , ' Text ' ] )
gui_combo . addItems ( [ ' Lite ' , ' Classic ' ] )
index = gui_combo . findText ( self . config . get ( " gui " , " classic " ) . capitalize ( ) )
if index == - 1 : index = 1
gui_combo . setCurrentIndex ( index )
grid_ui . addWidget ( gui_combo , 7 , 1 )
grid_ui . addWidget ( HelpButton ( _ ( ' Select which GUI mode to use at start up. ' ) ) , 7 , 2 )
grid_ui . addWidget ( HelpButton ( _ ( ' Select which GUI mode to use at start up. ' + ' \n ' + ' Note: use the command line to access the " text " and " gtk " GUIs ' ) ) , 7 , 2 )
if not self . config . is_modifiable ( ' gui ' ) :
for w in [ gui_combo , gui_label ] : w . setEnabled ( False )
lang_label = QLabel ( _ ( ' Language ' ) + ' : ' )
grid_ui . addWidget ( lang_label , 8 , 0 )
lang_combo = QComboBox ( )
languages = { ' ' : _ ( ' Default ' ) , ' br ' : _ ( ' Brasilian ' ) , ' cs ' : _ ( ' Czech ' ) , ' de ' : _ ( ' German ' ) ,
' eo ' : _ ( ' Esperanto ' ) , ' en ' : _ ( ' English ' ) , ' es ' : _ ( ' Spanish ' ) , ' fr ' : _ ( ' French ' ) ,
' it ' : _ ( ' Italian ' ) , ' lv ' : _ ( ' Latvian ' ) , ' nl ' : _ ( ' Dutch ' ) , ' ru ' : _ ( ' Russian ' ) ,
' sl ' : _ ( ' Slovenian ' ) , ' vi ' : _ ( ' Vietnamese ' ) , ' zh ' : _ ( ' Chinese ' )
}
from i18n import languages
lang_combo . addItems ( languages . values ( ) )
try :
index = languages . keys ( ) . index ( self . config . get ( " language " , ' ' ) )
@ -1603,19 +1612,33 @@ class ElectrumWindow(QMainWindow):
if not self . config . is_modifiable ( ' language ' ) :
for w in [ lang_combo , lang_label ] : w . setEnabled ( False )
currencies = self . exchanger . get_currencies ( )
currencies . insert ( 0 , " None " )
cur_label = QLabel ( _ ( ' Currency ' ) + ' : ' )
grid_ui . addWidget ( cur_label , 9 , 0 )
cur_combo = QComboBox ( )
cur_combo . addItems ( currencies )
try :
index = currencies . index ( self . config . get ( ' currency ' , " None " ) )
except :
index = 0
cur_combo . setCurrentIndex ( index )
grid_ui . addWidget ( cur_combo , 9 , 1 )
grid_ui . addWidget ( HelpButton ( _ ( ' Select which currency is used for quotes. ' ) ) , 9 , 2 )
view_label = QLabel ( _ ( ' Receive Tab ' ) + ' : ' )
grid_ui . addWidget ( view_label , 9 , 0 )
grid_ui . addWidget ( view_label , 10 , 0 )
view_combo = QComboBox ( )
view_combo . addItems ( [ _ ( ' Simple ' ) , _ ( ' Advanced ' ) , _ ( ' Point of Sale ' ) ] )
view_combo . setCurrentIndex ( self . receive_tab_mode )
grid_ui . addWidget ( view_combo , 9 , 1 )
grid_ui . addWidget ( view_combo , 10 , 1 )
hh = _ ( ' This selects the interaction mode of the " Receive " tab. ' ) + ' \n \n ' \
+ _ ( ' Simple ' ) + ' : ' + _ ( ' Show only addresses and labels. ' ) + ' \n \n ' \
+ _ ( ' Advanced ' ) + ' : ' + _ ( ' Show address balances and add extra menu items to freeze/prioritize addresses. ' ) + ' \n \n ' \
+ _ ( ' Point of Sale ' ) + ' : ' + _ ( ' Show QR code window and amounts requested for each address. Add menu item to request amount. ' ) + ' \n \n '
grid_ui . addWidget ( HelpButton ( hh ) , 9 , 2 )
grid_ui . addWidget ( HelpButton ( hh ) , 10 , 2 )
vbox . addLayout ( ok_cancel_buttons ( d ) )
d . setLayout ( vbox )
@ -1678,6 +1701,11 @@ class ElectrumWindow(QMainWindow):
if lang_request != self . config . get ( ' language ' ) :
self . config . set_key ( " language " , lang_request , True )
need_restart = True
cur_request = str ( currencies [ cur_combo . currentIndex ( ) ] )
if cur_request != self . config . get ( ' currency ' , " None " ) :
self . config . set_key ( ' currency ' , cur_request , True )
self . update_wallet ( )
if need_restart :
QMessageBox . warning ( self , _ ( ' Success ' ) , _ ( ' Please restart Electrum to activate the new GUI settings ' ) , _ ( ' OK ' ) )