def GetPercentageLabel(self): percent = self.GetAsPercentage() if isinstance(self, industry.ProbabilityModifier) and self.reference == Reference.BLUEPRINT: return '%.1f%%' % (100.0 + percent) else: color = self.GetModifierColor() if percent > 0: return '<color=%s>+%.1f%%</color>' % (Color.RGBtoHex(*color), percent) return '<color=%s>%.1f%%</color>' % (Color.RGBtoHex(*color), percent)
def GetPercentageLabel(self): percent = self.GetAsPercentage() color = self.GetModifierColor() if percent > 0: return '<color=%s>+%.1f%%</color>' % (Color.RGBtoHex(*color), percent) else: return '<color=%s>%.1f%%</color>' % (Color.RGBtoHex(*color), percent)
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 AddItemRow(panel, materialData): panel.AddCell(MaterialIconAndLabel(materialData=materialData), cellPadding=(0, 0, 0, 3)) available = FormatNumeric(materialData.available, useGrouping=True) quantity = FormatNumeric(materialData.quantity, useGrouping=True) color = industryUIConst.COLOR_NOTREADY if materialData.errors else industryUIConst.COLOR_READY colorHex = Color.RGBtoHex(*color) label = EveLabelMedium(align=uiconst.CENTERRIGHT, text='<color=%s>%s / %s' % (colorHex, available, quantity)) panel.AddCell(label, cellPadding=(8, 0, 0, 3))
def GetLabelText(self): if self._cachedLabel is None: securityStatus, color = sm.GetService('map').GetSecurityStatus( self.markerID, True) self._cachedLabel = '%s <color=%s>%s</color>' % ( cfg.evelocations.Get(self.markerID).name, Color.RGBtoHex(color.r, color.g, color.b), securityStatus) return self._cachedLabel
def GetJobStateLabel(self): if self.status <= industry.STATUS_READY: return self.GetJobTimeLeftLabel() elif self.status == industry.STATUS_DELIVERED: if self.activityID == industry.INVENTION: if self.successfulRuns == 0: return '<color=red>%s' % localization.GetByLabel('UI/Industry/JobFailed') else: return localization.GetByLabel('UI/Industry/PartiallySucceeded', numSucceeded=self.successfulRuns, numTotal=self.runs) return localization.GetByLabel('UI/Industry/Succeeded') elif self.status == industry.STATUS_CANCELLED: color = Color.RGBtoHex(*industryUIConst.COLOR_NOTREADY) return '<color=%s>%s' % (color, localization.GetByLabel('UI/Industry/Cancelled')) elif self.status == industry.STATUS_REVERTED: color = Color.RGBtoHex(*industryUIConst.COLOR_NOTREADY) return '<color=%s>%s' % (color, localization.GetByLabel('UI/Industry/Reverted')) else: return ''
def OnUpdate(self, remaining): color = Color.RGBtoHex(*self.timerData.color) if remaining: self.time.text = FormatTimeInterval(remaining, color, color) self.text.text = localization.GetByLabel(self.timerData.tooltip) if getattr(self.parentTimer, 'fatigueRatio', None): time = FormatTimeInterval( long(remaining * self.parentTimer.fatigueRatio), color, color) self.next.text = localization.GetByLabel( 'UI/Crimewatch/Timers/JumpFatigueNextActivation', time=time)
def GetLabel(self): color = (1.0, 1.0, 1.0, 0.8) if self.skill.points != self.skill.unmodifiedPoints: color = COLOR_MODIFIED text = localization.GetByLabel('UI/SkillTrading/SkillEntryLabel', typeID=self.typeID, level=self.skill.level, rank=self.skill.rank, points=self.skill.points, color=Color.RGBtoHex(*color)) return text
def _UpdateMainText(self): injectorType = invconst.typeSkillInjector points = sm.GetService('skills').GetSkillPointAmountFromInjectors( injectorType, quantity=1) color = Color.RGBtoHex(1.0, 0.8, 0.0, 1.0) text = localization.GetByLabel( 'UI/SkillTrading/InjectorBannerMainText', injector=injectorType, points=points, color=color) self.mainLabel.SetText(text)
def SetValue(self, value): if self.value * (value or 1) < 0.0: self.gauge.SetValueInstantly(0.0) self.value = value if value < 0: self.gauge.SetGaugeAlign(uiconst.TORIGHT_PROP) self.gauge.SetValue(float(value) / self.MINVAL) self.gauge.SetColor(COLOR_NOTREADY) else: self.gauge.SetGaugeAlign(uiconst.TOLEFT_PROP) self.gauge.SetValue(float(value) / self.MAXVAL) self.gauge.SetColor(COLOR_READY) if not self.valueLabel: return if value < 0: self.valueLabel.text = '<color=%s>%s%%' % (Color.RGBtoHex(*COLOR_NOTREADY), value) elif value == 0: self.valueLabel.text = '<color=%s>%s%%' % (Color.RGBtoHex(*COLOR_FRAME), value) else: self.valueLabel.text = '<color=%s>%s%%' % (Color.RGBtoHex(*COLOR_READY), value)
def GetHint(self, *args): hint = '<b>%s</b><br>%s' % ( localization.GetByLabel( industryUIConst.ACTIVITY_NAMES[self.activityID]), localization.GetByLabel( industryUIConst.ACTIVITY_HINTS[self.activityID])) if self.errorFrame.display: colorHex = Color.RGBtoHex(*industryUIConst.COLOR_NOTREADY) hint += '<br><b><color=%s>%s</color></b>' % ( colorHex, localization.GetByLabel('UI/Industry/ActivityNotSupported')) return hint
def UpdateState(self): if self.jobData: self.outcomeLabel.text = self.jobData.GetProductLabel() self.UpdateCopyInfo() if self.jobData.activityID == industry.INVENTION: self.probabilityLabel.Show() color = Color.RGBtoHex(*GetJobColor(self.jobData)) self.probabilityLabel.text = localization.GetByLabel('UI/Industry/SuccessProbabilityPerRun', probability=self.jobData.probability * 100, color=color) else: self.probabilityLabel.Hide() else: self.outcomeLabel.text = '' self.probabilityLabel.Hide()
def GetSolarSystemText(node): solarSystemID = node['solarSystemID'] solarsystemName = cfg.evelocations.Get(solarSystemID).name linkInfo = ('showinfo', invConst.groupSolarSystem, solarSystemID) solarsystemLink = GetByLabel( 'UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=solarsystemName, info=linkInfo) securityStatus, color = sm.GetService('map').GetSecurityStatus( solarSystemID, getColor=True) text = '%s <color=%s>%s</color>' % ( solarsystemLink, Color.RGBtoHex(color.r, color.g, color.b), securityStatus) return text
def LoadTooltipPanel(self, tooltipPanel, *args): typeID, reprocessingYield, stationTaxHint, itemYieldHint, stationEfficiency = self.hintInfo tooltipPanel.LoadGeneric1ColumnTemplate() rowSpan = 1 if self.itemState: rowSpan = 2 subGrid1 = LayoutGrid() icon = Icon(width=64, height=64, align=CENTER) icon.LoadIconByTypeID(typeID=self.typeID, ignoreSize=True) subGrid1.AddCell(icon, rowSpan=rowSpan) yieldText = '<color=%s>%s%%</color>' % (Color.RGBtoHex(*COL_LIGHTBLUE), FmtAmt(reprocessingYield * 100.0, showFraction=1)) topLabel = EveLabelMedium(text=GetByLabel('UI/Reprocessing/ReprocessingWindow/ItemYieldHint', itemName=cfg.invtypes.Get(self.typeID).name, itemYield=yieldText), width=170, autoFitToText=True, left=6, top=4, bold=True) subGrid1.AddCell(topLabel) if self.itemState: hintText = '' hintColor = None if self.itemState == STATE_REPROCESS: hintText = GetByLabel('UI/Reprocessing/ReprocessingWindow/ReprocessedFurtherHint') hintColor = COL_GREEN elif self.itemState == STATE_RESTRICTED: portionSize = GetPortionSize(typeID) if portionSize > self.quantity: noOfItems = FmtAmt(portionSize, showFraction=0) hintText = GetByLabel('UI/Reprocessing/ReprocessingWindow/CannotReprocessHint', noOfItems=noOfItems) else: hintText = GetByLabel('UI/Reprocessing/ReprocessingWindow/CannotReprocessNoValueHint') hintColor = COL_RED elif self.itemState == STATE_SUSPICIOUS: hintText = GetByLabel('UI/Reprocessing/ReprocessingWindow/ReprocessingWarningHint') hintColor = COL_YELLOW stateHint = EveLabelMedium(text=hintText, width=170, autoFitToText=True, left=6, top=4, color=hintColor) subGrid1.AddCell(stateHint) tooltipPanel.AddCell(subGrid1) subGrid = LayoutGrid() subGrid.AddCell(cellPadding=6, colSpan=2) subGrid.AddCell(EveLabelMedium(text=GetByLabel('UI/Reprocessing/ReprocessingWindow/DetailedYieldHint'), color=COL_BLUE, bold=True), colSpan=2) for label in GetReprocessingModifiersAsLabels(typeID, stationEfficiency, stationTaxHint, self.getTypeAttribute, self.getSkillLevel): subGrid.AddCell(label) if itemYieldHint: subGrid.AddCell(cellPadding=6, colSpan=2) subGrid.AddCell(EveLabelMedium(text=GetByLabel('UI/Reprocessing/ReprocessingWindow/YouWillReceiveHint'), color=COL_BLUE, bold=True), colSpan=2) for typeID, qty in itemYieldHint: subGrid.AddCell(EveLabelMedium(text=FmtAmt(qty, showFraction=False), colSpan=1, align=uiconst.TORIGHT, padRight=3, color=COL_LIGHTBLUE, bold=True)) subGrid.AddCell(EveLabelMedium(text='%s' % GetTypeName(typeID), colSpan=1, padLeft=3)) tooltipPanel.AddCell(subGrid)
def LoadTooltipPanel(self, tooltipPanel, *args): tooltipPanel.LoadGeneric1ColumnTemplate() subGrid1 = LayoutGrid() icon = Sprite(width=64, height=64, ignoreSize=True, align=CENTER, texturePath='res:/UI/Texture/Reprocessing/Reprocess.png') subGrid1.AddCell(icon) itemName = self.groupName yieldText = '<color=%s>%s%%</color>' % (Color.RGBtoHex(*COL_LIGHTBLUE), FmtAmt(self.percentage * 100.0, showFraction=1)) topLabel = EveLabelMedium(text=GetByLabel('UI/Reprocessing/ReprocessingWindow/ItemYieldHint', itemName=itemName, itemYield=yieldText), width=170, autoFitToText=True, left=6, top=4, bold=True) subGrid1.AddCell(topLabel) tooltipPanel.AddCell(subGrid1) subGrid = LayoutGrid() l1 = EveLabelMedium(text=GetByLabel('UI/Reprocessing/ReprocessingWindow/ReprocessingCalculations'), color=COL_BLUE, bold=True) subGrid.AddCell(l1, colSpan=2) for label in GetReprocessingModifiersAsLabels(self.groupID, self.stationEfficiency, self.stationTax, self.getTypeAttribute, self.getSkillLevel, avgBonus=self.avgBonus, category=True): subGrid.AddCell(label) tooltipPanel.AddCell(subGrid)