This commit is contained in:
ThomasV 2017-10-18 16:11:30 +02:00
parent 68ca0b73b1
commit ddc989c672
1 changed files with 5 additions and 6 deletions

View File

@ -40,15 +40,14 @@ from electrum.plugins import hook
from .trustedcoin import TrustedCoinPlugin, server from .trustedcoin import TrustedCoinPlugin, server
class QTOSSignalObject(QObject): class TOS(QTextEdit):
two_factor_tos_signal = pyqtSignal() tos_signal = pyqtSignal()
class Plugin(TrustedCoinPlugin): class Plugin(TrustedCoinPlugin):
def __init__(self, parent, config, name): def __init__(self, parent, config, name):
super().__init__(parent, config, name) super().__init__(parent, config, name)
self.tos_signal_obj = QTOSSignalObject()
@hook @hook
def on_new_window(self, window): def on_new_window(self, window):
@ -189,7 +188,7 @@ class Plugin(TrustedCoinPlugin):
vbox = QVBoxLayout() vbox = QVBoxLayout()
vbox.addWidget(QLabel(_("Terms of Service"))) vbox.addWidget(QLabel(_("Terms of Service")))
tos_e = QTextEdit() tos_e = TOS()
tos_e.setReadOnly(True) tos_e.setReadOnly(True)
vbox.addWidget(tos_e) vbox.addWidget(tos_e)
@ -204,7 +203,7 @@ class Plugin(TrustedCoinPlugin):
def request_TOS(): def request_TOS():
tos = server.get_terms_of_service() tos = server.get_terms_of_service()
self.TOS = tos self.TOS = tos
self.tos_signal_obj.two_factor_tos_signal.emit() tos_e.tos_signal.emit()
def on_result(): def on_result():
tos_e.setText(self.TOS) tos_e.setText(self.TOS)
@ -212,7 +211,7 @@ class Plugin(TrustedCoinPlugin):
def set_enabled(): def set_enabled():
next_button.setEnabled(re.match(regexp,email_e.text()) is not None) next_button.setEnabled(re.match(regexp,email_e.text()) is not None)
self.tos_signal_obj.two_factor_tos_signal.connect(on_result) tos_e.tos_signal.connect(on_result)
t = Thread(target=request_TOS) t = Thread(target=request_TOS)
t.setDaemon(True) t.setDaemon(True)
t.start() t.start()