comparison libervia/frontends/quick_frontend/quick_app.py @ 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
comparison
equal deleted inserted replaced
4124:6b581d4c249f 4125:bb74f7dc3b10
244 244
245 def choose_one_profile(self): 245 def choose_one_profile(self):
246 return list(self._profiles.keys())[0] 246 return list(self._profiles.keys())[0]
247 247
248 248
249 class QuickApp(object): 249 class QuickApp:
250 """This class contain the main methods needed for the frontend""" 250 """This class contain the main methods needed for the frontend"""
251 251
252 MB_HANDLER = True #: Set to False if the frontend doesn't manage microblog 252 MB_HANDLER = True #: Set to False if the frontend doesn't manage microblog
253 AVATARS_HANDLER = True #: set to False if avatars are not used 253 AVATARS_HANDLER = True #: set to False if avatars are not used
254 ENCRYPTION_HANDLERS = True #: set to False if encryption is handled separatly 254 ENCRYPTION_HANDLERS = True #: set to False if encryption is handled separatly
255 #: if True, QuickApp will call resync itself, on all widgets at the same time 255 #: if True, QuickApp will call resync itself, on all widgets at the same time
256 #: if False, frontend must call resync itself when suitable (e.g. widget is being 256 #: if False, frontend must call resync itself when suitable (e.g. widget is being
257 #: visible) 257 #: visible)
258 AUTO_RESYNC = True 258 AUTO_RESYNC = True
259 259
260 def __init__(self, bridge_factory, xmlui, check_options=None, connect_bridge=True): 260 def __init__(
261 self, bridge_factory, xmlui, check_options=None, connect_bridge=True,
262 async_bridge_factory=None
263 ):
261 """Create a frontend application 264 """Create a frontend application
262 265
263 @param bridge_factory: method to use to create the bridge 266 @param bridge_factory: method to use to create the bridge
264 @param xmlui: xmlui module 267 @param xmlui: xmlui module
265 @param check_options: method to call to check options (usually command line 268 @param check_options: method to call to check options (usually command line
293 trigger.TriggerManager() 296 trigger.TriggerManager()
294 ) # trigger are used to change the default behaviour 297 ) # trigger are used to change the default behaviour
295 298
296 ## bridge ## 299 ## bridge ##
297 self.bridge = bridge_factory() 300 self.bridge = bridge_factory()
301 if async_bridge_factory is None:
302 log.warning("No async bridge specified")
303 self.a_bridge = None
304 else:
305 self.a_bridge = async_bridge_factory()
298 ProfileManager.bridge = self.bridge 306 ProfileManager.bridge = self.bridge
299 if connect_bridge: 307 if connect_bridge:
300 self.connect_bridge() 308 self.connect_bridge()
301 309
302 # frontend notifications 310 # frontend notifications