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

summaryCont.py (2684B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\sov\sovHub\summaryCont.py
      2 import carbonui.text.styles
      3 from carbonui.primitives.container import Container
      4 import carbonui
      5 from carbonui.primitives.containerAutoSize import ContainerAutoSize
      6 from carbonui.primitives.layoutGrid import LayoutGrid
      7 from eve.client.script.ui.shared.sov.sovHub.powerCapacity import PowerCapacityCont
      8 from eveexceptions import ExceptionEater
      9 from localization import GetByLabel
     10 
     11 class SummaryCont(ContainerAutoSize):
     12     default_minHeight = 36
     13     default_align = carbonui.Align.TOTOP
     14 
     15     def ApplyAttributes(self, attributes):
     16         super(SummaryCont, self).ApplyAttributes(attributes)
     17         self.hubController = attributes.hubController
     18         self.hubController.on_online_state_changed.connect(self.OnOnlineStateChanged)
     19         self.hubController.workforceController.on_workforce_changed.connect(self.OnWorkforceChanged)
     20         self.ConstructuUI()
     21 
     22     def ConstructuUI(self):
     23         labelGridCont = ContainerAutoSize(parent=self, align=carbonui.Align.TOTOP)
     24         self.labelGrid = LayoutGrid(parent=labelGridCont, columns=3, cellSpacing=10)
     25         self.onlineUpgradesNumLabel = carbonui.text.styles.TextDetail(name='onlineUpgradesNumLabel', parent=self.labelGrid, text=GetByLabel('UI/Sovereignty/SovHub/HubWnd/NumUpgradesOnline', numOnline=''), align=carbonui.Align.TOPLEFT)
     26         carbonui.text.styles.TextDetail(name='slash', parent=self.labelGrid, text='/', align=carbonui.Align.TOPLEFT)
     27         self.installedUpgradesNumLabel = carbonui.text.styles.TextDetail(name='installedUpgradesNumLabel', parent=self.labelGrid, text=GetByLabel('UI/Sovereignty/SovHub/HubWnd/NumUpgradesInstalled', numInstalled=''), align=carbonui.Align.TOPLEFT, color=carbonui.TextColor.SECONDARY)
     28 
     29     def LoadSummary(self):
     30         online, installed = self.hubController.GetNumSimulatedUpgradesOnlineAndInstalled()
     31         self.onlineUpgradesNumLabel.text = GetByLabel('UI/Sovereignty/SovHub/HubWnd/NumUpgradesOnline', numOnline=online)
     32         self.installedUpgradesNumLabel.text = GetByLabel('UI/Sovereignty/SovHub/HubWnd/NumUpgradesInstalled', numInstalled=installed)
     33 
     34     def OnOnlineStateChanged(self, typeID):
     35         self.LoadSummary()
     36 
     37     def OnWorkforceChanged(self):
     38         self.LoadSummary()
     39 
     40     def Close(self):
     41         with ExceptionEater('Closing SummaryCont'):
     42             self.hubController.on_online_state_changed.disconnect(self.OnOnlineStateChanged)
     43             self.hubController.workforceController.on_workforce_changed.disconnect(self.OnWorkforceChanged)
     44             self.hubController = None
     45         super(SummaryCont, self).Close()