systemCostIndexGauge.py (1554B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\industry\systemCostIndexGauge.py 2 from carbonui.util.color import Color 3 from eve.client.script.ui.control.eveLabel import Label, EveLabelSmallBold 4 from eve.client.script.ui.control.gauge import Gauge 5 from eve.client.script.ui.shared.industry import industryUIConst 6 import localization 7 import carbonui.const as uiconst 8 9 class SystemCostIndexGauge(Gauge): 10 default_color = Color(*industryUIConst.COLOR_SYSTEMCOSTINDEX).SetBrightness(0.5).GetRGBA() 11 default_backgroundColor = Color(*industryUIConst.COLOR_SYSTEMCOSTINDEX).SetAlpha(0.1).GetRGBA() 12 13 def ApplyAttributes(self, attributes): 14 Gauge.ApplyAttributes(self, attributes) 15 facilityData = attributes.facilityData 16 activityID = attributes.activityID 17 self.valueLabel = EveLabelSmallBold(parent=self, align=uiconst.CENTER, idx=0, top=1) 18 for i in xrange(11): 19 self.ShowMarker(i / 10.0, color=(0.5, 20 0.5, 21 0.7, 22 i / 60.0)) 23 24 systemCostIndexes = facilityData.GetCostIndexByActivityID() 25 value = systemCostIndexes.get(activityID, 0.0) 26 maxValue = sm.GetService('facilitySvc').GetMaxActivityModifier(activityID) 27 Gauge.SetValue(self, value / maxValue) 28 self.valueLabel.text = '%.2f%%' % (value * 100.0) 29 30 def GetHint(self): 31 return '<b>%s</b><br>%s' % (localization.GetByLabel('UI/Industry/SystemCostIndex'), localization.GetByLabel('UI/Industry/SystemCostIndexHint'))