# HG changeset patch # User Goffi # Date 1578151497 -3600 # Node ID 7b9a0e57df53d144f02e56102a51128580ce92c0 # Parent a3cefa7158dcbf689b4debbb999a2b18bc542348 core: new "connected" property in CagouApp diff -r a3cefa7158dc -r 7b9a0e57df53 cagou/core/cagou_main.py --- a/cagou/core/cagou_main.py Sat Jan 04 16:24:57 2020 +0100 +++ b/cagou/core/cagou_main.py Sat Jan 04 16:24:57 2020 +0100 @@ -296,6 +296,7 @@ c_sec = properties.ListProperty(C.COLOR_SEC) c_sec_light = properties.ListProperty(C.COLOR_SEC_LIGHT) c_sec_dark = properties.ListProperty(C.COLOR_SEC_DARK) + connected = properties.BooleanProperty(False) # we have to put those constants here and not in core/constants.py # because of the use of dp(), which would import Kivy too early # and prevent the log hack @@ -498,6 +499,11 @@ del self.app._profile_manager super(Cagou, self).postInit(profile_manager) + def profilePlugged(self, profile): + super().profilePlugged(profile) + # FIXME: this won't work with multiple profiles + self.app.connected = self.profiles[profile].connected + def _defaultFactoryMain(self, plugin_info, target, profiles): """default factory used to create main widgets instances @@ -880,6 +886,16 @@ else: return super(Cagou, self)._debugHandler(action, parameters, profile) + def connectedHandler(self, jid_s, profile): + # FIXME: this won't work with multiple profiles + super().connectedHandler(jid_s, profile) + self.app.connected = True + + def disconnectedHandler(self, profile): + # FIXME: this won't work with multiple profiles + super().disconnectedHandler(profile) + self.app.connected = False + ## misc ## def plugging_profiles(self):