changeset 02574ae24a1d in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset;node=02574ae24a1d
description:
        Do not store colors on IconFactory

        The configuration values may change when it is loaded on startup.

        issue8416
        review257601002
diffstat:

 tryton/common/common.py |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 0381da032e0f -r 02574ae24a1d tryton/common/common.py
--- a/tryton/common/common.py   Mon Jun 17 22:24:46 2019 +0200
+++ b/tryton/common/common.py   Thu Jun 20 23:18:17 2019 +0200
@@ -111,10 +111,9 @@
             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 @@
                 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 @@
                 if badge:
                     if not isinstance(badge, str):
                         try:
-                            badge = cls.colors[badge]
+                            badge = colors[badge]
                         except IndexError:
                             badge = color
                     ET.SubElement(root, 'circle', {

Reply via email to