def ColorPowerCore(self, powerUnits, loadBalance, TTL): badColor = self.ScaleColor(BAD_COLOR, 1.0 - loadBalance) goodColor = self.ScaleColor(GOOD_COLOR, loadBalance) visible = max(0, min(len(powerUnits), int(loadBalance * len(powerUnits)))) for cellIdx, each in enumerate(powerUnits): if cellIdx >= visible: each.SetRGB(*EMPTY_COLOR) else: r = badColor.r + goodColor.r g = badColor.g + goodColor.g b = badColor.b + goodColor.b each.SetRGB(r, g, b, 1.0) if loadBalance == 0: hint = GetByLabel('UI/Fitting/FittingWindow/CapRunsOutBy', ttl=TTL) else: hint = GetByLabel('UI/Fitting/FittingWindow/CapSustainableBy', balance=loadBalance * 100) self.hint = hint
def ShowMyMedals(self, charID=None): self.mainAreaButtons.Hide() if charID is None: charID = session.charid if self.decoMedalList is None: self.decoMedalList = GetMedalScrollEntries(charID) self.scroll.sr.id = 'charsheet_mymedals' self.scroll.Load( contentList=self.decoMedalList, noContentHint=GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/DecoTabs/NoMedals'))
def UpdateCalibration(self): calibrationLoad = self.controller.GetCalibrationLoad() calibrationOutput = self.controller.GetCalibrationOutput() self.calibration_statustext.text = GetByLabel( 'UI/Fitting/FittingWindow/CalibrationStatusText', calibrationLoad=calibrationOutput.value - calibrationLoad.value, calibrationOutput=calibrationOutput.value, startColorTag1='<color=%s>' % hex(GetXtraColor2(calibrationLoad.diff)), startColorTag2='<color=%s>' % FONTCOLOR_DEFAULT, endColorTag='</color>')
def LoadFighterToSquadron(self, typeID): if typeID == self.typeID: return self.typeID = typeID self.fighterIcon.LoadIconByTypeID(typeID=typeID) self.squadronMaxSize = GetMaxSquadronSize(self.typeID) roleTexturePath = GetSquadronRoleResPath(self.typeID) self.classIcon.LoadTexture(roleTexturePath) hintString = HINTTEXT_BY_ROLE[GetSquadronRole(self.typeID)] self.classIcon.hint = GetByLabel(hintString) self.UpdateHint()
def SetText(self, systemStations): solarSystemName = GetShowInfoLink(const.typeSolarSystem, cfg.evelocations.Get(self.solarSystemID).name, self.solarSystemID) now = blue.os.GetWallclockTime() timeUntilAuto = FormatTimeIntervalShortWritten(long(max(0, self.autoDeliveryTimestamp - now))) nearestNPCStationText = GetShowInfoLink(self.nearestNPCStationInfo['typeID'], self.nearestNPCStationInfo['name'], self.nearestNPCStationInfo['itemID']) stationsInSystem = len(systemStations) if self.manualDeliveryTimestamp - now < 0: if stationsInSystem: path = 'UI/Inventory/AssetSafety/DeliveryExplanationText' else: path = 'UI/Inventory/AssetSafety/DeliveryExplanationTextNoStations' text = GetByLabel(path, solarSystemName=solarSystemName, npcStationName=nearestNPCStationText, timeUntil=timeUntilAuto) else: timeUntilManual = FormatTimeIntervalShortWritten(long(max(0, self.manualDeliveryTimestamp - now))) if stationsInSystem: path = 'UI/Inventory/AssetSafety/DeliveryNotAvailableNowExplanationText' else: path = 'UI/Inventory/AssetSafety/DeliveryNotAvailableTextNoStations' text = GetByLabel(path, solarSystemName=solarSystemName, timUntilManualDelivery=timeUntilManual, npcStationName=nearestNPCStationText, timeUntilAutoDelivery=timeUntilAuto) self.explanationLabel.text = text
def GetNodesToUpdate(self): nodesToUpdate = [] try: sm.GetService('loading').Cycle(GetByLabel('UI/Common/PreparingToUpdate')) nodesToUpdate.extend(self.GetNodesList(self.accessScroll.GetNodes())) nodesToUpdate.extend(self.GetNodesList(self.roleScroll.GetNodes())) nodesToUpdate.extend(self.GetNodesList(self.titlesScroll.GetNodes())) finally: sm.GetService('loading').StopCycle() return nodesToUpdate
def AddStation(self, station, buttonIsDisabled): parent = self.sameSolarSystem container = ContainerAutoSize(parent=parent, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN, bgColor=(0.2, 0.2, 0.2, 0.3)) container.DisableAutoSize() label = GetShowInfoLink(station['typeID'], station['name'], station['itemID']) EveLabelMediumBold(parent=container, height=30, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, text=label, padding=(7, 8, 140, 5)) btn = Button(parent=container, label=GetByLabel('UI/Inventory/AssetSafety/DeliverBtn'), align=uiconst.CENTERRIGHT, fontsize=13, fixedwidth=140, fixedheight=25, pos=(5, 0, 0, 0), func=self.DoDeliver, args=station['itemID']) if buttonIsDisabled: btn.Disable() Line(parent=parent, align=uiconst.TOTOP, color=self.LINE_COLOR) container.EnableAutoSize()
def GetSkillBonusesAsLabels(typeID, getTypeAttribute, getSkillLevel, category = False): """ Takes in int: typeID and funcs: getTypeAttribute, getSkillLevel. Additionally can take in bool: category for handling group tooltips. Generates and returns a list of labels based on implants that affect reprocessing. """ skillLabels = [] if not category: skillBonuses = GetSkillFromTypeID(typeID, getTypeAttribute, getSkillLevel) else: skillBonuses = GetSkillFromCategoryID(typeID, getTypeAttribute, getSkillLevel) for skillType, bonus in skillBonuses: skillName = GetTypeName(skillType) labelOpacity = 0.35 if bonus > 0: labelOpacity = 0.75 skillLabels.append(EveLabelMedium(text=GetByLabel('UI/Reprocessing/ReprocessingWindow/YieldFormatting', bonusYield=1.0 + bonus / 100), colSpan=1, align=uiconst.TORIGHT, padRight=3, color=COL_GREEN, bold=True, opacity=labelOpacity)) skillLabels.append(EveLabelMedium(text=GetByLabel('UI/Reprocessing/ReprocessingWindow/BonusFromSkill', skillName=skillName), colSpan=1, padLeft=3, opacity=labelOpacity)) return skillLabels
def DisplayWarningIfNeeded(self, failedInfo): if failedInfo: warningLabelList = GetTextForWarning(failedInfo) textList = [] for label, kwargs in warningLabelList: textForGroup = GetByLabel(label, **kwargs) textList.append(textForGroup) warningText = '<br><br>'.join(textList) if warningText: eve.Message('CustomInfo', {'info': warningText}, modal=False)
def AutoSaveBio(self): newbio = self.edit.GetValue() defaultBioString = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/BioEdit/HereYouCanTypeBio') newbio = newbio.replace(defaultBioString, '') if not len(StripTags(newbio)): newbio = '' self.bioClient = newbio if newbio.strip() != self.bioServer: uthread.new(self._AutoSaveBio, newbio) self.bioServer = newbio
def GetDeltaText(self, delta): if delta < 0: color = '<color=0xffff5050>' else: color = '<color=0xff00ff00>' if abs(delta) < 1.0: showFraction = 1 else: showFraction = 0 deltaText = '%s%s</color>' % (color, GetByLabel('UI/Common/Percentage', percentage=FmtAmt(delta * 100, showFraction=showFraction))) return deltaText
def GetLocNames(self, locIDs): locNames = [] destroyedLocString = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/JumpCloneScroll/CloneLocationDestroyed' ) destroyedLocName = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/JumpCloneScroll/DestroyedLocation' ) for locID in locIDs: if locID in cfg.evelocations: locName = cfg.evelocations.Get(locID).name locString = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/JumpCloneScroll/CloneLocation', cloneLocation=locID) else: locName = destroyedLocName locString = destroyedLocString locNames.append((locName, locString, locID)) return locNames
def GetColumnMinSize(cls, node, columnID): fixed = cls.GetFixedColumns() if columnID in fixed: return fixed[columnID] minSizes = cls.GetColumnsMinSize() minSize = minSizes[columnID] text = None if columnID == GetByLabel('UI/Common/LocationTypes/System'): text = cls.GetSolarSystemText(node) elif columnID == GetByLabel('UI/Common/LocationTypes/Constellation'): text = cls.GetConstellationText(node) elif columnID == GetByLabel('UI/Common/LocationTypes/Region'): text = cls.GetRegionText(node) elif columnID == GetByLabel('UI/Common/Jumps'): text = cls.GetJumpText(node) if text: textWidth, textHeight = EveLabelMedium.MeasureTextSize(text) width = textWidth + cls.COLUMN_PADLEFT + cls.COLUMN_PADRIGHT return max(minSize, width) return minSize
def UpdateStatusUI(self, tubeStatus): stateText = LABEL_BY_STATE[tubeStatus.statusID] self.tubeStatusLabel.text = GetByLabel(stateText) if self.ShouldShowStationUI(): stateColor = Color(*COLOR_OPEN) else: stateColor = Color(*COLOR_BY_STATE[tubeStatus.statusID]) self.leftTube.SetRGBA(*stateColor.GetRGBA()) self.rightTube.SetRGBA(*stateColor.GetRGBA()) stateColor.a = 0.8 self.tubeStatusLabel.SetTextColor(stateColor.GetRGBA())
def AddBuyButton(parent, fittingMgmtWnd): from eve.client.script.ui.control.buttons import Button def CallBuyFit(): fitting = fittingMgmtWnd.fitting BuyFit(fitting.shipTypeID, fitting.fitData) buyBtn = Button(parent=parent, label=GetByLabel('UI/Market/MarketQuote/BuyAll'), func=lambda *args: CallBuyFit(), align=uiconst.NOALIGN)
def ApplyAttributes(self, attributes): InfoPanelBase.ApplyAttributes(self, attributes) self.settingsObject = None self.titleLabel = self.headerCls( name='title', text='<color=white>' + GetByLabel('UI/Achievements/InfoPanelHeader'), parent=self.headerCont, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED) self.headerButton.OnMenuClosed = self.OnSettingsMenuClosed
def Load(self): scrollList = GetAssetSafetyScrollContent(self.assetSafetyController) headers = AssetSafetyEntry.GetHeaders() self.assetSafetyScroll.sr.minColumnWidth = AssetSafetyEntry.GetMinimumColWidth( ) self.assetSafetyScroll.sr.defaultColumnWidth = AssetSafetyEntry.GetDefaultColumnWidth( ) self.assetSafetyScroll.Load( contentList=scrollList, headers=headers, noContentHint=GetByLabel('UI/Corporations/Assets/NoItemsFound')) self.updateCounter = AutoTimer(1000, self.UpdateCounters_thread)
def LoadTreeLink(self): buttonContainer = ContainerAutoSize(parent=self.mainContent, align=uiconst.TOTOP) textButton = IconTextButton( parent=buttonContainer, align=uiconst.TOPRIGHT, label=GetByLabel('Achievements/UI/showAll'), texturePath= 'res:/ui/Texture/Classes/InfoPanels/opportunitiesTreeIcon.png', func=self.OpenOpportunitiesTree, iconSize=16, top=10)
def DrawCheckBox(self, corpAcctName): useCorpWallet = settings.user.ui.Get(self.tradeForCorpSettingConfig, False) top = self.corpCheckboxTop self.useCorp = Checkbox(text=GetByLabel( 'UI/Market/MarketQuote/UseCorpAccount', accountName=corpAcctName), parent=self.bottomLeft, configName='usecorp', checked=useCorpWallet, callback=self.OnUseCorp, pos=(0, top, 350, 0), align=uiconst.TOPLEFT)
def AddOwnerCombo(self): ownerOptions = [(GetByLabel('UI/Industry/AllFacilities'), browserUIConst.OWNER_ANY), (GetByLabel('UI/Industry/PublicFacilities'), browserUIConst.OWNER_NPC, None, 'res:/UI/Texture/Classes/Inventory/readOnly.png'), (GetByLabel('UI/Industry/CorpOwnedFacilities'), browserUIConst.OWNER_CORP, None, 'res:/UI/Texture/Classes/Industry/iconCorp.png')] selected = self.controller.GetStructureOwnerValue() self.ownerCombo = Combo(name='ownerCombo', parent=self, align=uiconst.CENTERLEFT, prefsKey='StructureBrowserOwner', callback=self.ChangeStructureOwnerFilter, options=ownerOptions, select=selected, padRight=4, top=-2, left=self.uiLeft) self.uiLeft = self.ownerCombo.left + self.ownerCombo.width + 10
def BuildAvailableShipsUI(self): self.shipCounter = EveCaptionMedium(name='shipCounter', parent=self.missingLayoutGrid, state=uiconst.UI_NORMAL, align=uiconst.CENTERRIGHT, left=4) self.shipCounter.LoadTooltipPanel = self.LoadShipCounterTooltipPanel self.shipCounter.missingDict = {} shipText = GetByLabel( 'UI/Fitting/FittingWindow/FittingManagement/PackagedShipsInHangar') self.availableShipsLabel = EveLabelLarge(name='availableShipsLabel', parent=self.missingLayoutGrid, state=uiconst.UI_NORMAL, text=shipText, align=uiconst.CENTERLEFT, width=MAX_TEXT_WIDTH, autoFitToText=True) self.availableShipsLabel.hint = GetByLabel( 'UI/Fitting/FittingWindow/FittingManagement/PackagedShipsInHangarHint' ) self.layoutGrid.FillRow()
def DrawDurationCombo(self): durations = [[GetByLabel('UI/Market/MarketQuote/Immediate'), 0], [GetByLabel('UI/Common/DateWords/Day'), 1], [GetByLabel('UI/Market/MarketQuote/ThreeDays'), 3], [GetByLabel('UI/Common/DateWords/Week'), 7], [GetByLabel('UI/Market/MarketQuote/TwoWeeks'), 14], [GetByLabel('UI/Common/DateWords/Month'), 30], [GetByLabel('UI/Market/MarketQuote/ThreeMonths'), 90]] durationValue = settings.user.ui.Get(self.durationSettingConfig, 0) self.durationCombo = Combo(parent=self.bottomLeft, options=durations, select=durationValue, top=6, callback=self.OnDurationChange)
def GetDeltaText(self): price = self.GetPrice() percentage = (price - self.averagePrice) / self.averagePrice if percentage < 0: color = '<color=0xffff5050>' else: color = '<color=0xff00ff00>' percText = '%s%s</color>' % ( color, GetByLabel('UI/Common/Percentage', percentage=FmtAmt(percentage * 100, showFraction=1))) return percText
def SetUndockProgress(self, undockProgress): if undockProgress is None: self.UpdateUndockButton() return i = int(undockProgress * 3) if i < 3: self.UpdateUndockButton() self.undockBtn.AnimateArrow(arrowIdx=i) else: text = '<center>%s</center>' % GetByLabel( 'UI/Station/UndockingConfirmed') self.undockBtn.StartConfirmedAnimation()
def AddFilterBox(self): text = self.controller.GetTextFilter() self.filterEdit = QuickFilterEdit( name='searchField', parent=self, hinttext=GetByLabel('UI/Inventory/Filter'), maxLength=64, align=uiconst.CENTERRIGHT, OnClearFilter=self.OnFilterEditCleared, padRight=4, text=text) self.filterEdit.ReloadFunction = self.OnFilterEdit
def GetFittingEntry(self, typeID, quantity, isCharge = False): itemName = cfg.invtypes.Get(typeID).name if quantity > 1: label = GetByLabel('UI/InfoWindow/FittingItemLabelWithQuantity', quantity=quantity, itemName=itemName) else: label = itemName data = {'typeID': typeID, 'label': label, 'getIcon': True, 'indentLevel': 1 if isCharge else 0} entry = listentry.Get(decoClass=FittingItemEntry, data=data) return entry
def GetExportImportMenu(self, menuParent, *args): if boot.region != 'optic': text = GetByLabel( 'UI/Fitting/FittingWindow/FittingManagement/ImportFromClipboard' ) hint = GetByLabel( 'UI/Fitting/FittingWindow/FittingManagement/ImportFromClipboardHint' ) menuParent.AddIconEntry( icon=ACTION_ICON, text=text, hint=hint, callback=sm.GetService( 'fittingSvc').ImportFittingFromClipboard) menuParent.AddDivider() menuParent.AddIconEntry(icon=ACTION_ICON, text=GetByLabel('UI/Commands/Import'), callback=self.ImportFittings) menuParent.AddIconEntry(icon=ACTION_ICON, text=GetByLabel('UI/Commands/Export'), callback=self.ExportFittings)
def GetOptionList(self, uniqueSchedules): schedulesWithSameHours = uniqueSchedules.get(self.requiredHours, None) if not schedulesWithSameHours: return [] schedulesAndNumUsed = schedulesWithSameHours[:] schedulesAndNumUsed.sort(key=lambda x: x[0], reverse=True) optionList = [] for numUse, schedule in schedulesAndNumUsed: inUseText = GetByLabel('UI/StructureSettings/AssignedToNumStructures', numStructures=numUse) optionList += [(inUseText, int(schedule))] return optionList
def ChangeSubTextCont(self, groupIsExpanded): if groupIsExpanded: self.backSprite.display = True self.subTextLabel.left = 20 self.subTextLabel.text = GetByLabel( 'UI/Achievements/InfoPanelShowAllCategories') self.subTextLabel.state = uiconst.UI_NORMAL else: self.backSprite.display = False self.subTextLabel.left = 0 self.subTextLabel.text = self.GetCompletedText() self.subTextLabel.state = uiconst.UI_DISABLED
def _AddAgentPanel(self): self.agentsPanel = Container(name=AGENTSPANEL, parent=self.sr.main, padding=const.defaultPadding) self.agentFinderBtn = Button( label=GetByLabel('UI/AgentFinder/AgentFinder'), parent=self.agentsPanel, align=uiconst.CENTERTOP, func=uicore.cmd.OpenAgentFinder) self.agentScroll = Scroll(parent=self.agentsPanel, padTop=const.defaultPadding + self.agentFinderBtn.height)