kivy: set_paid for paid invoices
This commit is contained in:
@@ -4,6 +4,7 @@ import time
|
||||
import datetime
|
||||
import traceback
|
||||
from decimal import Decimal
|
||||
import threading
|
||||
|
||||
import electrum
|
||||
from electrum import WalletStorage, Wallet
|
||||
@@ -682,7 +683,6 @@ class ElectrumWindow(App):
|
||||
d.open()
|
||||
|
||||
def sign_tx(self, *args):
|
||||
import threading
|
||||
threading.Thread(target=self._sign_tx, args=args).start()
|
||||
|
||||
def _sign_tx(self, tx, password, on_success, on_failure):
|
||||
@@ -693,13 +693,23 @@ class ElectrumWindow(App):
|
||||
return
|
||||
Clock.schedule_once(lambda dt: on_success(tx))
|
||||
|
||||
def broadcast(self, tx):
|
||||
def _broadcast_thread(self, tx, on_complete):
|
||||
ok, txid = self.wallet.sendtx(tx)
|
||||
Clock.schedule_once(lambda dt: on_complete(ok, txid))
|
||||
|
||||
def broadcast(self, tx, pr=None):
|
||||
def on_complete(ok, txid):
|
||||
self.show_info(txid)
|
||||
if ok and pr:
|
||||
pr.set_paid(tx.hash())
|
||||
self.invoices.save()
|
||||
self.update_tab('invoices')
|
||||
|
||||
if self.network and self.network.is_connected():
|
||||
self.show_info(_('Sending'))
|
||||
ok, txid = self.wallet.sendtx(tx)
|
||||
self.show_info(txid)
|
||||
threading.Thread(target=self._broadcast_thread, args=(tx, on_complete)).start()
|
||||
else:
|
||||
self.show_info(_('Cannot broadcast transaction') + '\n' + _('Not connected'))
|
||||
self.show_info(_('Cannot broadcast transaction') + ':\n' + _('Not connected'))
|
||||
|
||||
def description_dialog(self, screen):
|
||||
from uix.dialogs.label_dialog import LabelDialog
|
||||
|
||||
Reference in New Issue
Block a user