eveLabel.py (6542B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\control\eveLabel.py 2 import log 3 import trinity 4 from carbonui import fontconst, TextColor, uiconst 5 from carbonui.control.label import LabelCore 6 from carbonui.control.link import Link 7 from carbonui.primitives.containerAutoSize import ContainerAutoSize 8 9 class Label(LabelCore): 10 __guid__ = 'uicontrols.Label' 11 default_name = 'Label' 12 default_fontsize = fontconst.EVE_MEDIUM_FONTSIZE 13 default_color = TextColor.NORMAL 14 default_align = uiconst.TOPLEFT 15 default_shadowOffset = (1, 1) 16 default_shadowSpriteEffect = trinity.TR2_SFX_FONT 17 default_shadowColor = (0.0, 0.0, 0.0, 0.6) 18 19 @staticmethod 20 def GetLinkHandlerClass(): 21 return Link 22 23 24 class EveStyleLabel(Label): 25 default_name = 'EveStyleLabel' 26 27 def ApplyAttributes(self, attributes): 28 fontsize = attributes.get('fontsize', None) 29 if fontsize is not None: 30 attributes.fontsize = self.default_fontsize 31 log.LogTraceback('You are not allowed to change fontsize of a font style - find another style to use or use uicontrols.Label for custom labels') 32 uppercase = attributes.get('uppercase', None) 33 if uppercase is not None: 34 attributes.uppercase = self.default_uppercase 35 log.LogTraceback('You are not allowed to change uppercase of a font style - find another style to use or use uicontrols.Label for custom labels') 36 letterspace = attributes.get('letterspace', None) 37 if letterspace is not None: 38 attributes.letterspace = self.default_letterspace 39 log.LogTraceback('You are not allowed to change letterspace of a font style - find another style to use or use uicontrols.Label for custom labels') 40 Label.ApplyAttributes(self, attributes) 41 42 43 class EveLabelSmall(EveStyleLabel): 44 __guid__ = 'uicontrols.EveLabelSmall' 45 default_name = 'EveLabelSmall' 46 default_fontsize = fontconst.EVE_SMALL_FONTSIZE 47 default_fontStyle = fontconst.STYLE_SMALLTEXT 48 49 50 class EveHeaderSmall(EveStyleLabel): 51 __guid__ = 'uicontrols.EveHeaderSmall' 52 default_name = 'EveHeaderSmall' 53 default_fontStyle = fontconst.STYLE_SMALLTEXT 54 default_fontsize = fontconst.EVE_SMALL_FONTSIZE 55 default_uppercase = 1 56 57 58 class EveLabelSmallBold(EveStyleLabel): 59 __guid__ = 'uicontrols.EveLabelSmallBold' 60 default_name = 'EveLabelSmallBold' 61 default_fontStyle = fontconst.STYLE_SMALLTEXT 62 default_fontsize = fontconst.EVE_SMALL_FONTSIZE 63 default_bold = True 64 65 66 class EveLabelMedium(EveStyleLabel): 67 __guid__ = 'uicontrols.EveLabelMedium' 68 default_name = 'EveLabelMedium' 69 default_fontsize = fontconst.EVE_MEDIUM_FONTSIZE 70 71 72 class EveHeaderMedium(EveStyleLabel): 73 __guid__ = 'uicontrols.EveHeaderMedium' 74 default_name = 'EveHeaderMedium' 75 default_fontsize = fontconst.EVE_MEDIUM_FONTSIZE 76 default_uppercase = 1 77 78 79 class EveHeaderMediumBold(EveStyleLabel): 80 __guid__ = 'uicontrols.EveHeaderMediumBold' 81 default_name = 'EveHeaderMediumBold' 82 efault_fontsize = fontconst.EVE_MEDIUM_FONTSIZE 83 default_uppercase = 1 84 default_bold = True 85 86 87 class EveLabelMediumBold(EveStyleLabel): 88 __guid__ = 'uicontrols.EveLabelMediumBold' 89 default_name = 'EveLabelMediumBold' 90 default_fontsize = fontconst.EVE_MEDIUM_FONTSIZE 91 default_bold = True 92 93 94 class EveLabelLarge(EveStyleLabel): 95 __guid__ = 'uicontrols.EveLabelLarge' 96 default_name = 'EveLabelLarge' 97 default_fontsize = fontconst.EVE_LARGE_FONTSIZE 98 99 100 class EveHeaderLarge(EveStyleLabel): 101 __guid__ = 'uicontrols.EveHeaderLarge' 102 default_name = 'EveHeaderLarge' 103 default_fontsize = fontconst.EVE_LARGE_FONTSIZE 104 default_uppercase = 1 105 default_fontStyle = fontconst.STYLE_HEADER 106 107 108 class EveHeaderLargeBold(EveStyleLabel): 109 __guid__ = 'uicontrols.EveHeaderLarge' 110 default_name = 'EveHeaderLarge' 111 default_fontsize = fontconst.EVE_LARGE_FONTSIZE 112 default_uppercase = 1 113 default_fontStyle = fontconst.STYLE_HEADER 114 default_bold = True 115 116 117 class EveLabelLargeBold(EveStyleLabel): 118 __guid__ = 'uicontrols.EveLabelLargeBold' 119 default_name = 'EveLabelLargeBold' 120 default_fontsize = fontconst.EVE_LARGE_FONTSIZE 121 default_bold = True 122 123 124 class EveLabelLargeUpper(EveLabelLarge): 125 __guid__ = 'uicontrols.EveLabelLargeUpper' 126 default_name = 'EveLabelLargeUpper' 127 default_uppercase = True 128 129 130 class EveCaptionSmall(EveStyleLabel): 131 __guid__ = 'uicontrols.EveCaptionSmall' 132 default_name = 'EveCaptionSmall' 133 default_fontsize = fontconst.EVE_XLARGE_FONTSIZE 134 default_fontStyle = fontconst.STYLE_HEADER 135 default_lineSpacing = -0.12 136 default_color = TextColor.HIGHLIGHT 137 138 139 class EveCaptionMedium(EveStyleLabel): 140 __guid__ = 'uicontrols.EveCaptionMedium' 141 default_name = 'EveCaptionMedium' 142 default_fontsize = 20 143 default_fontStyle = fontconst.STYLE_HEADER 144 default_lineSpacing = -0.12 145 default_color = TextColor.HIGHLIGHT 146 147 148 class EveCaptionLarge(EveStyleLabel): 149 __guid__ = 'uicontrols.EveCaptionLarge' 150 default_name = 'EveCaptionLarge' 151 default_fontsize = 24 152 default_fontStyle = fontconst.STYLE_HEADER 153 default_lineSpacing = -0.12 154 default_color = TextColor.HIGHLIGHT 155 156 157 class CaptionLabel(Label): 158 __guid__ = 'uicontrols.CaptionLabel' 159 default_name = 'caption' 160 default_fontsize = 20 161 default_letterspace = 1 162 default_align = uiconst.TOALL 163 default_idx = -1 164 default_state = uiconst.UI_DISABLED 165 default_uppercase = True 166 default_bold = True 167 168 169 class WndCaptionLabel(ContainerAutoSize): 170 __guid__ = 'uicontrols.WndCaptionLabel' 171 default_left = 70 172 default_text = '' 173 default_subcaption = None 174 default_align = uiconst.CENTERLEFT 175 176 def ApplyAttributes(self, attributes): 177 ContainerAutoSize.ApplyAttributes(self, attributes) 178 text = attributes.get('text', self.default_text) 179 subcaption = attributes.get('subcaption', self.default_subcaption) 180 self.caption = EveCaptionMedium(align=uiconst.TOPLEFT, parent=self, text=text) 181 self.subcapt = EveLabelSmall(name='subcaption', parent=self, align=uiconst.TOPLEFT, top=self.caption.textheight, state=uiconst.UI_HIDDEN) 182 if subcaption: 183 self.SetSubcaption(subcaption) 184 185 def SetText(self, text): 186 self.caption.text = text 187 188 def SetSubcaption(self, text): 189 self.subcapt.text = text 190 self.subcapt.state = uiconst.UI_DISABLED 191 192 193 from carbonui.control.label import LabelOverride 194 LabelOverride.__bases__ = (Label,)