diff --git a/src/python/app.py b/src/python/app.py index 9a636a32..1db25f6d 100644 --- a/src/python/app.py +++ b/src/python/app.py @@ -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 ) diff --git a/src/qml/Chat/Banners/InviteBanner.qml b/src/qml/Chat/Banners/InviteBanner.qml index dbb4d069..9ed219ea 100644 --- a/src/qml/Chat/Banners/InviteBanner.qml +++ b/src/qml/Chat/Banners/InviteBanner.qml @@ -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 + }) } } } diff --git a/src/qml/Chat/Banners/LeftBanner.qml b/src/qml/Chat/Banners/LeftBanner.qml index d0303e19..583e6cbf 100644 --- a/src/qml/Chat/Banners/LeftBanner.qml +++ b/src/qml/Chat/Banners/LeftBanner.qml @@ -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 + }) } } } diff --git a/src/qml/Chat/Timeline/EventList.qml b/src/qml/Chat/Timeline/EventList.qml index f54c0978..1c907289 100644 --- a/src/qml/Chat/Timeline/EventList.qml +++ b/src/qml/Chat/Timeline/EventList.qml @@ -50,7 +50,6 @@ HRectangle { chatPage.userId, "load_past_events", [chatPage.roomId], - {}, function(more_to_load) { canLoad = more_to_load } ) } diff --git a/src/qml/Pages/SignIn.qml b/src/qml/Pages/SignIn.qml index 2a9e2347..0482b456 100644 --- a/src/qml/Pages/SignIn.qml +++ b/src/qml/Pages/SignIn.qml @@ -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} diff --git a/src/qml/Python.qml b/src/qml/Python.qml index c6174baa..8cec4366 100644 --- a/src/qml/Python.qml +++ b/src/qml/Python.qml @@ -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 }) }