Mercurial > libervia-desktop-kivy
comparison src/cagou/core/cagou_main.py @ 87:17094a075fd2
core: use C.PLUGIN_EXT to know which plugin extension to use
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 25 Dec 2016 16:41:25 +0100 |
parents | c711be670ecd |
children | d249df379fa3 |
comparison
equal
deleted
inserted
replaced
86:c711be670ecd | 87:17094a075fd2 |
---|---|
69 kivy.support.install_android() | 69 kivy.support.install_android() |
70 # sys.platform is "linux" on android by default | 70 # sys.platform is "linux" on android by default |
71 # so we change it to allow backend to detect android | 71 # so we change it to allow backend to detect android |
72 sys.platform = "android" | 72 sys.platform = "android" |
73 import mmap | 73 import mmap |
74 C.PLUGIN_EXT = 'pyo' | |
74 | 75 |
75 | 76 |
76 class NotifsIcon(IconButton): | 77 class NotifsIcon(IconButton): |
77 notifs = properties.ListProperty() | 78 notifs = properties.ListProperty() |
78 | 79 |
378 log.debug(u"kv file {} loaded".format(kv_path)) | 379 log.debug(u"kv file {} loaded".format(kv_path)) |
379 | 380 |
380 def _import_plugins(self): | 381 def _import_plugins(self): |
381 """import all plugins""" | 382 """import all plugins""" |
382 self.default_wid = None | 383 self.default_wid = None |
383 if sys.platform == "android": | 384 plugins_path = os.path.dirname(cagou.plugins.__file__) |
384 #Â FIXME: android hack, need to be moved to separate file | 385 plugin_glob = u"plugin*." + C.PLUGIN_EXT |
385 plugins_path = "/data/data/org.goffi.cagou.cagou/files/cagou/plugins" | |
386 plugin_glob = "plugin*.pyo" | |
387 else: | |
388 plugins_path = os.path.dirname(cagou.plugins.__file__) | |
389 plugin_glob = "plugin*.py" | |
390 plug_lst = [os.path.splitext(p)[0] for p in map(os.path.basename, glob.glob(os.path.join(plugins_path, plugin_glob)))] | 386 plug_lst = [os.path.splitext(p)[0] for p in map(os.path.basename, glob.glob(os.path.join(plugins_path, plugin_glob)))] |
391 | 387 |
392 imported_names_main = set() # used to avoid loading 2 times plugin with same import name | 388 imported_names_main = set() # used to avoid loading 2 times plugin with same import name |
393 imported_names_upload = set() | 389 imported_names_upload = set() |
394 for plug in plug_lst: | 390 for plug in plug_lst: |