1
0

qml: update userinfo

This commit is contained in:
Sander van Grieken
2023-04-14 13:45:21 +02:00
parent 79d5711003
commit f77ff2723c

View File

@@ -338,9 +338,11 @@ class QESwapHelper(AuthMixin, QObject, QtEventListener):
def swap_task(): def swap_task():
try: try:
fut = asyncio.run_coroutine_threadsafe(coro, loop) fut = asyncio.run_coroutine_threadsafe(coro, loop)
self.userinfo = _('Performing swap...')
self.swapStarted.emit() self.swapStarted.emit()
txid = fut.result() txid = fut.result()
try: # swaphelper might be destroyed at this point try: # swaphelper might be destroyed at this point
self.userinfo = _('Swap successful!')
self.swapSuccess.emit() self.swapSuccess.emit()
except RuntimeError: except RuntimeError:
pass pass
@@ -366,17 +368,21 @@ class QESwapHelper(AuthMixin, QObject, QtEventListener):
def swap_task(): def swap_task():
try: try:
fut = asyncio.run_coroutine_threadsafe(coro, loop) fut = asyncio.run_coroutine_threadsafe(coro, loop)
self.userinfo = _('Performing swap...')
self.swapStarted.emit() self.swapStarted.emit()
success = fut.result() success = fut.result()
try: # swaphelper might be destroyed at this point try: # swaphelper might be destroyed at this point
if success: if success:
self.userinfo = _('Swap successful!')
self.swapSuccess.emit() self.swapSuccess.emit()
else: else:
self.userinfo = _('Swap failed!')
self.swapFailed.emit('') self.swapFailed.emit('')
except RuntimeError: except RuntimeError:
pass pass
except Exception as e: except Exception as e:
try: # swaphelper might be destroyed at this point try: # swaphelper might be destroyed at this point
self.userinfo = _('Swap failed!')
self._logger.error(str(e)) self._logger.error(str(e))
self.swapFailed.emit(str(e)) self.swapFailed.emit(str(e))
except RuntimeError: except RuntimeError: