def LoadContent(self, termInfo): self.termHeaderLabel.text = GetByMessageID(termInfo.termTitleID) self.loreTextLabel.text = '<i>%s</i>' % GetByMessageID( termInfo.loreTextID) self.LoadAndWaitForIconSizeChange(termInfo.texturePath) self.longTextEdit.SetValue('<font size=14>%s</font>' % GetByMessageID(termInfo.longTextID))
def AddAttributeCont(self, attribute, parentGrid, attributeID=None): if attributeID is None: attributeID = attribute.attributeID iconSize = 32 attributeCont = self.GetValueCont(iconSize) parentGrid.AddCell(cellObject=attributeCont) icon = Icon(graphicID=attribute.iconID, pos=(3, 0, iconSize, iconSize), hint=attribute.displayName, name=attribute.displayName, ignoreSize=True, state=uiconst.UI_DISABLED) attributeCont.AddCell(cellObject=icon) label = EveLabelMedium(text='', left=0, state=uiconst.UI_DISABLED, align=uiconst.CENTERLEFT) attributeCont.AddCell(cellObject=label) attributeCont.hint = attribute.displayName tooltipTitleID = attribute.tooltipTitleID if tooltipTitleID: tooltipTitle = GetByMessageID(tooltipTitleID) tooltipDescr = GetByMessageID(attribute.tooltipDescriptionID) SetTooltipHeaderAndDescription(targetObject=attributeCont, headerText=tooltipTitle, descriptionText=tooltipDescr) self.statsLabelsByIdentifier[attributeID] = label self.statsIconsByIdentifier[attributeID] = icon self.statsContsByIdentifier[attributeID] = attributeCont return (icon, label, attributeCont)
def LoadCategories(self, categories, *args): self.flowCont.Flush() tempAllTerms = GetTerms() for eachCategorID, eachCategoryInfo in categories.iteritems(): catInfo = eachCategoryInfo['categoryInfo'] categoryNameID = catInfo.groupName categoryName = GetByMessageID(categoryNameID) megaMenuOptions = [] for eachSubGroup in eachCategoryInfo.get('subgroups', []): groupNameID = eachSubGroup.groupName groupName = GetByMessageID(groupNameID) termsInGroup = tempAllTerms.get(eachSubGroup.groupID, []) termsInfoList = [] for eachTerm in termsInGroup: termTitleID = eachTerm.termTitleID termName = GetByMessageID(termTitleID) termsInfoList.append({ 'text': termName, 'callback': self.callback, 'args': eachTerm.termID }) megaMenuGroup = { 'headerInfo': { 'groupName': groupName }, 'entryInfoList': termsInfoList } megaMenuOptions.append(megaMenuGroup) NavigationButtonInWindow( parent=self.flowCont, megaMenuOptions=megaMenuOptions, categoryInfo={'categoryName': categoryName})
def LoadTooltipPanelForTurretsAndLaunchers(self, tooltipPanel, attributeID, counterText): attribute = cfg.dgmattribs.Get(attributeID) headerText = GetByMessageID(attribute.tooltipTitleID) descriptionText = GetByMessageID(attribute.tooltipDescriptionID) tooltipPanel.LoadGeneric2ColumnTemplate() tooltipPanel.AddLabelMedium(text=headerText, bold=True) tooltipPanel.AddLabelMedium(text=counterText, bold=True, align=uiconst.TOPRIGHT, cellPadding=(20, 0, 0, 0)) tooltipPanel.AddLabelMedium(text=descriptionText, wrapWidth=200, colSpan=tooltipPanel.columns, color=(0.6, 0.6, 0.6, 1))
def ApplyAttributes(self, attributes): ContainerAutoSize.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.node = attributes.node self.factionID = self.node.factionID self.shipGroupID = self.node.shipGroupID self.iconsPerRow = self.node.GetIconsPerRow() self.typeIDs = sm.GetService('shipTree').GetShipTypeIDs( self.factionID, self.shipGroupID) self.zoomLevel = sm.GetService('shipTreeUI').GetZoomLevel() self.iconSize = self.node.GetIconSize() nodeNum = attributes.nodeNum self.groupNameLabel = EveHeaderMedium( name='groupNameLabel', parent=self, align=uiconst.TOPLEFT, text=GetByMessageID( cfg.fsdInfoBubbleGroups[self.shipGroupID].nameID), left=43, top=0) self.iconAndBar = ShipGroupIconAndSkillBar(parent=self, top=20, node=self.node) self.shipContainer = ContainerAutoSize(name='shipContainer', parent=self, align=uiconst.TOPLEFT, height=self.iconSize, left=46, top=24) self.LoadShips() self.lineTop = StretchSpriteHorizontal( name='lineTop', parent=self, align=uiconst.TOTOP, texturePath= 'res:/UI/Texture/Classes/ShipTree/Groups/frameUpper.png', leftEdgeSize=4, rightEdgeSize=4, height=3, padTop=16) width = len(self.typeIDs) % self.iconsPerRow or self.iconsPerRow width = self.iconSize * width + 4 self.lineBottom = StretchSpriteHorizontal( name='lineBottom', parent=self, align=uiconst.BOTTOMLEFT, texturePath= 'res:/UI/Texture/Classes/ShipTree/Groups/frameLower.png', leftEdgeSize=4, rightEdgeSize=4, height=1, width=width, left=43, top=-7) self.UpdateState(nodeNum, animate=False) zoomLevel = sm.GetService('shipTreeUI').GetZoomLevel() if zoomLevel == ZOOMED_OUT: self.groupNameLabel.opacity = 0.0 self.lineTop.opacity = 0.0 self.lineBottom.opacity = 0.0
def SetSensorTooltip(self, maxSensor): cont = self.statsContsByIdentifier.get('sensorStrength', None) if cont is not None and cont.tooltipPanelClassInfo is not None: tooltipTitleID = maxSensor.tooltipTitleID if tooltipTitleID: tooltipTitle = GetByMessageID(tooltipTitleID) cont.tooltipPanelClassInfo.headerText = tooltipTitle
def RenderNodeOtherFactionGroup(self, node): left, top = self._GetNodePosition(node) opacity = 0.2 if node.IsLocked() else 1.0 texturePath = shipTreeConst.ICON_BY_FACTIONID.get(node.factionID) size = 64 shipGroupData = cfg.infoBubbleGroups[node.shipGroupID] shipGroupName = GetByMessageID(shipGroupData['nameID']) ButtonIcon( parent=self, texturePath=texturePath, pos=(left - size / 2 + X_OFFSET, top - size / 2 + Y_OFFSET, size, size), iconSize=65, idx=0, func=self.OnOtherFactionClicked, args=(node, ), opacity=opacity, hint='<b>%s</b>\n%s' % (cfg.factions.Get(node.factionID).factionName, shipGroupName))
def AddTypeAndIcon(self, iconSize = 26, minRowSize = 30): self.FillRow() self.AddSpacer(height=minRowSize, width=0) iconID = self.ability.iconID iconCont = Container(pos=(0, 0, iconSize, iconSize), align=uiconst.CENTER) iconObj = Icon(parent=iconCont, pos=(0, 0, iconSize, iconSize), icon=iconID, align=uiconst.TOPLEFT, ignoreSize=True) self.AddCell(iconCont, cellPadding=2) nameColSpan = self.columns - 3 abilityName = GetByMessageID(self.abilityNameID) label = abilityText = '<b>%s</b>' % abilityName labelObj = self.AddLabelMedium(text=label, align=uiconst.CENTERLEFT, cellPadding=self.labelPadding, colSpan=nameColSpan) abilityShortcut = uicore.cmd.GetShortcutStringByFuncName('CmdActivateHighPowerSlot%i' % (self.slotID + 1)) shortcutObj = ShortcutHint(text=abilityShortcut) shortcutObj.width += 10 shortcutObj.padLeft = 10 self.AddCell(shortcutObj) return (iconObj, labelObj)
def RenderNodeOtherFactionGroup(self, node): """ Render an icon representing a prerequisit faction, other than the currently selected one (used in pirate faction trees) """ left, top = self._GetNodePosition(node) opacity = 0.2 if node.IsLocked() else 1.0 texturePath = shipTreeConst.ICON_BY_FACTIONID.get(node.factionID) size = 64 shipGroupData = cfg.fsdInfoBubbleGroups[node.shipGroupID] shipGroupName = GetByMessageID(shipGroupData.nameID) ButtonIcon( parent=self, texturePath=texturePath, pos=(left - size / 2 + X_OFFSET, top - size / 2 + Y_OFFSET, size, size), iconSize=65, idx=0, func=self.OnOtherFactionClicked, args=(node, ), opacity=opacity, hint='<b>%s</b>\n%s' % (cfg.factions.Get(node.factionID).factionName, shipGroupName))
def AddAbilityInfo(self): text = GetByMessageID(self.abilityTooltipID) label = self.AddRowWithText(text)
def UpdateDefensePanel(self, dsp, effectiveHp, effectiveHpColor, multiplyArmor, multiplyResistance, multiplyShieldCapacity, multiplyShieldRecharge, multiplyStructure, xtraArmor, xtraShield, xtraStructure): resMap = {'structure': 'h', 'armor': 'a', 'shield': 's'} for what, attributeID, rechargeAttributeID, hpAddition, hpMultiplier in ( ('structure', dogmaConst.attributeHp, None, xtraStructure, multiplyStructure), ('armor', dogmaConst.attributeArmorHP, None, xtraArmor, multiplyArmor), ('shield', dogmaConst.attributeShieldCapacity, 1, xtraShield, multiplyShieldCapacity)): status = self.GetShipAttribute(attributeID) if not status: continue status = (status + hpAddition) * hpMultiplier dmgGaugeCont = self.statsContsByIdentifier.get(what, None) self.SetDefenseLayerText(hpAddition, hpMultiplier, multiplyShieldRecharge, rechargeAttributeID, status, what) minResistance = 0.0 for i, (dmgType, res) in enumerate([ ('em', 'EmDamageResonance'), ('explosive', 'ExplosiveDamageResonance'), ('kinetic', 'KineticDamageResonance'), ('thermal', 'ThermalDamageResonance') ]): modmod = '%s_%s' % (resMap[what], res.replace('Resonance', 'Resistance')) multiplierMod = multiplyResistance.get(modmod, 0.0) attribute = '%s%s' % ([what, ''][what == 'structure'], res) attribute = attribute[0].lower() + attribute[1:] attributeInfo = self.dogmaLocation.dogmaStaticMgr.attributesByName[ attribute] attributeID = attributeInfo.attributeID value = self.GetShipAttribute(attributeID) if multiplierMod != 0.0: effectiveHpColor = FONTCOLOR_HILITE2 if value is not None: value = value + value * multiplierMod / 100 if dsp.state != uiconst.UI_HIDDEN: if dmgGaugeCont: gaugeText = '<color=%s>' % hex( GetColor2(multiplierMod)) gaugeText += GetByLabel( 'UI/Fitting/FittingWindow/ColoredResistanceLabel', number=100 - int(value * 100)) gaugeText += '</color>' if attributeInfo.tooltipTitleID: tooltipText = GetByMessageID( attributeInfo.tooltipTitleID) else: tooltipText = cfg.dgmattribs.Get( attributeID).displayName info = { 'value': 1.0 - value, 'valueText': gaugeText, 'text': tooltipText, 'dmgType': dmgType } dmgGaugeCont.UpdateGauge(info, animate=True) minResistance = max(minResistance, value) if minResistance: effectiveHp += status / minResistance if hpMultiplier != 1.0 or hpAddition != 0.0: effectiveHpColor = FONTCOLOR_HILITE2 return (effectiveHp, effectiveHpColor)
def ApplyAttributes(self, attributes): InfoBubble.ApplyAttributes(self, attributes) self.node = attributes.node infoBubbleGroup = cfg.fsdInfoBubbleGroups[self.node.shipGroupID] self.caption.text = GetByMessageID(infoBubbleGroup.nameID) Frame(bgParent=self.iconCont, texturePath= 'res:/UI/Texture/Classes/ShipTree/Groups/groupIconFrame.png', opacity=0.15) self.icon = Sprite(name='icon', parent=self.iconCont, pos=(0, 0, 64, 64), align=uiconst.CENTER, texturePath=infoBubbleGroup.iconLarge) self.ConstructElements(infoBubbleGroup.elements) Label(parent=self.mainContent, align=uiconst.TOTOP, text=GetByMessageID(infoBubbleGroup.descriptionID), padTop=5) if self.node.IsRestricted(): TrialRestrictionButton( parent=self.mainContent, align=uiconst.TOTOP, padTop=8, callback=self.OpenSubscriptionPage, message='UI/ShipTree/ShipGroupTrialRestricted') if self.node.IsLocked(): layoutGrid = LayoutGrid(parent=self.mainContent, align=uiconst.TOTOP, padTop=12) cont = Container(align=uiconst.TOPLEFT, height=14, width=self.width - 20) Sprite(parent=cont, pos=(0, -1, 16, 16), texturePath='res:/UI/Texture/classes/inventory/locked.png', align=uiconst.CENTERLEFT, opacity=0.5) caption = InfoBubbleCaption( align=uiconst.CENTERLEFT, parent=cont, text=GetByLabel('UI/ShipTree/SkillsRequiredToUnlock'), left=18, padTop=0) layoutGrid.AddCell(cont, colSpan=2, cellPadding=(0, 0, 0, 2)) for typeID, level in self.node.GetRequiredSkillsSorted(): layoutGrid.AddRow(rowClass=SkillEntry, typeID=typeID, level=level, showLevel=False) trainingTime = self.node.GetTimeToUnlock() if trainingTime > 0: totalTimeText = GetByLabel( 'UI/SkillQueue/Skills/TotalTrainingTime', timeLeft=long(trainingTime)) EveLabelMediumBold(parent=self.mainContent, align=uiconst.TOTOP, padTop=4, text=totalTimeText) else: bonusSkills = self.node.GetBonusSkillsSorted() if bonusSkills: layoutGrid = LayoutGrid(parent=self.mainContent, align=uiconst.TOTOP) caption = InfoBubbleCaption( align=uiconst.TOPLEFT, text=GetByLabel('UI/ShipTree/ShipBonusSkills'), padding=(0, 12, 0, 2), width=self.width - 20) layoutGrid.AddCell(caption, colSpan=2) for typeID, level in bonusSkills: layoutGrid.AddRow(rowClass=SkillEntry, typeID=typeID, level=level, showLevel=False) self.AnimShow() sm.GetService('shipTree').LogIGS('HoverGroup')
def GetScanName(self): if self.dungeonNameID: dungeonName = GetByMessageID(self.dungeonNameID) return (self.dungeonNameID, dungeonName) return (None, '')
def _AddAbilityHeader(self, contentList, ability): headerEntry = listentry.Get('Header', {'label': GetByMessageID(ability.displayNameID)}) contentList.append(headerEntry)