colorBlindHuePalette.py (1419B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\carbonui\util\colorBlindHuePalette.py 2 from carbonui.primitives.container import Container 3 from carbonui.primitives.containerAutoSize import ContainerAutoSize 4 from carbonui.primitives.fill import Fill 5 import carbonui.const as uiconst 6 from carbonui.util import color 7 from localization import GetByLabel 8 NUM_SAMPLES = 32 9 SIZE = 8 10 11 class ColorBlindHuePalette(ContainerAutoSize): 12 default_name = 'ColorBlindHuePalette' 13 14 def ApplyAttributes(self, attributes): 15 ContainerAutoSize.ApplyAttributes(self, attributes) 16 self.ConstructLayout() 17 18 def Reconstruct(self): 19 self.Flush() 20 self.ConstructLayout() 21 22 def ConstructLayout(self): 23 self.ConstructPalette(ignore=True, hint=GetByLabel('UI/SystemMenu/GeneralSettings/ColorBlindOriginalPalette')) 24 self.ConstructPalette(ignore=False, hint=GetByLabel('UI/SystemMenu/GeneralSettings/ColorBlindResultingPalette')) 25 26 def ConstructPalette(self, ignore, hint): 27 cont = Container(parent=self, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, height=SIZE, padBottom=5, hint=hint) 28 for i in xrange(NUM_SAMPLES): 29 c = color.Color(1, 1, 1, 1.0).SetHSB(float(i) / NUM_SAMPLES, 1.0, 1.0).GetRGBA() 30 Fill(parent=cont, align=uiconst.TOLEFT_PROP, width=1.0 / NUM_SAMPLES, color=c, padLeft=1, ignoreColorBlindMode=ignore)