qml: swap: don't show long swap success message in info box, show in popup instead
and close swap dialog after accept.
This commit is contained in:
@@ -315,6 +315,20 @@ ElDialog {
|
|||||||
function onSliderPosChanged() {
|
function onSliderPosChanged() {
|
||||||
swapslider.value = swaphelper.sliderPos
|
swapslider.value = swaphelper.sliderPos
|
||||||
}
|
}
|
||||||
|
function onStateChanged() {
|
||||||
|
if (swaphelper.state == SwapHelper.Success) {
|
||||||
|
var dialog = app.messageDialog.createObject(app, {
|
||||||
|
title: qsTr('Success!'),
|
||||||
|
text: Config.getTranslatedMessage(swaphelper.isReverse
|
||||||
|
? 'MSG_REVERSE_SWAP_FUNDING_MEMPOOL'
|
||||||
|
: 'MSG_FORWARD_SWAP_FUNDING_MEMPOOL')
|
||||||
|
})
|
||||||
|
dialog.accepted.connect(function() {
|
||||||
|
Qt.callLater(root.close)
|
||||||
|
})
|
||||||
|
dialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ from electrum.bitcoin import TOTAL_COIN_SUPPLY_LIMIT_IN_BTC
|
|||||||
from electrum.i18n import set_language, languages
|
from electrum.i18n import set_language, languages
|
||||||
from electrum.logging import get_logger
|
from electrum.logging import get_logger
|
||||||
from electrum.util import base_unit_name_to_decimal_point
|
from electrum.util import base_unit_name_to_decimal_point
|
||||||
|
from electrum.gui import messages
|
||||||
|
|
||||||
from .qetypes import QEAmount
|
from .qetypes import QEAmount
|
||||||
from .auth import AuthMixin, auth_protect
|
from .auth import AuthMixin, auth_protect
|
||||||
@@ -33,6 +34,10 @@ class QEConfig(AuthMixin, QObject):
|
|||||||
cv = getattr(self.config.cv, key)
|
cv = getattr(self.config.cv, key)
|
||||||
return cv.get_long_desc() if cv else ''
|
return cv.get_long_desc() if cv else ''
|
||||||
|
|
||||||
|
@pyqtSlot(str, result=str)
|
||||||
|
def getTranslatedMessage(self, key) -> str:
|
||||||
|
return getattr(messages, key)
|
||||||
|
|
||||||
languageChanged = pyqtSignal()
|
languageChanged = pyqtSignal()
|
||||||
@pyqtProperty(str, notify=languageChanged)
|
@pyqtProperty(str, notify=languageChanged)
|
||||||
def language(self):
|
def language(self):
|
||||||
|
|||||||
@@ -560,10 +560,7 @@ class QESwapHelper(AuthMixin, QObject, QtEventListener):
|
|||||||
txid = fut.result()
|
txid = fut.result()
|
||||||
try: # swaphelper might be destroyed at this point
|
try: # swaphelper might be destroyed at this point
|
||||||
if txid:
|
if txid:
|
||||||
self.userinfo = ' '.join([
|
self.userinfo = _('Success!')
|
||||||
_('Success!'),
|
|
||||||
messages.MSG_FORWARD_SWAP_FUNDING_MEMPOOL,
|
|
||||||
])
|
|
||||||
self.state = QESwapHelper.State.Success
|
self.state = QESwapHelper.State.Success
|
||||||
else:
|
else:
|
||||||
self.userinfo = _('Swap failed!')
|
self.userinfo = _('Swap failed!')
|
||||||
@@ -640,10 +637,7 @@ class QESwapHelper(AuthMixin, QObject, QtEventListener):
|
|||||||
txid = fut.result()
|
txid = fut.result()
|
||||||
try: # swaphelper might be destroyed at this point
|
try: # swaphelper might be destroyed at this point
|
||||||
if txid:
|
if txid:
|
||||||
self.userinfo = ' '.join([
|
self.userinfo = _('Success!')
|
||||||
_('Success!'),
|
|
||||||
messages.MSG_REVERSE_SWAP_FUNDING_MEMPOOL,
|
|
||||||
])
|
|
||||||
self.state = QESwapHelper.State.Success
|
self.state = QESwapHelper.State.Success
|
||||||
else:
|
else:
|
||||||
self.userinfo = _('Swap failed!')
|
self.userinfo = _('Swap failed!')
|
||||||
|
|||||||
Reference in New Issue
Block a user