Remove superfluous private PythonBridge stuff
This commit is contained in:
parent
71640b5c5a
commit
8c8a58fb07
|
@ -3,27 +3,23 @@
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import io.thp.pyotherside 1.5
|
import io.thp.pyotherside 1.5
|
||||||
import CppUtils 0.1
|
import CppUtils 0.1
|
||||||
import "Privates"
|
import "."
|
||||||
|
|
||||||
Python {
|
Python {
|
||||||
id: py
|
id: py
|
||||||
|
|
||||||
|
|
||||||
readonly property QtObject privates: QtObject {
|
function makeFuture(callback) {
|
||||||
function makeFuture(callback) {
|
return Qt.createComponent("Future.qml").createObject(py, {bridge: py})
|
||||||
return Qt.createComponent("Future.qml")
|
|
||||||
.createObject(py, { bridge: py })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function setattr(obj, attr, value, callback=null) {
|
function setattr(obj, attr, value, callback=null) {
|
||||||
py.call(py.getattr(obj, "__setattr__"), [attr, value], callback)
|
py.call(py.getattr(obj, "__setattr__"), [attr, value], callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
function callCoro(name, args=[], onSuccess=null, onError=null) {
|
function callCoro(name, args=[], onSuccess=null, onError=null) {
|
||||||
const uuid = name + "." + CppUtils.uuid()
|
const uuid = name + "." + CppUtils.uuid()
|
||||||
const future = privates.makeFuture()
|
const future = makeFuture()
|
||||||
|
|
||||||
Globals.pendingCoroutines[uuid] = {future, onSuccess, onError}
|
Globals.pendingCoroutines[uuid] = {future, onSuccess, onError}
|
||||||
Globals.pendingCoroutinesChanged()
|
Globals.pendingCoroutinesChanged()
|
||||||
|
@ -38,7 +34,7 @@ Python {
|
||||||
function callClientCoro(
|
function callClientCoro(
|
||||||
accountId, name, args=[], onSuccess=null, onError=null
|
accountId, name, args=[], onSuccess=null, onError=null
|
||||||
) {
|
) {
|
||||||
const future = privates.makeFuture()
|
const future = makeFuture()
|
||||||
|
|
||||||
callCoro("get_client", [accountId], () => {
|
callCoro("get_client", [accountId], () => {
|
||||||
const uuid = accountId + "." + name + "." + CppUtils.uuid()
|
const uuid = accountId + "." + name + "." + CppUtils.uuid()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import "Privates"
|
import "."
|
||||||
|
|
||||||
PythonBridge {
|
PythonBridge {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user