[core/theme] Add option to override iconset + add experimental icons

Add an option to load a user-specified icon theme (which will override
the theme's icons).

Also, commit a first version of a set of icons from the ionicons set
(see http://ionicons.com/).

see #252
This commit is contained in:
Tobias Witek 2018-04-29 16:12:39 +02:00
parent fa9ad10549
commit 8e80923f14
4 changed files with 153 additions and 4 deletions

View file

@ -38,12 +38,13 @@ def themes():
class Theme(object):
"""Represents a collection of icons and colors"""
def __init__(self, name):
def __init__(self, name, iconset):
self._widget = None
self._cycle_idx = 0
self._cycle = {}
self._prevbg = None
self._colorset = {}
self._iconset = iconset
self.load_symbols()
@ -77,8 +78,11 @@ class Theme(object):
def _init(self, data):
"""Initialize theme from data structure"""
self._theme = data
for iconset in data.get("icons", []):
self._merge(data, self._load_icons(iconset))
if self._iconset != "auto":
self._merge(data, self._load_icons(self._iconset))
else:
for iconset in data.get("icons", []):
self._merge(data, self._load_icons(iconset))
for colorset in data.get("colors", []):
self._merge(self._colorset, self._load_colors(colorset))
self._defaults = data.get("defaults", {})