commit 7b40b63a3d185cec1f2f6e59eebb31ad01ec6ff1
parent 386319b0158439cb4afa5288b443705b3089e6c0
Author: Neil Booth <kyuupichan@gmail.com>
Date: Mon, 9 Nov 2015 20:06:36 +0900
Refresh all amount edits when units change.
Improved version of prior commit.
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/gui/qt/amountedit.py b/gui/qt/amountedit.py
@@ -95,7 +95,7 @@ class BTCAmountEdit(AmountEdit):
def setAmount(self, amount):
if amount is None:
- self.setText("")
+ self.setText(" ") # Space forces repaint in case units changed
else:
self.setText(format_satoshis_plain(amount, self.decimal_point()))
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -2686,6 +2686,8 @@ class ElectrumWindow(QMainWindow, PrintError):
unit_result = units[unit_combo.currentIndex()]
if self.base_unit() == unit_result:
return
+ edits = self.amount_e, self.fee_e, self.receive_amount_e, fee_e
+ amounts = [edit.get_amount() for edit in edits]
if unit_result == 'BTC':
self.decimal_point = 8
elif unit_result == 'mBTC':
@@ -2698,8 +2700,8 @@ class ElectrumWindow(QMainWindow, PrintError):
self.history_list.update()
self.receive_list.update()
self.address_list.update()
- self.do_clear()
- fee_e.setAmount(self.wallet.fee_per_kb(self.config))
+ for edit, amount in zip(edits, amounts):
+ edit.setAmount(amount)
self.update_status()
unit_combo.currentIndexChanged.connect(on_unit)
gui_widgets.append((unit_label, unit_combo))