changeset 4125:bb74f7dc3b10

frontend (quick app): allow to specify an async bridge: Async Bridge can now be specified and used with `a_bridge` in addition to the legacy one. The legacy one will eventually be removed. rel 424
author Goffi <goffi@goffi.org>
date Tue, 03 Oct 2023 16:24:13 +0200
parents 6b581d4c249f
children 45e3bb8607d8
files libervia/frontends/quick_frontend/quick_app.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/frontends/quick_frontend/quick_app.py	Tue Oct 03 16:22:10 2023 +0200
+++ b/libervia/frontends/quick_frontend/quick_app.py	Tue Oct 03 16:24:13 2023 +0200
@@ -246,7 +246,7 @@
         return list(self._profiles.keys())[0]
 
 
-class QuickApp(object):
+class QuickApp:
     """This class contain the main methods needed for the frontend"""
 
     MB_HANDLER = True  #: Set to False if the frontend doesn't manage microblog
@@ -257,7 +257,10 @@
     #: visible)
     AUTO_RESYNC = True
 
-    def __init__(self, bridge_factory, xmlui, check_options=None, connect_bridge=True):
+    def __init__(
+        self, bridge_factory, xmlui, check_options=None, connect_bridge=True,
+        async_bridge_factory=None
+    ):
         """Create a frontend application
 
         @param bridge_factory: method to use to create the bridge
@@ -295,6 +298,11 @@
 
         ## bridge ##
         self.bridge = bridge_factory()
+        if async_bridge_factory is None:
+            log.warning("No async bridge specified")
+            self.a_bridge = None
+        else:
+            self.a_bridge = async_bridge_factory()
         ProfileManager.bridge = self.bridge
         if connect_bridge:
             self.connect_bridge()