Mercurial > libervia-desktop-kivy
diff src/cagou/core/cagou_main.py @ 25:d09bd16dbbe2
code (cagou widget), selector: icons handling + use of new muchoslava icon set
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 10 Aug 2016 01:24:37 +0200 |
parents | c58b522607f4 |
children | 9f9532eb835f |
line wrap: on
line diff
--- a/src/cagou/core/cagou_main.py Tue Aug 09 22:06:00 2016 +0200 +++ b/src/cagou/core/cagou_main.py Wed Aug 10 01:24:37 2016 +0200 @@ -71,8 +71,8 @@ super(Cagou, self).__init__(create_bridge=DBusBridgeFrontend, xmlui=xmlui) self._import_kv() self.app = CagouApp() - 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.media_dir = self.app.media_dir = self.bridge.getConfig("", "media_dir") + self.app.default_avatar = os.path.join(self.media_dir, "misc/default_avatar.png") self._plg_wids = [] # widget plugins self._import_plugins() @@ -135,6 +135,19 @@ if 'factory' not in plugin_info: plugin_info['factory'] = self._defaultFactory + # icons + for size in ('small', 'medium'): + key = u'icon_{}'.format(size) + try: + path = plugin_info[key] + except KeyError: + path = C.DEFAULT_WIDGET_ICON.format(media=self.media_dir) + else: + path = path.format(media=self.media_dir) + if not os.path.isfile(path): + path = C.DEFAULT_WIDGET_ICON.format(media=self.media_dir) + plugin_info[key] = path + self._plg_wids.append(plugin_info) if not self._plg_wids: log.error(_(u"no widget plugin found"))