@ -40,6 +40,7 @@ from electrum import Transaction
from electrum import mnemonic
from electrum import util , bitcoin , commands , Interface , Wallet
from electrum import SimpleConfig , Wallet , WalletStorage
from electrum import Imported_Wallet
from amountedit import AmountEdit , BTCAmountEdit , MyLineEdit
from network_dialog import NetworkDialog
@ -681,7 +682,7 @@ class ElectrumWindow(QMainWindow):
self . save_request_button . clicked . connect ( self . save_payment_request )
grid . addWidget ( self . save_request_button , 3 , 1 )
clear_button = QPushButton ( _ ( ' New ' ) )
clear_button . clicked . connect ( self . clear_receive_tab )
clear_button . clicked . connect ( self . new_receive_address )
grid . addWidget ( clear_button , 3 , 2 )
grid . setRowStretch ( 4 , 1 )
@ -739,6 +740,22 @@ class ElectrumWindow(QMainWindow):
self . wallet . storage . put ( ' receive_requests ' , self . receive_requests )
self . update_receive_tab ( )
def new_receive_address ( self ) :
domain = self . wallet . get_account_addresses ( self . current_account , include_change = False )
for addr in domain :
if not self . wallet . address_is_old ( addr ) and addr not in self . receive_requests . keys ( ) :
break
else :
if isinstance ( self . wallet , Imported_Wallet ) :
self . show_message ( _ ( ' No more addresses in your wallet. ' ) )
return
if not self . question ( _ ( " Warning: The next address will not be recovered automatically if you restore your wallet from seed; you may need to add it manually. \n \n This occurs because you have too many unused addresses in your wallet. To avoid this situation, use the existing addresses first. \n \n Create anyway? " ) ) :
return
addr = self . wallet . create_new_address ( self . current_account , False )
self . receive_address_e . setText ( addr )
self . receive_message_e . setText ( ' ' )
self . receive_amount_e . setAmount ( None )
def clear_receive_tab ( self ) :
self . receive_requests = self . wallet . storage . get ( ' receive_requests ' , { } )
domain = self . wallet . get_account_addresses ( self . current_account , include_change = False )
@ -746,7 +763,7 @@ class ElectrumWindow(QMainWindow):
if not self . wallet . address_is_old ( addr ) and addr not in self . receive_requests . keys ( ) :
break
else :
addr = " "
addr = ' '
self . receive_address_e . setText ( addr )
self . receive_message_e . setText ( ' ' )
self . receive_amount_e . setAmount ( None )