Drop kwargs support for callCoro/callClientCoro

This commit is contained in:
miruka 2019-07-07 23:38:37 -04:00
parent 4f0ba24373
commit 8dccfffc8b
6 changed files with 22 additions and 25 deletions

View File

@ -44,12 +44,11 @@ class App:
def call_backend_coro(self,
name: str,
uuid: str,
args: Optional[List[str]] = None,
kwargs: Optional[Dict[str, Any]] = None) -> None:
name: str,
uuid: str,
args: Optional[List[str]] = None) -> None:
self._call_coro(
getattr(self.backend, name)(*args or [], **kwargs or {}), uuid
getattr(self.backend, name)(*args or []), uuid
)
@ -57,11 +56,10 @@ class App:
account_id: str,
name: str,
uuid: str,
args: Optional[List[str]] = None,
kwargs: Optional[Dict[str, Any]] = None) -> None:
args: Optional[List[str]] = None) -> None:
client = self.backend.clients[account_id]
self._call_coro(
getattr(client, name)(*args or [], **kwargs or {}), uuid
getattr(client, name)(*args or []), uuid
)

View File

@ -35,17 +35,17 @@ Banner {
"accept": function(button) {
button.loading = true
py.callClientCoro(
chatPage.userId, "join", [chatPage.roomId], {},
function() { button.loading = false }
)
chatPage.userId, "join", [chatPage.roomId], function() {
button.loading = false
})
},
"decline": function(button) {
button.loading = true
py.callClientCoro(
chatPage.userId, "room_leave", [chatPage.roomId], {},
function() { button.loading = false }
)
chatPage.userId, "room_leave", [chatPage.roomId], function() {
button.loading = false
})
}
}
}

View File

@ -24,9 +24,9 @@ Banner {
"forget": function(button) {
button.loading = true
py.callClientCoro(
chatPage.userId, "room_forget", [chatPage.roomId], {},
function() { button.loading = false }
)
chatPage.userId, "room_forget", [chatPage.roomId], function() {
button.loading = false
})
}
}
}

View File

@ -50,7 +50,6 @@ HRectangle {
chatPage.userId,
"load_past_events",
[chatPage.roomId],
{},
function(more_to_load) { canLoad = more_to_load }
)
}

View File

@ -26,7 +26,7 @@ Item {
button.loading = true
var args = [idField.text, passwordField.text]
py.callCoro("login_client", args, {}, function(user_id) {
py.callCoro("login_client", args, function(user_id) {
pageStack.showPage(
"RememberAccount",
{"loginWith": loginWith, "userId": user_id}

View File

@ -16,18 +16,18 @@ Python {
return call_sync("APP.backend." + name, args)
}
function callCoro(name, args, kwargs, callback) {
function callCoro(name, args, callback) {
var uuid = Math.random() + "." + name
pendingCoroutines[uuid] = callback || function() {}
call("APP.call_backend_coro", [name, uuid, args, kwargs])
call("APP.call_backend_coro", [name, uuid, args])
}
function callClientCoro(account_id, name, args, kwargs, callback) {
function callClientCoro(account_id, name, args, callback) {
var uuid = Math.random() + "." + name
pendingCoroutines[uuid] = callback || function() {}
call("APP.call_client_coro", [account_id, name, uuid, args, kwargs])
call("APP.call_client_coro", [account_id, name, uuid, args])
}
Component.onCompleted: {
@ -43,13 +43,13 @@ Python {
call("APP.is_debug_on", [Qt.application.arguments], function(on) {
window.debug = on
callCoro("has_saved_accounts", [], {}, function(has) {
callCoro("has_saved_accounts", [], function(has) {
py.ready = true
willLoadAccounts(has)
if (has) {
py.loadingAccounts = true
py.callCoro("load_saved_accounts", [], {}, function() {
py.callCoro("load_saved_accounts", [], function() {
py.loadingAccounts = false
})
}