Mercurial > libervia-desktop-kivy
diff src/cagou.py @ 9:7b0a53d2afd3
contact list: first draft
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 08 Jul 2016 18:30:30 +0200 |
parents | 85649eca9f9b |
children | 49d30fc15884 |
line wrap: on
line diff
--- a/src/cagou.py Fri Jul 08 18:30:30 2016 +0200 +++ b/src/cagou.py Fri Jul 08 18:30:30 2016 +0200 @@ -33,13 +33,29 @@ from kivy.app import App import xmlui from profile_manager import ProfileManager +from contact_list import ContactList +from kivy.uix.boxlayout import BoxLayout +import os.path + + +class CagouRootWidget(BoxLayout): + + def __init__(self, widgets): + super(CagouRootWidget, self).__init__(orientation=("vertical")) + for wid in widgets: + self.add_widget(wid) + + def change_widgets(self, widgets): + self.clear_widgets() + for wid in widgets: + self.add_widget(wid) class CagouApp(App): """Kivy App for Cagou""" def build(self): - return ProfileManager(self.host) + return CagouRootWidget([ProfileManager(self.host)]) class Cagou(QuickApp): @@ -49,10 +65,19 @@ super(Cagou, self).__init__(create_bridge=DBusBridgeFrontend, xmlui=xmlui) 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") def run(self): self.app.run() + def plugging_profiles(self): + contact_list = self.widgets.getOrCreateWidget(ContactList, None, on_new_widget=None) + self.app.root.change_widgets([contact_list]) + + 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)) + if __name__ == '__main__': Cagou().run()