commit 7a92750ea5c120e9f40bd9f26ac912f1404ab675
parent 24442de8dffd730d7fdeaedb043c36adf0c32975
Author: neocogent <info@neocogent.com>
Date: Tue, 1 Aug 2017 15:33:42 +0700
add sat/byte fee info and fee_unit pref
Diffstat:
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gui/qt/fee_slider.py b/gui/qt/fee_slider.py
@@ -36,7 +36,7 @@ class FeeSlider(QSlider):
def get_tooltip(self, pos, fee_rate):
from electrum.util import fee_levels
- rate_str = self.window.format_amount(fee_rate) + ' ' + self.window.base_unit() + '/kB'
+ rate_str = self.window.format_fee_rate(fee_rate)
if self.dyn:
tooltip = fee_levels[pos] + '\n' + rate_str
else:
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -129,6 +129,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.need_update = threading.Event()
self.decimal_point = config.get('decimal_point', 5)
+ self.fee_unit = config.get('fee_unit', 0)
self.num_zeros = int(config.get('num_zeros',0))
self.completions = QStringListModel()
@@ -622,6 +623,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
text += ' (%s)'%x
return text
+ def format_fee_rate(self, fee_rate):
+ if self.fee_unit == 0:
+ return format_satoshis(fee_rate/1000, False, self.num_zeros, 0, False) + ' sat/byte'
+ else:
+ return self.format_amount(fee_rate) + ' ' + self.base_unit() + '/kB'
+
def get_decimal_point(self):
return self.decimal_point
@@ -2464,6 +2471,18 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
rbf_combo.currentIndexChanged.connect(on_rbf)
fee_widgets.append((rbf_label, rbf_combo))
+ self.fee_unit = self.config.get('fee_unit', 0)
+ fee_unit_label = HelpLabel(_('Fee Unit') + ':', '')
+ fee_unit_combo = QComboBox()
+ fee_unit_combo.addItems([_('sat/byte'), _('mBTC/kB')])
+ fee_unit_combo.setCurrentIndex(self.fee_unit)
+ def on_fee_unit(x):
+ self.fee_unit = x
+ self.config.set_key('fee_unit', x)
+ self.fee_slider.update()
+ fee_unit_combo.currentIndexChanged.connect(on_fee_unit)
+ fee_widgets.append((fee_unit_label, fee_unit_combo))
+
msg = _('OpenAlias record, used to receive coins and to sign payment requests.') + '\n\n'\
+ _('The following alias providers are available:') + '\n'\
+ '\n'.join(['https://cryptoname.co/', 'http://xmr.link']) + '\n\n'\
diff --git a/gui/qt/transaction_dialog.py b/gui/qt/transaction_dialog.py
@@ -214,7 +214,7 @@ class TxDialog(QDialog, MessageBoxMixin):
size_str = _("Size:") + ' %d bytes'% size
fee_str = _("Fee") + ': %s'% (format_amount(fee) + ' ' + base_unit if fee is not None else _('unknown'))
if fee is not None:
- fee_str += ' ( %s )' % (format_amount(fee * 1000 / size) + ' ' + base_unit + '/kB')
+ fee_str += ' ( %s ) '% self.main_window.format_fee_rate(fee/size*1000)
self.amount_label.setText(amount_str)
self.fee_label.setText(fee_str)
self.size_label.setText(size_str)