1
0

add sat/byte fee info and fee_unit pref

This commit is contained in:
neocogent
2017-08-01 15:33:42 +07:00
committed by ThomasV
parent 24442de8df
commit 7a92750ea5
3 changed files with 21 additions and 2 deletions

View File

@@ -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'\