electrum

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

commit 7e28c96243ce4fbdde79468c3c4ef48b8d595c11
parent eb4018de1ceff2080e3d3aa929deac5a03bcf7c3
Author: ThomasV <thomasv@electrum.org>
Date:   Sun,  5 Mar 2017 22:18:17 +0100

set max fee rate in preferences. fixes #2112

Diffstat:
Mgui/qt/fee_slider.py | 2+-
Mgui/qt/main_window.py | 24++++++++++++++++++++----
2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/gui/qt/fee_slider.py b/gui/qt/fee_slider.py @@ -12,7 +12,6 @@ class FeeSlider(QSlider): def __init__(self, window, config, callback): QSlider.__init__(self, Qt.Horizontal) self.config = config - self.fee_step = self.config.max_fee_rate() / 10 self.window = window self.callback = callback self.dyn = False @@ -49,6 +48,7 @@ class FeeSlider(QSlider): self.setRange(0, 4) self.setValue(pos) else: + self.fee_step = self.config.max_fee_rate() / 10 fee_rate = self.config.fee_per_kb() pos = min(fee_rate / self.fee_step, 10) self.setRange(1, 10) diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -2371,14 +2371,30 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): nz.valueChanged.connect(on_nz) gui_widgets.append((nz_label, nz)) - dynfee_cb = QCheckBox(_('Use dynamic fees')) - dynfee_cb.setChecked(self.config.get('dynamic_fees', True)) - dynfee_cb.setToolTip(_("Use fees recommended by the server.")) def on_dynfee(x): self.config.set_key('dynamic_fees', x == Qt.Checked) self.fee_slider.update() - dynfee_cb.stateChanged.connect(on_dynfee) + update_maxfee() + dynfee_cb = QCheckBox(_('Use dynamic fees')) + dynfee_cb.setChecked(self.config.is_dynfee()) + dynfee_cb.setToolTip(_("Use fees recommended by the server.")) fee_widgets.append((dynfee_cb, None)) + dynfee_cb.stateChanged.connect(on_dynfee) + + def on_maxfee(x): + m = maxfee_e.get_amount() + if m: self.config.set_key('max_fee_rate', m) + self.fee_slider.update() + def update_maxfee(): + d = self.config.is_dynfee() + maxfee_e.setDisabled(d) + maxfee_label.setDisabled(d) + maxfee_label = HelpLabel(_('Max static fee'), _('Max value of the static fee slider')) + maxfee_e = BTCkBEdit(self.get_decimal_point) + maxfee_e.setAmount(self.config.max_fee_rate()) + maxfee_e.textChanged.connect(on_maxfee) + update_maxfee() + fee_widgets.append((maxfee_label, maxfee_e)) feebox_cb = QCheckBox(_('Edit fees manually')) feebox_cb.setChecked(self.config.get('show_fee', False))