add is_final checkbox to bump_fee dialogs

This commit is contained in:
ThomasV 2016-06-10 06:32:07 +02:00
parent b8cd7eb8bd
commit 6bc73f4d74
3 changed files with 21 additions and 4 deletions

View File

@ -14,6 +14,7 @@ Builder.load_string('''
pos_hint: {'top':0.9}
BoxLayout:
orientation: 'vertical'
padding: '10dp'
GridLayout:
height: self.minimum_height
@ -22,7 +23,7 @@ Builder.load_string('''
spacing: '10dp'
BoxLabel:
id: old_fee
text: _('Fee')
text: _('Current Fee')
value: ''
BoxLabel:
id: new_fee
@ -31,11 +32,19 @@ Builder.load_string('''
Label:
id: tooltip
text: ''
size_hint_y: None
Slider:
id: slider
range: 0, 4
step: 1
on_value: root.on_slider(self.value)
BoxLayout:
orientation: 'horizontal'
size_hint: 1, 0.2
Label:
text: _('Final')
CheckBox:
id: final_cb
Widget:
size_hint: 1, 1
BoxLayout:
@ -98,7 +107,8 @@ class BumpFeeDialog(Factory.Popup):
def on_ok(self):
new_fee = self.get_fee()
self.callback(self.init_fee, new_fee)
is_final = self.ids.final_cb.active
self.callback(self.init_fee, new_fee, is_final)
def on_slider(self, value):
self.update_text()

View File

@ -135,7 +135,7 @@ class TxDialog(Factory.Popup):
d = BumpFeeDialog(self.app, fee, size, self._do_rbf)
d.open()
def _do_rbf(self, old_fee, new_fee):
def _do_rbf(self, old_fee, new_fee, is_final):
if new_fee is None:
return
delta = new_fee - old_fee
@ -147,6 +147,8 @@ class TxDialog(Factory.Popup):
except BaseException as e:
self.app.show_error(e)
return
if is_final:
new_tx.set_sequence(0xffffffff)
self.tx = new_tx
self.update()
self.do_sign()

View File

@ -2695,7 +2695,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
text.setReadOnly(True)
text.setMaximumHeight(170)
vbox.addWidget(text)
mpk_text = '\n'.join( account.get_master_pubkeys() )
mpk_text = '\n'.join(account.get_master_pubkeys())
text.setText(mpk_text)
vbox.addLayout(Buttons(CloseButton(d)))
d.exec_()
@ -2709,9 +2709,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
e = BTCAmountEdit(self.get_decimal_point)
e.setAmount(fee *1.5)
vbox.addWidget(e)
cb = QCheckBox(_('Final'))
vbox.addWidget(cb)
vbox.addLayout(Buttons(CancelButton(d), OkButton(d)))
if not d.exec_():
return
is_final = cb.isChecked()
new_fee = e.get_amount()
delta = new_fee - fee
if delta < 0:
@ -2722,4 +2725,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
except BaseException as e:
self.show_error(e)
return
if is_final:
new_tx.set_sequence(0xffffffff)
self.show_transaction(new_tx)