NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

panelJumpBridgeMechanics.py (3417B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\info\panels\panelJumpBridgeMechanics.py
      2 import carbonui.const as uiconst
      3 from carbonui import Align
      4 from carbonui.text.styles import TextBody
      5 from carbonui.button.const import HEIGHT_NORMAL
      6 from carbonui.control.scrollContainer import ScrollContainer
      7 from carbonui.primitives.container import Container
      8 from carbonui.primitives.containerAutoSize import ContainerAutoSize
      9 from carbonui.primitives.fill import Fill
     10 from carbonui.primitives.sprite import Sprite
     11 from eve.client.script.ui.control.eveLabel import EveLabelMedium
     12 from localization import GetByLabel
     13 
     14 class PanelJumpBridgeMechanics(Container):
     15 
     16     def ApplyAttributes(self, attributes):
     17         super(PanelJumpBridgeMechanics, self).ApplyAttributes(attributes)
     18         self.typeID = attributes.typeID
     19 
     20     def Load(self):
     21         self.Flush()
     22         self.scrollContainer = ScrollContainer(parent=self, padding=uiconst.defaultPadding)
     23         self.AddJumpRestrictionsCont()
     24         self.AddCapacitorUsageCont()
     25 
     26     def AddBulletin(self, parent, text, bulletNumber = None, maxLines = None):
     27         textCont = ContainerAutoSize(name='textCont', parent=parent, align=uiconst.TOTOP, alignMode=Align.TOTOP)
     28         padTop = 0
     29         padLeft = 16
     30         bulletLabel = TextBody(parent=textCont, padTop=padTop, text=text, align=uiconst.TOTOP, padLeft=padLeft, maxLines=maxLines)
     31         _, activationHeight = bulletLabel.MeasureTextSize(text, maxLines=1)
     32         iconSize = 8
     33         bulletinCont = Container(parent=textCont, align=uiconst.TOPLEFT, pos=(0,
     34          0,
     35          16,
     36          activationHeight))
     37         if bulletNumber:
     38             bulletLabel = TextBody(parent=bulletinCont, text='%s.' % bulletNumber, align=uiconst.CENTERLEFT)
     39         else:
     40             Sprite(parent=bulletinCont, pos=(0,
     41              padTop,
     42              iconSize,
     43              iconSize), align=Align.CENTER, texturePath='res:/ui/texture/icons/3_8_1.png', state=uiconst.UI_DISABLED)
     44 
     45     def AddJumpRestrictionsCont(self):
     46         text = GetByLabel('UI/Inflight/SpaceComponents/JumpBridge/Info/JumpRestrictionsText')
     47         textList = text.splitlines(False)
     48         self.AddMultiBulletinSection(GetByLabel('UI/Inflight/SpaceComponents/JumpBridge/Info/JumpRestrictions'), textList)
     49 
     50     def AddCapacitorUsageCont(self):
     51         text = GetByLabel('UI/Inflight/SpaceComponents/JumpBridge/Info/CapacitorUsageText')
     52         textList = text.splitlines(False)
     53         self.AddMultiBulletinSection(GetByLabel('UI/Inflight/SpaceComponents/JumpBridge/Info/CapacitorUsage'), textList)
     54 
     55     def AddMultiBulletinSection(self, headerText, textList, showNumbers = False):
     56         AddHeader(self.scrollContainer, headerText, padTop=8)
     57         c = ContainerAutoSize(name='bulletinCont', parent=self.scrollContainer, align=uiconst.TOTOP, alignMode=Align.TOTOP, padding=8)
     58         for i, text in enumerate(textList):
     59             bulletNumber = i + 1 if showNumbers else None
     60             self.AddBulletin(c, text=text, bulletNumber=bulletNumber)
     61 
     62 
     63 def AddHeader(parent, headerText, padTop = 0):
     64     c = ContainerAutoSize(name='headerCont', parent=parent, align=uiconst.TOTOP, minHeight=HEIGHT_NORMAL, padTop=padTop)
     65     EveLabelMedium(text=headerText, parent=c, left=8, top=0, state=uiconst.UI_DISABLED, maxLines=1, align=uiconst.CENTERLEFT)
     66     Fill(bgParent=c, opacity=0.05, padBottom=1)