outcomeContainer.py (5169B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\industry\views\outcomeContainer.py 2 import industry 3 import localization 4 from carbonui import const as uiconst 5 from carbonui.primitives.container import Container 6 from carbonui.primitives.containerAutoSize import ContainerAutoSize 7 from carbonui.primitives.frame import Frame 8 from carbonui.uicore import uicore 9 from carbonui.util.color import Color 10 from eve.client.script.ui.control.eveLabel import EveHeaderMedium, EveHeaderSmall, EveLabelMedium, EveLabelLarge 11 from eve.client.script.ui.control.themeColored import FillThemeColored 12 from eve.client.script.ui.shared.industry.industryUIConst import GetJobColor 13 from eve.client.script.ui.shared.industry.views.containersMETE import ContainerTE, ContainerME 14 from eve.client.script.ui.shared.industry.views.errorFrame import ErrorFrame 15 from eve.client.script.ui.shared.industry.views.industryCaptionLabel import IndustryCaptionLabel 16 from eve.client.script.ui.shared.industry.views.industryTooltips import ProbabilityTooltipPanel 17 from eve.client.script.ui.shared.industry.views.outcomeItemContainer import OutcomeItemContainer 18 from localization import GetByLabel 19 20 class OutcomeContainer(Container): 21 default_width = 327 22 default_height = 202 23 24 def ApplyAttributes(self, attributes): 25 Container.ApplyAttributes(self, attributes) 26 self.jobData = None 27 foregroundCont = Container(bgTexturePath='res:/UI/Texture/Classes/Industry/Output/outputContBg.png', parent=self, align=uiconst.CENTER, width=self.width, height=self.height, state=uiconst.UI_DISABLED) 28 self.bgPattern = Frame(bgParent=foregroundCont, texturePath='res:/UI/Texture/Classes/Industry/Output/bgPattern.png', cornerSize=12) 29 self.captionCont = ContainerAutoSize(name='captionCont', parent=self, align=uiconst.TOPLEFT, pos=(14, 10, 300, 0)) 30 self.outcomeCaption = EveHeaderMedium(name='outcomeCaption', parent=self.captionCont, align=uiconst.TOTOP, text=GetByLabel('UI/Industry/Outcome')) 31 self.outcomeLabel = EveLabelLarge(name='outcomeLabel', parent=self.captionCont, align=uiconst.TOTOP) 32 self.probabilityLabel = EveHeaderSmall(name='probabilityLabel', parent=self.captionCont, align=uiconst.TOTOP, state=uiconst.UI_HIDDEN) 33 self.probabilityLabel.LoadTooltipPanel = self.LoadProbabilityTooltipPanel 34 self.copyInfoCont = Container(name='copyInfoCont', parent=self, align=uiconst.CENTERBOTTOM, pos=(0, 8, 300, 32), state=uiconst.UI_HIDDEN) 35 self.containerME = ContainerME(parent=self.copyInfoCont, align=uiconst.TOPLEFT, width=71, height=30) 36 self.runsPerCopyCont = ContainerAutoSize(name='runsPerCopyCont', parent=self.copyInfoCont, align=uiconst.CENTERTOP) 37 self.containerTE = ContainerTE(parent=self.copyInfoCont, align=uiconst.TOPRIGHT, width=71, height=30) 38 IndustryCaptionLabel(parent=self.runsPerCopyCont, text=localization.GetByLabel('UI/Industry/Runs'), align=uiconst.CENTERTOP) 39 self.bpRunsLabel = EveLabelMedium(parent=self.runsPerCopyCont, align=uiconst.CENTERTOP, top=12) 40 self.errorFrame = ErrorFrame(bgParent=self, padding=1) 41 self.outcomeItem = OutcomeItemContainer(parent=self) 42 FillThemeColored(bgParent=self, opacity=0.5) 43 44 def LoadProbabilityTooltipPanel(self, tooltipPanel, *args): 45 if not self.jobData: 46 return 47 self.tooltipPanel = ProbabilityTooltipPanel(jobData=self.jobData, tooltipPanel=tooltipPanel) 48 49 def AnimEntry(self): 50 if self.jobData: 51 color = GetJobColor(self.jobData) 52 for pattern in (self.bgPattern, self.outcomeCaption): 53 uicore.animations.SpColorMorphTo(pattern, pattern.GetRGBA(), color, duration=0.3) 54 55 self.errorFrame.Hide() 56 57 def UpdateState(self): 58 if self.jobData: 59 self.outcomeLabel.text = self.jobData.GetProductLabel() 60 self.UpdateCopyInfo() 61 if self.jobData.activityID == industry.INVENTION: 62 self.probabilityLabel.Show() 63 color = Color.RGBtoHex(*GetJobColor(self.jobData)) 64 self.probabilityLabel.text = localization.GetByLabel('UI/Industry/SuccessProbabilityPerRun', probability=self.jobData.probability * 100, color=color) 65 else: 66 self.probabilityLabel.Hide() 67 else: 68 self.outcomeLabel.text = '' 69 self.probabilityLabel.Hide() 70 71 def OnNewJobData(self, jobData): 72 self.jobData = jobData 73 self.UpdateState() 74 self.outcomeItem.OnNewJobData(jobData) 75 self.AnimEntry() 76 77 def OnRunsChanged(self): 78 self.UpdateState() 79 80 def UpdateCopyInfo(self): 81 bpData = self.jobData.GetProductNewBlueprint() 82 if not bpData: 83 self.copyInfoCont.Hide() 84 return 85 self.copyInfoCont.Show() 86 self.containerME.SetValue(bpData.materialEfficiency) 87 self.containerTE.SetValue(bpData.timeEfficiency) 88 if bpData.original: 89 self.runsPerCopyCont.Hide() 90 else: 91 self.runsPerCopyCont.Show() 92 self.bpRunsLabel.text = '%s' % bpData.runsRemaining