Mercurial > libervia-desktop-kivy
diff src/cagou/core/cagou_main.py @ 61:0b7f10de416e
android: android build first draft:
- added buildozer.spec
- added src/sat.conf which is the configuration used on android (FIXME: need to rename/move it)
- small hack to change loading paths on android
- sys.platform is set to android when kivy_utils.platform is set to android
- softinput_mode is set to "below_target", so field are not hidden when virtual keyboard appears
Note: using org.goffi.cagou instead of org.salut-a-toi.cagou for package domain because the dash ("-") is causing trouble to buildozer. This need to be fixed.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 04 Dec 2016 18:21:23 +0100 |
parents | 35abe494e6c7 |
children | af4f986d86f0 |
line wrap: on
line diff
--- a/src/cagou/core/cagou_main.py Sun Dec 04 18:16:10 2016 +0100 +++ b/src/cagou/core/cagou_main.py Sun Dec 04 18:21:23 2016 +0100 @@ -61,7 +61,14 @@ import cagou.plugins import cagou.kv from sat.core import sat_main +from kivy import utils as kivy_utils import sys +if kivy_utils.platform == "android": + # FIXME: move to separate android module + kivy.support.install_android() + # sys.platform is "linux" on android by default + # so we change it to allow backend to detect android + sys.platform = "android" class NotifsIcon(IconButton): @@ -266,6 +273,8 @@ self.postInit() def postInit(self, dummy=None): + # FIXME: resize seem to bug on android, so we use below_target for now + self.app.root_window.softinput_mode = "below_target" profile_manager = self.app._profile_manager del self.app._profile_manager super(Cagou, self).postInit(profile_manager) @@ -287,8 +296,15 @@ def _import_plugins(self): """import all plugins""" self.default_wid = None - plugins_path = os.path.dirname(cagou.plugins.__file__) - plug_lst = [os.path.splitext(p)[0] for p in map(os.path.basename, glob.glob(os.path.join(plugins_path, "plugin*.py")))] + if sys.platform == "android": + # FIXME: android hack, need to be moved to separate file + plugins_path = "/data/data/org.goffi.cagou.cagou/files/cagou/plugins" + plugin_glob = "plugin*.pyo" + else: + plugins_path = os.path.dirname(cagou.plugins.__file__) + plugin_glob = "plugin*.py" + plug_lst = [os.path.splitext(p)[0] for p in map(os.path.basename, glob.glob(os.path.join(plugins_path, plugin_glob)))] + imported_names = set() # use to avoid loading 2 times plugin with same import name for plug in plug_lst: plugin_path = 'cagou.plugins.' + plug @@ -492,3 +508,8 @@ def getDefaultAvatar(self, entity=None): return self.app.default_avatar + + def showDialog(self, message, title, type="info", answer_cb=None, answer_data=None): + # TODO + log.info(u"FIXME: showDialog not implemented") + log.info(u"message: {} -- {}".format(title, message))