[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
This commit is contained in:
parent
3e39f443ef
commit
7b12f678d6
1 changed files with 8 additions and 0 deletions
|
@ -189,6 +189,14 @@ class Theme(object):
|
||||||
def load(self, name, path=theme_path()):
|
def load(self, name, path=theme_path()):
|
||||||
"""Load and parse a theme file"""
|
"""Load and parse a theme file"""
|
||||||
result = None
|
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):
|
if not isinstance(path, list):
|
||||||
path = [path]
|
path = [path]
|
||||||
for p in path:
|
for p in path:
|
||||||
|
|
Loading…
Reference in a new issue