fighterPanel.py (2909B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\fittingScreen\fittingPanels\fighterPanel.py 2 from carbonui import const as uiconst, ButtonVariant 3 from carbonui.control.button import Button 4 from eve.client.script.ui.control.eveLabel import EveLabelMedium 5 from eve.client.script.ui.shared.fittingScreen.fittingPanels.basePanel import BaseMenuPanel 6 from eve.client.script.ui.shared.fittingScreen.fittingUtil import GetColoredText 7 from localization import GetByLabel 8 from carbonui.uicore import uicore 9 10 class FighterPanel(BaseMenuPanel): 11 default_iconSize = 20 12 droneStats = (('bandwidth', 'res:/UI/Texture/classes/Fitting/StatsIcons/bandwidth.png', 'DroneBandwidth'), ('controlRange', 'res:/UI/Texture/classes/Fitting/StatsIcons/controlRange.png', 'DroneControlRange')) 13 14 def ApplyAttributes(self, attributes): 15 BaseMenuPanel.ApplyAttributes(self, attributes) 16 17 def LoadPanel(self, initialLoad = False): 18 self.Flush() 19 self.ResetStatsDicts() 20 self.display = True 21 parentGrid = self.GetValueParentGrid(columns=1) 22 self.fullSquadrons = EveLabelMedium(text='', parent=parentGrid, left=7, state=uiconst.UI_DISABLED, align=uiconst.CENTERLEFT, top=4) 23 self.partialSquadrons = EveLabelMedium(text='', parent=parentGrid, left=7, state=uiconst.UI_DISABLED, align=uiconst.CENTERLEFT, top=0) 24 btn = Button(parent=self, label=GetByLabel('UI/Fitting/FittingWindow/ManageFighters'), func=self.ManageDrones, align=uiconst.CENTERRIGHT, left=10, variant=ButtonVariant.GHOST) 25 BaseMenuPanel.FinalizePanelLoading(self, initialLoad) 26 27 def ManageDrones(self, *args): 28 if self.controller.IsSimulated(): 29 self.controller.OpenFakeFighterBay() 30 else: 31 uicore.cmd.OpenFighterBayOfActiveShip() 32 33 def UpdateFighterStats(self): 34 self.SetFighterDpsText() 35 if not self.panelLoaded or self.destroyed: 36 return 37 full, partial = self.controller.GetFullAndPartialSquadrons() 38 fullText = GetByLabel('UI/Fitting/FittingWindow/NumFullSquadrons', numSquadrons=int(full.value)) 39 fullColoredText = GetColoredText(isBetter=full.isBetterThanBefore, text=fullText) 40 self.fullSquadrons.text = fullColoredText 41 partialText = GetByLabel('UI/Fitting/FittingWindow/NumPartialSquadrons', numSquadrons=int(partial.value)) 42 partialColoredText = GetColoredText(isBetter=partial.isBetterThanBefore, text=partialText) 43 self.partialSquadrons.text = partialColoredText 44 45 def SetFighterDpsText(self): 46 totalFighterDpsInfo = self.controller.GetFighterDps() 47 fighterText = GetByLabel('UI/Fitting/FittingWindow/DpsLabel', dps=totalFighterDpsInfo.value) 48 fighterColoredText = GetColoredText(isBetter=totalFighterDpsInfo.isBetterThanBefore, text=fighterText) 49 self.SetStatusText(fighterColoredText)