ExtractorContainer.py (4241B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\planet\pinContainers\ExtractorContainer.py 2 import blue 3 import dogma.data 4 import evetypes 5 import localization 6 from carbon.common.script.util.format import FmtTime, FmtTimeInterval 7 from dogma.attributes.format import GetFormatAndValue 8 from eve.client.script.ui.control.gauge import Gauge 9 from eve.client.script.ui.shared.planet.pinContainers.BasePinContainer import BasePinContainer, CaptionAndSubtext 10 from eve.client.script.ui.shared.planet.pinContainers.obsoletePinContainer import ObsoletePinContainer 11 from eve.client.script.ui.shared.planet import planetCommon as planetCommonUI 12 from eve.common.lib import appConst 13 from eve.common.script.planet.entities import basePin 14 15 class ExtractorContainer(ObsoletePinContainer): 16 default_name = 'ExtractorContainer' 17 INFO_CONT_HEIGHT = 95 18 19 def ApplyAttributes(self, attributes): 20 BasePinContainer.ApplyAttributes(self, attributes) 21 22 def _GetInfoCont(self): 23 self.currDepositTxt = CaptionAndSubtext(parent=self.infoContLeft, caption=localization.GetByLabel('UI/PI/Common/Extracting'), top=0) 24 self.depositsLeftTxt = CaptionAndSubtext(parent=self.infoContLeft, caption=localization.GetByLabel('UI/PI/Common/TotalAmountLeft'), top=40) 25 self.timeToDeplTxt = CaptionAndSubtext(parent=self.infoContLeft, caption=localization.GetByLabel('UI/PI/Common/TimeToDepletion'), top=70) 26 self.currCycleGauge = Gauge(parent=self.infoContRight, value=0.0, color=planetCommonUI.PLANET_COLOR_CYCLE, label=localization.GetByLabel('UI/PI/Common/CurrentCycle'), cyclic=True) 27 self.amountPerCycleTxt = CaptionAndSubtext(parent=self.infoContRight, caption=localization.GetByLabel('UI/PI/Common/OutputPerCycle'), top=40) 28 self.amountPerHourTxt = CaptionAndSubtext(parent=self.infoContRight, caption=localization.GetByLabel('UI/PI/Common/OutputPerHour'), top=70) 29 30 def _UpdateInfoCont(self): 31 if self.pin.depositType is not None and self.pin.depositQtyPerCycle > 0: 32 timeToDepletion = self.pin.GetTimeToDepletion() 33 totalTimeLeft = timeToDepletion 34 self.timeToDeplTxt.SetCaption(localization.GetByLabel('UI/PI/Common/TimeToDepletion')) 35 if totalTimeLeft < appConst.DAY: 36 totalTimeLeft = FmtTime(float(totalTimeLeft)) 37 else: 38 totalTimeLeft = FmtTimeInterval(long(totalTimeLeft), breakAt='hour') 39 deposName = evetypes.GetName(self.pin.depositType) 40 if self.pin.activityState < basePin.STATE_IDLE: 41 currCycle = 0 42 currCycleProportion = 0.0 43 cycleTime = 0 44 else: 45 currCycle = blue.os.GetWallclockTime() - self.pin.lastRunTime 46 currCycleProportion = currCycle / float(self.pin.GetCycleTime()) 47 cycleTime = self.pin.GetCycleTime() 48 else: 49 currCycle = 0 50 totalTimeLeft = FmtTime(0) 51 currCycleProportion = 0.0 52 cycleTime = 0 53 deposName = localization.GetByLabel('UI/PI/Common/NothingExtracted') 54 self.currDepositTxt.SetIcon(self.pin.depositType) 55 self.currDepositTxt.SetSubtext(deposName) 56 self.depositsLeftTxt.SetSubtext(localization.GetByLabel('UI/PI/Common/UnitsAmount', amount=self.pin.depositQtyRemaining)) 57 if self.pin.IsInEditMode(): 58 self.currCycleGauge.SetSubText(localization.GetByLabel('UI/PI/Common/InactiveEditMode')) 59 self.timeToDeplTxt.SetSubtext(localization.GetByLabel('UI/PI/Common/InactiveEditMode')) 60 else: 61 self.currCycleGauge.SetValueInstantly(currCycleProportion) 62 self.timeToDeplTxt.SetSubtext(totalTimeLeft) 63 self.currCycleGauge.SetSubText(localization.GetByLabel('UI/PI/Common/CycleTimeElapsed', currTime=long(currCycle), totalTime=long(cycleTime))) 64 self.amountPerCycleTxt.SetSubtext(localization.GetByLabel('UI/PI/Common/UnitsAmount', amount=self.pin.depositQtyPerCycle)) 65 attr = dogma.data.get_attribute_with_default(appConst.attributeLogisticalCapacity) 66 self.amountPerHourTxt.SetSubtext(GetFormatAndValue(attr, self.pin.GetOutputVolumePerHour()))