electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 48d42bbafae88faf77e75efa804612c29e3df7ba
parent 5a2ec733673eb05b21d547ac19525705041f674d
Author: ThomasV <thomasv@electrum.org>
Date:   Fri, 29 Jul 2016 15:47:13 +0200

kivy: ask RBF before send

Diffstat:
Mgui/kivy/main_window.py | 9++++-----
Mgui/kivy/uix/dialogs/question.py | 4+++-
Mgui/kivy/uix/screens.py | 24+++++++++++++++++-------
3 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py @@ -54,8 +54,6 @@ Cache.register('electrum_widgets', timeout=0) from kivy.uix.screenmanager import Screen from kivy.uix.tabbedpanel import TabbedPanel from kivy.uix.label import Label -from kivy.uix.checkbox import CheckBox -from kivy.uix.switch import Switch from kivy.core.clipboard import Clipboard Factory.register('TabbedCarousel', module='electrum_gui.kivy.uix.screens') @@ -762,9 +760,10 @@ class ElectrumWindow(App): d = Question(_('Delete wallet?') + '\n' + basename, self._delete_wallet) d.open() - def _delete_wallet(self): - basename = os.path.basename(self.wallet.storage.path) - self.protected(_("Enter your PIN code to confirm deletion of %s") % basename, self.__delete_wallet, ()) + def _delete_wallet(self, b): + if b: + basename = os.path.basename(self.wallet.storage.path) + self.protected(_("Enter your PIN code to confirm deletion of %s") % basename, self.__delete_wallet, ()) def __delete_wallet(self, pw): wallet_path = self.get_wallet_path() diff --git a/gui/kivy/uix/dialogs/question.py b/gui/kivy/uix/dialogs/question.py @@ -20,6 +20,7 @@ Builder.load_string(''' Label: id: label text: root.message + text_size: self.width, None Widget: size_hint: 1, 0.1 BoxLayout: @@ -30,13 +31,14 @@ Builder.load_string(''' size_hint: 0.5, None height: '48dp' on_release: + root.callback(False) popup.dismiss() Button: text: _('Yes') size_hint: 0.5, None height: '48dp' on_release: - root.callback() + root.callback(True) popup.dismiss() ''') diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py @@ -264,6 +264,14 @@ class SendScreen(CScreen): outputs = [(bitcoin.TYPE_ADDRESS, address, amount)] message = unicode(self.screen.message) amount = sum(map(lambda x:x[2], outputs)) + if self.app.electrum_config.get('use_rbf'): + from dialogs.question import Question + d = Question(_('Should this transaction be replaceable?'), lambda b: self._do_send(amount, message, outputs, b)) + d.open() + else: + self._do_send(amount, message, outputs, False) + + def _do_send(self, amount, message, outputs, rbf): # make unsigned transaction coins = self.app.wallet.get_spendable_coins() config = self.app.electrum_config @@ -276,7 +284,7 @@ class SendScreen(CScreen): traceback.print_exc(file=sys.stdout) self.app.show_error(str(e)) return - if self.app.electrum_config.get('use_rbf'): + if rbf: tx.set_sequence(0) fee = tx.get_fee() msg = [ @@ -458,9 +466,10 @@ class InvoicesScreen(CScreen): def do_delete(self, obj): from dialogs.question import Question - def cb(): - self.app.invoices.remove(obj.key) - self.app.update_tab('invoices') + def cb(result): + if result: + self.app.invoices.remove(obj.key) + self.app.update_tab('invoices') d = Question(_('Delete invoice?'), cb) d.open() @@ -527,9 +536,10 @@ class RequestsScreen(CScreen): def do_delete(self, obj): from dialogs.question import Question - def cb(): - self.app.wallet.remove_payment_request(obj.address, self.app.electrum_config) - self.update() + def cb(result): + if result: + self.app.wallet.remove_payment_request(obj.address, self.app.electrum_config) + self.update() d = Question(_('Delete request?'), cb) d.open()