def Load(self): self.Flush() topCont = ContainerAutoSize(parent=self, align=uiconst.TOTOP, padding=(0, 2, 0, 2)) btnGroup = ToggleButtonGroup(parent=topCont, align=uiconst.CENTER, height=38, width=248, callback=self.LoadActivity) for activityID in industry.ACTIVITIES: isDisabled = activityID not in self.bpData.activities color = industryUIConst.GetActivityColor(activityID) color = color[:3] + (0.5, ) btnGroup.AddButton( activityID, iconPath=industryUIConst.ACTIVITY_ICONS_LARGE[activityID], iconSize=26, colorSelected=color, isDisabled=isDisabled, btnClass=ActivityToggleButtonGroupButton, activityID=activityID) self.activityNameLabel = EveLabelMediumBold(name='label', parent=self, align=uiconst.TOTOP, padding=(6, 0, 0, 0)) self.scroll = Scroll(parent=self, padding=const.defaultPadding) activityID = self.GetSelectedActivityID(activityID) btnGroup.SelectByID(activityID)
def UpdateState(self, *args): activityType = industryUIConst.GetActivityType(self.jobData.activityID) changed = self.activityType != activityType self.activityType = activityType if changed: uicore.animations.FadeOut(self, sleep=True, duration=0.1) if self.activityType == industryUIConst.MANUFACTURING: self.countCaption.text = localization.GetByLabel( 'UI/Industry/ManufacturingJobs') else: self.countCaption.text = localization.GetByLabel( 'UI/Industry/ScienceJobs') color = Color.RGBtoHex( *industryUIConst.GetActivityColor(self.activityType)) self.countLabel.text = '%s / <color=%s>%s</color>' % ( self.jobData.used_slots, color, self.jobData.max_slots) skillLabel = industryUIConst.GetControlRangeLabel( self.jobData.max_distance) self.rangeLabel.text = '<color=%s>%s' % (color, skillLabel) if changed: uicore.animations.FadeIn(self, duration=0.3) if self.jobData and self.jobData.HasError(industry.Error.SLOTS_FULL): self.slotsErrorFrame.Show() else: self.slotsErrorFrame.Hide() if self.jobData and self.jobData.HasError( industry.Error.FACILITY_DISTANCE): self.rangeErrorFrame.Show() else: self.rangeErrorFrame.Hide()
def ReconstructButtons(self): if self.btnGroup: self.btnGroup.Close() self.btnGroup = ToggleButtonGroup(name='myToggleBtnGroup', parent=self, align=uiconst.TOALL, callback=self.OnActivitySelected, height=0) for activityID in ACTIVITIES: isDisabled = self.jobData is None or activityID not in self.jobData.blueprint.activities color = industryUIConst.GetActivityColor(activityID) color = Color(*color).SetBrightness(0.5).GetRGBA() btn = self.btnGroup.AddButton( activityID, iconPath=industryUIConst.ACTIVITY_ICONS_LARGE[activityID], iconSize=26, colorSelected=color, isDisabled=isDisabled, btnClass=ActivityToggleButtonGroupButton, activityID=activityID)
def AddColumnActivities(self): col = self.AddColumnContainer() ICONSIZE = 20 if self.viewMode == VIEWMODE_ICONLIST else 14 for i, activityID in enumerate(ACTIVITIES): isEnabled = activityID in self.bpData.activities hint = ACTIVITY_NAMES.get( activityID ) if isEnabled else 'UI/Industry/ActivityNotAvailable' btn = ActivityButtonIcon( parent=col, align=uiconst.CENTERLEFT, pos=(6 + i * (ICONSIZE + 4), 0, ICONSIZE + 4, ICONSIZE + 4), texturePath=ACTIVITY_ICONS_SMALL[activityID], iconSize=ICONSIZE, func=self.OnActivityBtn, args=(activityID, self.bpData), hint=localization.GetByLabel(hint), isHoverBGUsed=True, colorSelected=industryUIConst.GetActivityColor(activityID)) self.activityButtons.append(btn) if not isEnabled: btn.Disable(opacity=0.05) return col
def PlayVideoDelivered(self): self.PlayVideo('res:/video/Industry/deliveredIntro.bk2', 'res:/video/Industry/deliveredOutro.bk2', industryUIConst.GetActivityColor(self.jobData.activityID))