infoPanelControls.py (3199B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\infoPanels\infoPanelControls.py 2 from carbonui.fontconst import STYLE_DEFAULT, EVE_SMALL_FONTSIZE 3 from carbonui.primitives.container import Container 4 from carbonui.primitives.fill import Fill 5 from carbonui.primitives.frame import Frame 6 from eve.client.script.ui.control.eveLabel import Label 7 from charactercreator.const import FRAME_SOFTSHADE 8 import carbonui.const as uiconst 9 import trinity 10 11 class InfoPanelHeaderBackground(Container): 12 BGCOLOR = (1, 1, 1, 0.35) 13 DEFAULT_SHADOW_OPACITY = 0.25 14 15 def ApplyAttributes(self, attributes): 16 Container.ApplyAttributes(self, attributes) 17 self.colorFill = Fill(bgParent=self, color=attributes.color or self.BGCOLOR) 18 self.shadow = Frame(bgParent=self, frameConst=FRAME_SOFTSHADE, color=(0, 19 0, 20 0, 21 self.DEFAULT_SHADOW_OPACITY), padding=(-10, -10, -10, -10)) 22 23 def HideShadow(self): 24 self.shadow.opacity = 0 25 26 def ShowShadow(self): 27 self.shadow.opacity = self.DEFAULT_SHADOW_OPACITY 28 29 def SetBackgroundColor(self, *color): 30 self.colorFill.SetRGBA(*color) 31 32 33 class InfoPanelLabel(Container): 34 displayText = None 35 default_fontsize = EVE_SMALL_FONTSIZE 36 default_fontStyle = STYLE_DEFAULT 37 default_color = (1.0, 1.0, 1.0, 0.8) 38 39 def ApplyAttributes(self, attributes): 40 Container.ApplyAttributes(self, attributes) 41 self.mainLabel = Label(parent=self, state=uiconst.UI_DISABLED, color=attributes.color or self.default_color, fontsize=attributes.fontsize or self.default_fontsize, fontStyle=attributes.fontStyle or self.default_fontStyle, bold=attributes.bold or False) 42 self.mainShadowLabel = Label(parent=self, state=uiconst.UI_DISABLED, align=uiconst.TOPLEFT, color=(0, 0, 0, 0.75), fontsize=attributes.fontsize or self.default_fontsize, fontStyle=attributes.fontStyle or self.default_fontStyle, bold=attributes.bold or False) 43 self.mainShadowLabel.renderObject.spriteEffect = trinity.TR2_SFX_BLUR 44 self.text = attributes.text 45 46 @apply 47 def text(): 48 49 def fset(self, value): 50 self.mainLabel.text = value 51 self.mainShadowLabel.text = value 52 self.width = self.mainLabel.width 53 self.height = self.mainLabel.height 54 55 def fget(self): 56 return self.mainLabel.text 57 58 return property(**locals()) 59 60 @apply 61 def textwidth(): 62 63 def fset(self, value): 64 pass 65 66 def fget(self): 67 return self.mainLabel.textwidth 68 69 return property(**locals()) 70 71 @apply 72 def textheight(): 73 74 def fset(self, value): 75 pass 76 77 def fget(self): 78 return self.mainLabel.textheight 79 80 return property(**locals()) 81 82 @apply 83 def fontsize(): 84 85 def fset(self, value): 86 self.mainLabel.fontsize = value 87 self.mainShadowLabel.fontsize = value 88 89 def fget(self): 90 return self.mainLabel.fontsize 91 92 return property(**locals()) 93 94 def SetAlpha(self, alpha): 95 self.mainLabel.SetAlpha(alpha) 96 self.mainShadowLabel.SetAlpha(alpha)