[core/themes] De-duplicate theme names

List themes only once, even if they are present multiple times in
different locations.

(Yes, I know that list(set(result)) would do the same, but here, I'd
like to not waste memory and be a bit faster).

see #203
This commit is contained in:
Tobias Witek 2017-11-18 14:51:25 +01:00
parent f72ac0ca99
commit 9d7fc5c1d4

View file

@ -18,12 +18,14 @@ def theme_path():
]
def themes():
result = []
themes = {}
for path in theme_path():
for filename in glob.iglob("{}/*.json".format(path)):
if "test" not in filename:
result.append(os.path.basename(filename).replace(".json", ""))
themes[os.path.basename(filename).replace(".json", "")] = 1
result = themes.keys()
result.sort()
return result
class Theme(object):