# HG changeset patch # User Goffi # Date 1471794443 -7200 # Node ID 4f9e701d76b4bb8dc60e0487b2e2e0351a578296 # Parent 8ea3f335307dbfe3032f3d0070d31262fd587aa5 core: expand now accepts extra arguments, which will be used in format diff -r 8ea3f335307d -r 4f9e701d76b4 src/cagou/core/cagou_main.py --- a/src/cagou/core/cagou_main.py Sun Aug 21 17:31:07 2016 +0200 +++ b/src/cagou/core/cagou_main.py Sun Aug 21 17:47:23 2016 +0200 @@ -163,13 +163,16 @@ def build(self): return CagouRootWidget(ProfileManager()) - def expand(self, path): + def expand(self, path, *args, **kwargs): """expand path and replace known values + @param path(unicode): path to expand + @param *args: additional arguments used in format + @param **kwargs: additional keyword arguments used in format useful in kv. Values which can be used: - {media}: media dir """ - return os.path.expanduser(path).format(media=self.host.media_dir) + return os.path.expanduser(path).format(*args, media=self.host.media_dir, **kwargs) class Cagou(QuickApp): diff -r 8ea3f335307d -r 4f9e701d76b4 src/cagou/plugins/plugin_wid_chat.kv --- a/src/cagou/plugins/plugin_wid_chat.kv Sun Aug 21 17:31:07 2016 +0200 +++ b/src/cagou/plugins/plugin_wid_chat.kv Sun Aug 21 17:47:23 2016 +0200 @@ -61,7 +61,7 @@ Color: rgba: 1, 1, 1, 1 BorderImage: - source: app.expand("{media}") + "/misc/borders/{}.jpg".format("blue" if root.mess_data.own_mess else "gray") + source: app.expand("{media}/misc/borders/{}.jpg", "blue" if root.mess_data.own_mess else "gray") pos: self.pos size: self.size id: mess_label