Do not store colors on IconFactory
The configuration values may change when it is loaded on startup. issue8416 review257601002
This commit is contained in:
1 parent
80b45a24b3
commit
bae7bb440f
1 file changed
+3
-4
@@ -111,10 +111,9 @@ class IconFactory:
|
||||
cls._tryton_icons.remove((icon['id'], icon['name']))
|
||||
del cls._name2id[icon['name']]
|
||||
|
||||
colors = CONFIG['icon.colors'].split(',')
|
||||
|
||||
@classmethod
|
||||
def get_pixbuf(cls, iconname, size=16, color=None, badge=None):
|
||||
colors = CONFIG['icon.colors'].split(',')
|
||||
cls.register_icon(iconname)
|
||||
if iconname not in cls._pixbufs[(size, badge)]:
|
||||
if iconname in cls._icons:
|
||||
@@ -127,7 +126,7 @@ class IconFactory:
|
||||
logger.error("Unknown icon %s" % iconname)
|
||||
return
|
||||
if not color:
|
||||
color = cls.colors[0]
|
||||
color = colors[0]
|
||||
try:
|
||||
ET.register_namespace('', 'http://www.w3.org/2000/svg')
|
||||
root = ET.fromstring(data)
|
||||
@@ -135,7 +134,7 @@ class IconFactory:
|
||||
if badge:
|
||||
if not isinstance(badge, str):
|
||||
try:
|
||||
badge = cls.colors[badge]
|
||||
badge = colors[badge]
|
||||
except IndexError:
|
||||
badge = color
|
||||
ET.SubElement(root, 'circle', {
|
||||
|
||||
Reference in new issue
Block a user