comparison libervia/frontends/quick_frontend/quick_app.py @ 4233:d01b8d002619

cli (call, file), frontends: implement webRTC data channel transfer: - file send/receive commands now supports webRTC transfer. In `send` command, the `--webrtc` flags is currenty used to activate it. - WebRTC related code have been factorized and moved to `libervia.frontends.tools.webrtc*` modules. rel 442
author Goffi <goffi@goffi.org>
date Sat, 06 Apr 2024 13:43:09 +0200
parents 45e3bb8607d8
children
comparison
equal deleted inserted replaced
4232:0fbe5c605eb6 4233:d01b8d002619
635 def profile_plugged(self, profile): 635 def profile_plugged(self, profile):
636 """Method called when the profile is fully plugged 636 """Method called when the profile is fully plugged
637 637
638 This will launch frontend specific workflow 638 This will launch frontend specific workflow
639 639
640 /!\ if you override the method and don't call the parent, be sure to add the 640 /!\\ if you override the method and don't call the parent, be sure to add the
641 profile to ready_profiles ! if you don't, all signals will stay in cache 641 profile to ready_profiles ! if you don't, all signals will stay in cache
642 642
643 @param profile(unicode): %(doc_profile)s 643 @param profile(unicode): %(doc_profile)s
644 """ 644 """
645 self._plugs_in_progress.remove(profile) 645 self._plugs_in_progress.remove(profile)
761 action_handler = self._action_handlers.get(action_type) 761 action_handler = self._action_handlers.get(action_type)
762 if action_handler is not None: 762 if action_handler is not None:
763 action_handler(action_data, action_id, security_limit, profile) 763 action_handler(action_data, action_id, security_limit, profile)
764 else: 764 else:
765 self.action_manager( 765 self.action_manager(
766 action_data, user_action=False, profile=profile 766 action_data, user_action=False, action_id=action_id, profile=profile
767 ) 767 )
768 768
769 def contact_new_handler(self, jid_s, attributes, groups, profile): 769 def contact_new_handler(self, jid_s, attributes, groups, profile):
770 entity = jid.JID(jid_s) 770 entity = jid.JID(jid_s)
771 groups = list(groups) 771 groups = list(groups)
1302 f"There is already a registered handler for {action_type} actions: " 1302 f"There is already a registered handler for {action_type} actions: "
1303 f"{handler}" 1303 f"{handler}"
1304 ) 1304 )
1305 self._action_handlers[action_type] = handler 1305 self._action_handlers[action_type] = handler
1306 1306
1307 def action_manager(self, action_data, callback=None, ui_show_cb=None, user_action=True, 1307 def action_manager(
1308 progress_cb=None, progress_eb=None, profile=C.PROF_KEY_NONE): 1308 self,
1309 action_data: dict,
1310 callback: Callable|None = None,
1311 ui_show_cb: Callable|None = None,
1312 user_action: bool = True,
1313 action_id: str|None = None,
1314 progress_cb: Callable|None = None,
1315 progress_eb: Callable|None = None,
1316 profile: str = C.PROF_KEY_NONE
1317 ) -> None:
1309 """Handle backend action 1318 """Handle backend action
1310 1319
1311 @param action_data(dict): action dict as sent by action_launch or returned by an 1320 @param action_data: action dict as sent by action_launch or returned by an
1312 UI action 1321 UI action
1313 @param callback(None, callback): if not None, callback to use on XMLUI answer 1322 @param callback: if not None, callback to use on XMLUI answer
1314 @param ui_show_cb(None, callback): if not None, method to call to show the XMLUI 1323 @param ui_show_cb: if not None, method to call to show the XMLUI
1315 @param user_action(bool): if True, the action is a result of a user interaction 1324 @param user_action: if True, the action is a result of a user interaction
1316 else the action come from backend direclty (i.e. action_new). 1325 else the action come from backend direclty (i.e. action_new).
1317 This is useful to know if the frontend can display a popup immediately (if 1326 This is useful to know if the frontend can display a popup immediately (if
1318 True) or if it should add it to a queue that the user can activate later. 1327 True) or if it should add it to a queue that the user can activate later.
1319 @param progress_cb(None, callable): method to call when progression is finished. 1328 @param action_id: ID of the action.
1329 @param progress_cb: method to call when progression is finished.
1320 Only make sense if a progress is expected in this action 1330 Only make sense if a progress is expected in this action
1321 @param progress_eb(None, callable): method to call when something went wrong 1331 @param progress_eb: method to call when something went wrong
1322 during progression. 1332 during progression.
1323 Only make sense if a progress is expected in this action 1333 Only make sense if a progress is expected in this action
1324 """ 1334 """
1325 try: 1335 try:
1326 xmlui = action_data.pop("xmlui") 1336 xmlui = action_data.pop("xmlui")