From bae7bb440faefb9e000274cb7fb26a9362442b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 20 Jun 2019 23:18:17 +0200 Subject: [PATCH] Do not store colors on IconFactory The configuration values may change when it is loaded on startup. issue8416 review257601002 --- tryton/common/common.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tryton/common/common.py b/tryton/common/common.py index 9c6975d7ee..8ebcd1948d 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -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', {