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

View File

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

View File

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