Don't pass Python Future objects to QML

Returning a Future doesn't work on Windows for some reason
(https://github.com/thp/pyotherside/issues/116).

Instead of using these objects from QML to cancel running coroutines,
call a Python QMLBridge function that takes a coroutine UUID and will
take care of the cancelling.
This commit is contained in:
miruka
2020-09-28 23:06:50 -04:00
parent 53d2ab17af
commit ee1091b4dc
20 changed files with 161 additions and 178 deletions

View File

@@ -14,23 +14,23 @@ SignInBase {
function startSignIn() {
errorMessage.text = ""
page.loginFuture = py.callCoro("start_sso_auth", [serverUrl], url => {
page.loginFutureId = py.callCoro("start_sso_auth",[serverUrl], url => {
urlArea.text = url
urlArea.cursorPosition = 0
Qt.openUrlExternally(url)
page.loginFuture = py.callCoro("continue_sso_auth", [], userId => {
page.loginFuture = null
page.loginFutureId = py.callCoro("continue_sso_auth",[],userId => {
page.loginFutureId = ""
page.finishSignIn(userId)
})
})
}
function cancel() {
if (loginFuture) {
page.loginFuture.cancel()
page.loginFuture = null
if (loginFutureId) {
py.cancelCoro(page.loginFutureId)
page.loginFutureId = ""
}
page.exitRequested()