electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 017afd95dc1e8eb721e421a49c970e54053a2ff2
parent cb9a636616f516551c00d8681290a73be6c4c980
Author: ThomasV <thomasv@electrum.org>
Date:   Tue,  7 Jun 2016 11:38:23 +0200

Qt: disable max button if amount is locked

Diffstat:
Mgui/qt/main_window.py | 8++++++--
Mgui/qt/paytoedit.py | 21+++------------------
2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -894,9 +894,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): grid.addWidget(amount_label, 4, 0) grid.addWidget(self.amount_e, 4, 1) - max_button = EnterButton(_("Max"), self.spend_max) + self.max_button = EnterButton(_("Max"), self.spend_max) hbox = QHBoxLayout() - hbox.addWidget(max_button) + hbox.addWidget(self.max_button) hbox.addStretch(1) grid.addLayout(hbox, 4, 3) @@ -1303,6 +1303,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): dialog.exec_() return clayout.selected_index() + def lock_amount(self, b): + self.amount_e.setFrozen(b) + self.max_button.setEnabled(not b) + def prepare_for_payment_request(self): self.tabs.setCurrentIndex(1) self.payto_e.is_pr = True diff --git a/gui/qt/paytoedit.py b/gui/qt/paytoedit.py @@ -60,12 +60,6 @@ class PayToEdit(ScanQRTextEdit): self.previous_payto = '' - def lock_amount(self): - self.amount_edit.setFrozen(True) - - def unlock_amount(self): - self.amount_edit.setFrozen(False) - def setFrozen(self, b): self.setReadOnly(b) self.setStyleSheet(frozen_style if b else normal_style) @@ -133,7 +127,7 @@ class PayToEdit(ScanQRTextEdit): except: pass if self.payto_address: - self.unlock_amount() + self.win.lock_amount(False) return for i, line in enumerate(lines): @@ -148,17 +142,8 @@ class PayToEdit(ScanQRTextEdit): self.outputs = outputs self.payto_address = None - - if outputs: - self.amount_edit.setAmount(total) - else: - self.amount_edit.setText("") - - if total or len(lines)>1: - self.lock_amount() - else: - self.unlock_amount() - + self.amount_edit.setAmount(total if outputs else None) + self.win.lock_amount(total or len(lines)>1) def get_errors(self): return self.errors