From 7b12f678d607ae4faa11dc9f9deea320ef6bf6e2 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Tue, 6 Nov 2018 21:09:26 +0100 Subject: [PATCH] [core/theme] Support loading of themes by file name If the theme name provided by the user is a file, load the theme from there. Note: This change automatically enables a theme to load iconsets from a file name, instead of using a iconset name. fixes #319 --- bumblebee/theme.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bumblebee/theme.py b/bumblebee/theme.py index 08bb5ea..e88e67c 100644 --- a/bumblebee/theme.py +++ b/bumblebee/theme.py @@ -189,6 +189,14 @@ class Theme(object): def load(self, name, path=theme_path()): """Load and parse a theme file""" result = None + + full_name = os.path.expanduser(name) + if os.path.isfile(full_name): + path = os.path.dirname(full_name) + name = os.path.basename(full_name) + name,_,_ = name.rpartition(".json") + return self.load(name, path) + if not isinstance(path, list): path = [path] for p in path: