kivy: don't load kv from sign_transaction thread
This commit is contained in:
@@ -3,7 +3,6 @@ from decimal import Decimal
|
||||
import re
|
||||
import datetime
|
||||
import traceback, sys
|
||||
import threading
|
||||
|
||||
from kivy.app import App
|
||||
from kivy.cache import Cache
|
||||
@@ -285,23 +284,19 @@ class SendScreen(CScreen):
|
||||
msg.append(_("Enter your PIN code to proceed"))
|
||||
self.app.protected('\n'.join(msg), self.send_tx, (tx,))
|
||||
|
||||
def send_tx(self, *args):
|
||||
threading.Thread(target=self.send_tx_thread, args=args).start()
|
||||
|
||||
def send_tx_thread(self, tx, password):
|
||||
# sign transaction
|
||||
def send_tx(self, tx, password):
|
||||
def on_success(tx):
|
||||
if tx.is_complete():
|
||||
self.app.broadcast(tx)
|
||||
else:
|
||||
self.app.tx_dialog(tx)
|
||||
def on_failure(error):
|
||||
self.app.show_error(error)
|
||||
if self.app.wallet.can_sign(tx):
|
||||
self.app.show_info("Signing...")
|
||||
try:
|
||||
self.app.wallet.sign_transaction(tx, password)
|
||||
except InvalidPassword:
|
||||
self.app.show_error(_("Invalid PIN"))
|
||||
return
|
||||
if not tx.is_complete():
|
||||
self.app.sign_tx(tx, password, on_success, on_failure)
|
||||
else:
|
||||
self.app.tx_dialog(tx)
|
||||
return
|
||||
# broadcast
|
||||
self.app.broadcast(tx)
|
||||
|
||||
|
||||
class ReceiveScreen(CScreen):
|
||||
|
||||
Reference in New Issue
Block a user