Browse Source

Add RBF option to the kivy GUI

283
ThomasV 9 years ago
parent
commit
b8cd7eb8bd
  1. 25
      gui/kivy/uix/dialogs/settings.py
  2. 2
      gui/kivy/uix/screens.py

25
gui/kivy/uix/dialogs/settings.py

@ -102,6 +102,12 @@ Builder.load_string('''
description: _("Save and synchronize your labels.") description: _("Save and synchronize your labels.")
action: partial(root.plugin_dialog, 'labels', self) action: partial(root.plugin_dialog, 'labels', self)
CardSeparator CardSeparator
SettingsItem:
status: root.rbf_status()
title: _('Replace-by-fee') + ': ' + self.status
description: _("Create replaceable transactions.")
action: partial(root.rbf_dialog, self)
CardSeparator
SettingsItem: SettingsItem:
status: root.coinselect_status() status: root.coinselect_status()
title: _('Coin selection') + ': ' + self.status title: _('Coin selection') + ': ' + self.status
@ -123,6 +129,7 @@ class SettingsDialog(Factory.Popup):
# cached dialogs # cached dialogs
self._fx_dialog = None self._fx_dialog = None
self._fee_dialog = None self._fee_dialog = None
self._rbf_dialog = None
self._network_dialog = None self._network_dialog = None
self._language_dialog = None self._language_dialog = None
self._unit_dialog = None self._unit_dialog = None
@ -203,7 +210,7 @@ class SettingsDialog(Factory.Popup):
d.open() d.open()
def fee_status(self): def fee_status(self):
if self.config.get('dynamic_fees'): if self.config.get('dynamic_fees', True):
from electrum.util import fee_levels from electrum.util import fee_levels
return fee_levels[self.config.get('fee_level', 2)] return fee_levels[self.config.get('fee_level', 2)]
else: else:
@ -218,6 +225,22 @@ class SettingsDialog(Factory.Popup):
self._fee_dialog = FeeDialog(self.app, self.config, cb) self._fee_dialog = FeeDialog(self.app, self.config, cb)
self._fee_dialog.open() self._fee_dialog.open()
def rbf_status(self):
return 'ON' if self.config.get('use_rbf') else 'OFF'
def rbf_dialog(self, label, dt):
if self._rbf_dialog is None:
from checkbox_dialog import CheckBoxDialog
def cb(x):
self.config.set_key('use_rbf', x, True)
label.status = self.rbf_status()
msg = [_('If you check this box, your transactions will be marked as non-final,'),
_('and you will have the possiblity, while they are unconfirmed, to replace them with transactions that pays higher fees.'),
_('Note that some merchants do not accept non-final transactions until they are confirmed.')]
fullname = _('Replace by fee')
self._rbf_dialog = CheckBoxDialog(fullname, ' '.join(msg), self.config.get('use_rbf'), cb)
self._rbf_dialog.open()
def fx_status(self): def fx_status(self):
p = self.plugins.get('exchange_rate') p = self.plugins.get('exchange_rate')
if p: if p:

2
gui/kivy/uix/screens.py

@ -276,6 +276,8 @@ class SendScreen(CScreen):
traceback.print_exc(file=sys.stdout) traceback.print_exc(file=sys.stdout)
self.app.show_error(str(e)) self.app.show_error(str(e))
return return
if self.app.electrum_config.get('use_rbf'):
tx.set_sequence(0)
fee = tx.get_fee() fee = tx.get_fee()
msg = [ msg = [
_("Amount to be sent") + ": " + self.app.format_amount_and_units(amount), _("Amount to be sent") + ": " + self.app.format_amount_and_units(amount),

Loading…
Cancel
Save