changeset 49:fd9cbf6ae663

core: postInit() is now called, allowing automatic profile connection
author Goffi <goffi@goffi.org>
date Sat, 10 Sep 2016 16:01:33 +0200
parents 028a98983e46
children c45d6e9ec731
files src/cagou/core/cagou_main.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/cagou/core/cagou_main.py	Sat Sep 10 15:52:30 2016 +0200
+++ b/src/cagou/core/cagou_main.py	Sat Sep 10 16:01:33 2016 +0200
@@ -183,7 +183,8 @@
     """Kivy App for Cagou"""
 
     def build(self):
-        return CagouRootWidget(ProfileManager())
+        self._profile_manager = ProfileManager()
+        return CagouRootWidget(self._profile_manager)
 
     def expand(self, path, *args, **kwargs):
         """expand path and replace known values
@@ -218,8 +219,14 @@
                 yield w
 
     def run(self):
+        Clock.schedule_once(self.postInit)
         self.app.run()
 
+    def postInit(self, dummy):
+        profile_manager = self.app._profile_manager
+        del self.app._profile_manager
+        super(Cagou, self).postInit(profile_manager)
+
     def _defaultFactory(self, plugin_info, target, profiles):
         """factory used to create widget instance when PLUGIN_INFO["factory"] is not set"""
         main_cls = plugin_info['main']