From ef3ae450f316923c2cafb67a8bb989d8142dadc9 Mon Sep 17 00:00:00 2001 From: ecdsa Date: Sun, 7 Apr 2013 22:08:56 +0200 Subject: [PATCH] handle shortcut explicitly --- gui/amountedit.py | 3 +++ gui/gui_classic.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gui/amountedit.py b/gui/amountedit.py index 91c471b16..737502734 100644 --- a/gui/amountedit.py +++ b/gui/amountedit.py @@ -11,6 +11,7 @@ class AmountEdit(QLineEdit): self.text_getter = text_getter self.textChanged.connect(self.numbify) self.is_int = is_int + self.is_shortcut = False def paintEvent(self, event): @@ -27,6 +28,8 @@ class AmountEdit(QLineEdit): def numbify(self): text = unicode(self.text()).strip() + if text == '!': + self.is_shortcut = True pos = self.cursorPosition() chars = '0123456789' if not self.is_int: chars +='.' diff --git a/gui/gui_classic.py b/gui/gui_classic.py index 5fed14b0d..8fe9c11b5 100644 --- a/gui/gui_classic.py +++ b/gui/gui_classic.py @@ -408,7 +408,7 @@ class ElectrumWindow(QMainWindow): return format_satoshis(x, is_diff, self.wallet.num_zeros, self.decimal_point) def read_amount(self, x): - if x == '': return None + if x in['.', '']: return None p = pow(10, self.decimal_point) return int( p * Decimal(x) ) @@ -717,7 +717,8 @@ class ElectrumWindow(QMainWindow): def entry_changed( is_fee ): self.funds_error = False - if self.amount_e.text() == '.': + if self.amount_e.is_shortcut: + self.amount_e.is_shortcut = False c, u = self.wallet.get_account_balance(self.current_account) inputs, total, fee = self.wallet.choose_tx_inputs( c + u, 0, self.current_account) fee = self.wallet.estimated_fee(inputs)