Mercurial > libervia-backend
comparison sat_frontends/jp/base.py @ 4041:2594e1951cf7
core (bridge): `action_new` now use serialised dict for extra data.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 15 May 2023 16:20:45 +0200 |
parents | 524856bd7b19 |
children | 877145b4ba01 |
comparison
equal
deleted
inserted
replaced
4040:1f967f85fc23 | 4041:2594e1951cf7 |
---|---|
1385 # already managed when callback is called | 1385 # already managed when callback is called |
1386 | 1386 |
1387 def __init__(self, *args, **kwargs): | 1387 def __init__(self, *args, **kwargs): |
1388 super(CommandAnswering, self).__init__(*args, **kwargs) | 1388 super(CommandAnswering, self).__init__(*args, **kwargs) |
1389 | 1389 |
1390 async def on_action_new(self, action_data, action_id, security_limit, profile): | 1390 async def on_action_new( |
1391 self, | |
1392 action_data_s: str, | |
1393 action_id: str, | |
1394 security_limit: int, | |
1395 profile: str | |
1396 ) -> None: | |
1391 if profile != self.profile: | 1397 if profile != self.profile: |
1392 return | 1398 return |
1399 action_data = data_format.deserialise(action_data_s) | |
1393 try: | 1400 try: |
1394 action_type = action_data['meta_type'] | 1401 action_type = action_data['meta_type'] |
1395 except KeyError: | 1402 except KeyError: |
1396 try: | 1403 try: |
1397 xml_ui = action_data["xmlui"] | 1404 xml_ui = action_data["xmlui"] |
1422 | 1429 |
1423 async def start_answering(self): | 1430 async def start_answering(self): |
1424 """Auto reply to confirmation requests""" | 1431 """Auto reply to confirmation requests""" |
1425 self.host.bridge.register_signal("action_new", self.on_action_new) | 1432 self.host.bridge.register_signal("action_new", self.on_action_new) |
1426 actions = await self.host.bridge.actions_get(self.profile) | 1433 actions = await self.host.bridge.actions_get(self.profile) |
1427 for action_data, action_id, security_limit in actions: | 1434 for action_data_s, action_id, security_limit in actions: |
1428 await self.on_action_new(action_data, action_id, security_limit, self.profile) | 1435 await self.on_action_new(action_data_s, action_id, security_limit, self.profile) |