diff src/cagou/core/cagou_main.py @ 28:9f9532eb835f

core: added expand method to expand filename with magic values, specially useful in kv
author Goffi <goffi@goffi.org>
date Sun, 21 Aug 2016 15:02:18 +0200
parents d09bd16dbbe2
children 8b5827c43155
line wrap: on
line diff
--- a/src/cagou/core/cagou_main.py	Sun Aug 21 12:43:36 2016 +0200
+++ b/src/cagou/core/cagou_main.py	Sun Aug 21 15:02:18 2016 +0200
@@ -63,6 +63,14 @@
     def build(self):
         return CagouRootWidget([ProfileManager()])
 
+    def expand(self, path):
+        """expand path and replace known values
+
+        useful in kv. Values which can be used:
+            - {media}: media dir
+        """
+        return os.path.expanduser(path).format(media=self.host.media_dir)
+
 
 class Cagou(QuickApp):
     MB_HANDLE = False