Mercurial > libervia-backend
comparison libervia/backend/core/main.py @ 4362:d34b17bce612
core: Add a "Global" variable with a `LiberviaBackend` singleton to `libervia.backend`.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 06 May 2025 00:16:15 +0200 |
parents | e94799a0908f |
children |
comparison
equal
deleted
inserted
replaced
4361:676a320415b9 | 4362:d34b17bce612 |
---|---|
34 from twisted.application import service | 34 from twisted.application import service |
35 from twisted.internet import defer | 35 from twisted.internet import defer |
36 from twisted.words.protocols.jabber import jid | 36 from twisted.words.protocols.jabber import jid |
37 from twisted.internet import reactor | 37 from twisted.internet import reactor |
38 from wokkel.xmppim import RosterItem | 38 from wokkel.xmppim import RosterItem |
39 from libervia.backend import G | |
39 from libervia.backend.core import xmpp | 40 from libervia.backend.core import xmpp |
40 from libervia.backend.core import exceptions | 41 from libervia.backend.core import exceptions |
41 from libervia.backend.core.core_types import SatXMPPEntity | 42 from libervia.backend.core.core_types import SatXMPPEntity |
42 from libervia.backend.core.log import getLogger | 43 from libervia.backend.core.log import getLogger |
43 | 44 |
63 | 64 |
64 def _init(self): | 65 def _init(self): |
65 # we don't use __init__ to avoid doule initialisation with twistd | 66 # we don't use __init__ to avoid doule initialisation with twistd |
66 # this _init is called in startService | 67 # this _init is called in startService |
67 log.info(f"{C.APP_NAME} {self.full_version}") | 68 log.info(f"{C.APP_NAME} {self.full_version}") |
69 G.set_host(self) | |
68 self._cb_map = {} # map from callback_id to callbacks | 70 self._cb_map = {} # map from callback_id to callbacks |
69 # dynamic menus. key: callback_id, value: menu data (dictionnary) | 71 # dynamic menus. key: callback_id, value: menu data (dictionnary) |
70 self._menus = {} | 72 self._menus = {} |
71 self._menus_paths = {} # path to id. key: (menu_type, lower case tuple of path), | 73 self._menus_paths = {} # path to id. key: (menu_type, lower case tuple of path), |
72 # value: menu id | 74 # value: menu id |