SomberNight 7 years ago
parent
commit
d403c59ad7
  1. 5
      gui/qt/main_window.py
  2. 16
      gui/qt/util.py

5
gui/qt/main_window.py

@ -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)

16
gui/qt/util.py

@ -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():
i = addresses.index(str(address_e.text())) + 1
i = i % len(addresses)
address_e.setText(addresses[i])
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…
Cancel
Save