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
This commit is contained in:
Goffi 2023-10-03 16:24:13 +02:00
commit 83925b198f

View file

@ -246,7 +246,7 @@ class ProfilesManager(object):
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 @@ class QuickApp(object):
#: 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 @@ class QuickApp(object):
## 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()