diff src/cagou/core/cagou_main.py @ 16:ba14b596b90e

host can now be get as a global value: instead of always copying host from class to class, it can now be gotten from a global class with: from cagou import G then G.host will give host. This will probably be used on the long term on all SàT (backend + frontends). As host is currently needed in several places (most importantly in QuickFrontend), the argument is still present, and must be there even is unused on class inheriting from QuickSomething.
author Goffi <goffi@goffi.org>
date Sat, 09 Jul 2016 18:41:52 +0200
parents 56838ad5c84b
children c58b522607f4
line wrap: on
line diff
--- a/src/cagou/core/cagou_main.py	Sat Jul 09 17:24:01 2016 +0200
+++ b/src/cagou/core/cagou_main.py	Sat Jul 09 18:41:52 2016 +0200
@@ -61,7 +61,7 @@
     """Kivy App for Cagou"""
 
     def build(self):
-        return CagouRootWidget([ProfileManager(self.host)])
+        return CagouRootWidget([ProfileManager()])
 
 
 class Cagou(QuickApp):
@@ -71,7 +71,6 @@
         super(Cagou, self).__init__(create_bridge=DBusBridgeFrontend, xmlui=xmlui)
         self._import_kv()
         self.app = CagouApp()
-        self.app.host = self
         media_dir = self.app.media_dir = self.bridge.getConfig("", "media_dir")
         self.app.default_avatar = os.path.join(media_dir, "misc/default_avatar.png")
         self._plg_wids = []  # widget plugins
@@ -80,7 +79,7 @@
     def run(self):
         self.app.run()
 
-    def _defaultFactory(self, host, plugin_info, target, profiles):
+    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']
         return self.widgets.getOrCreateWidget(main_cls, target, on_new_widget=None, profiles=profiles)
@@ -164,7 +163,7 @@
         return lst
 
     def plugging_profiles(self):
-        self.app.root.change_widgets([WidgetsHandler(self)])
+        self.app.root.change_widgets([WidgetsHandler()])
 
     def setPresenceStatus(self, show='', status=None, profile=C.PROF_KEY_NONE):
         log.info(u"Profile presence status set to {show}/{status}".format(show=show, status=status))