fix #3486
This commit is contained in:
parent
b88fa2046c
commit
d403c59ad7
|
@ -2348,6 +2348,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
|||
vbox.addWidget(keys_e)
|
||||
|
||||
addresses = self.wallet.get_unused_addresses()
|
||||
if not addresses:
|
||||
try:
|
||||
addresses = self.wallet.get_receiving_addresses()
|
||||
except AttributeError:
|
||||
addresses = self.wallet.get_addresses()
|
||||
h, address_e = address_field(addresses)
|
||||
vbox.addLayout(h)
|
||||
|
||||
|
|
|
@ -302,12 +302,20 @@ class ChoicesLayout(object):
|
|||
def address_field(addresses):
|
||||
hbox = QHBoxLayout()
|
||||
address_e = QLineEdit()
|
||||
if addresses:
|
||||
if addresses and len(addresses) > 0:
|
||||
address_e.setText(addresses[0])
|
||||
else:
|
||||
addresses = []
|
||||
def func():
|
||||
try:
|
||||
i = addresses.index(str(address_e.text())) + 1
|
||||
i = i % len(addresses)
|
||||
address_e.setText(addresses[i])
|
||||
except ValueError:
|
||||
# the user might have changed address_e to an
|
||||
# address not in the wallet (or to something that isn't an address)
|
||||
if addresses and len(addresses) > 0:
|
||||
address_e.setText(addresses[0])
|
||||
button = QPushButton(_('Address'))
|
||||
button.clicked.connect(func)
|
||||
hbox.addWidget(button)
|
||||
|
|
Loading…
Reference in New Issue