commit 9c122c23eaaba712016a7d233ee0cdb35bb6f689
parent ca4473c6201390a99a72d473c8f368b2b507d501
Author: Amir Taaki <genjix@riseup.net>
Date: Wed, 29 Aug 2012 21:43:34 +0100
Fixed issue 19 by jimboman77: https://github.com/spesmilo/electrum/issues/19
"Right now the only check thats being done is making sure that the length isn't 0, ie something is being entered before the send button becomes clickable."
Also check that entered amount is <= btc_balance before enabling send button.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/gui_lite.py b/lib/gui_lite.py
@@ -332,10 +332,14 @@ class MiniWindow(QDialog):
def check_button_status(self):
"""Check that the bitcoin address is valid and that something
is entered in the amount before making the send button clickable."""
+ try:
+ value = D(str(self.amount_input.text())) * 10**8
+ except decimal.InvalidOperation:
+ value = None
# self.address_input.property(...) returns a qVariant, not a bool.
# The == is needed to properly invoke a comparison.
if (self.address_input.property("isValid") == True and
- len(self.amount_input.text()) > 0):
+ value is not None and 0 < value <= self.btc_balance):
self.send_button.setDisabled(False)
else:
self.send_button.setDisabled(True)