def AddGaugeAndIconToContainer(self, container, damageType, color): iconCont = Container(parent=container, name='iconCont', width=self.iconSize, align=uiconst.TOLEFT, state=uiconst.UI_DISABLED) icon = Icon(parent=iconCont, pos=(0, 0, self.iconSize, self.iconSize), align=uiconst.CENTERLEFT, idx=0, ignoreSize=True, state=uiconst.UI_DISABLED) if not self.showIcon: iconCont.display = False gauge = Gauge(parent=container, name='gauge_%s' % damageType, value=0.0, color=color, gaugeHeight=self.gaugeHeight, align=uiconst.TOALL, pos=(0, self.gaugeTopOffset, 0, 0), state=uiconst.UI_DISABLED, gradientBrightnessFactor=1.5) container.gauge = gauge container.icon = icon setattr(self, 'gauge_%s' % damageType, gauge)
def BuildTopParentUI(self): self.sr.topParent.padding = (2 * const.defaultPadding, 0, 2 * const.defaultPadding, 0) self.shipIcon = Icon(name='shipIcon', parent=self.sr.topParent, state=uiconst.UI_NORMAL, size=64, ignoreSize=True) self.shipIcon.GetDragData = self.GetFittingDragData self.shipIcon.OnClick = self.OpenFitting self.shipIcon.hint = GetByLabel('UI/Fitting/ShowFitting') self.techSprite = Sprite(name='techIcon', parent=self.sr.topParent, align=uiconst.RELATIVE, width=16, height=16, idx=0) self.fitNameEdit = SinglelineEdit( name='fitNameEdit', parent=self.sr.topParent, left=72, width=150, maxLength=20, hint=GetByLabel('UI/Common/ShipName')) top = self.fitNameEdit.top + self.fitNameEdit.height + 5 self.shipNameLabel = EveLabelMedium(name='shipNameLabel', parent=self.sr.topParent, left=77, top=top, state=uiconst.UI_NORMAL)
def CreateCurrentShipCont(self): self.shipCont.Flush() Frame(parent=self.shipCont, color=(1, 1, 1, 0.1)) activeShip = GetActiveShip() clientDogmaLocation = sm.GetService('clientDogmaIM').GetDogmaLocation() shipDogmaItem = clientDogmaLocation.GetShip() shipTypeID = shipDogmaItem.typeID icon = Icon(parent=self.shipCont, pos=(0, 0, 40, 40), ignoreSize=True, state=uiconst.UI_DISABLED) if self.fittingSvc.IsShipSimulated(): self.shipCont.OnClick = self.ExitSimulation icon.LoadIconByTypeID(shipTypeID) else: self.shipCont.OnClick = self.LoadCurrentShip hologramTexture = inventorycommon.typeHelpers.GetHoloIconPath( shipTypeID) icon.LoadTexture(hologramTexture) shipName = cfg.evelocations.Get(activeShip).name text = '%s<br>%s' % (evetypes.GetName(shipTypeID), shipName) self.shipnametext = EveLabelMedium(text=text, parent=self.shipCont, align=uiconst.TOTOP, top=2, padLeft=48)
def DrawItem(self): iconCont = Container(name='iconCont', parent=self.textCont, align=uiconst.TOLEFT, width=32, padding=4) iconInnerCont = Container(name='iconInnerCont', parent=iconCont, align=uiconst.CENTER, pos=(0, 0, 32, 32)) self.wheel = LoadingWheel(parent=iconCont, pos=(0, 0, 48, 48), align=uiconst.CENTER, idx=0) self.wheel.display = False self.techIcon = Sprite(parent=iconInnerCont, pos=(0, 0, 16, 16), align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL) GetTechLevelIcon(self.techIcon, 1, self.typeID) self.icon = Icon(parent=iconInnerCont, typeID=self.typeID, state=uiconst.UI_DISABLED, align=uiconst.CENTER) self.icon.SetSize(32, 32) itemName = GetShowInfoLink(typeID=self.typeID, text=evetypes.GetName(self.typeID)) self.itemNameLabel = Label(text=itemName, parent=self.textCont, left=40, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, autoFadeSides=35, fontsize=12)
def SetStatus(self, cont, iconPath=None): cont.Flush() if iconPath: Icon(icon=iconPath, parent=cont, align=uiconst.CENTER, pos=(0, 0, 16, 16))
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.isSelected = False self.typeID = attributes.typeID self.invType = cfg.invtypes.Get(self.typeID) typeName = self.invType.name self.quantity = attributes.quantity self.stacksize = attributes.get('stacksize', None) self.itemState = attributes.get('itemState', None) singleton = attributes.get('singleton', 0) isBlueprint = cfg.invtypes.Get(self.typeID).categoryID == const.categoryBlueprint isCopy = isBlueprint and singleton == const.singletonBlueprintCopy self.stateIcon = None self.spriteCont = self.spriteCont = Container(name='spriteCont', parent=self, align=CENTER, width=ICON_SIZE, height=ICON_SIZE, state=uiconst.UI_PICKCHILDREN) self.icon = Icon(name=typeName, parent=self.spriteCont, width=ICON_SIZE, height=ICON_SIZE, align=CENTER, state=uiconst.UI_DISABLED, saturation=1.0, effectOpacity=0.0, spriteEffect=trinity.TR2_SFX_SOFTLIGHT) self.icon.LoadIconByTypeID(typeID=self.typeID, ignoreSize=True, isCopy=isCopy) self.hint = typeName self.techIcon = Sprite(name='techIcon', parent=self.spriteCont, width=16, height=16, idx=0, saturation=1.0, effectOpacity=0.0, spriteEffect=trinity.TR2_SFX_SOFTLIGHT) uix.GetTechLevelIcon(self.techIcon, 0, self.typeID) if self.itemState: resPath, stateColor = self.GetStateResPathAndColor(self.itemState) self.stateIcon = Sprite(name='stateIcon', parent=self.spriteCont, width=32, height=32, idx=0, left=-4, top=-4, align=uiconst.TOPRIGHT, texturePath=resPath, color=stateColor, state=uiconst.UI_DISABLED) self.entryHilite = Sprite(name='hilite', align=uiconst.TOALL, parent=self.spriteCont, texturePath='res:/UI/Texture/classes/InvItem/bgHover.png', blendMode=trinity.TR2_SBM_ADD, opacity=0.0, idx=0, state=uiconst.UI_DISABLED) self.entryHilite.hint = typeName self.quantityParent = Container(parent=self, idx=0, name='qtyCont', pos=(3, 38, 32, 11), align=uiconst.TOPRIGHT, bgColor=(0, 0, 0, 0.95), state=uiconst.UI_HIDDEN) self.qtyLabel = Label(parent=self.quantityParent, left=2, maxLines=1, fontsize=9) self._SetQtyText()
def DrawItem(self): iconCont = Container(parent=self.textCont, align=uiconst.TOLEFT, width=32, padding=4) self.iconInnerCont = Container(name='iconInnerCont', parent=iconCont, align=uiconst.CENTERLEFT, pos=(0, 0, 32, 32)) self.wheel = LoadingWheel(parent=self.iconInnerCont, pos=(0, 0, 48, 48), align=uiconst.CENTER, idx=0) self.wheel.display = False self.techIcon = Sprite(parent=self.iconInnerCont, pos=(0, 0, 16, 16), align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL) self.icon = Icon(parent=self.iconInnerCont, typeID=self.typeID, state=uiconst.UI_DISABLED, ignoreSize=True, pos=(0, 0, 32, 32)) GetTechLevelIcon(self.techIcon, 1, self.typeID) itemName = GetByLabel('UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=self.itemName, info=('showinfo', self.typeID, self.item.itemID)) self.itemNameLabel = Label(text=itemName, parent=self.textCont, left=40, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, autoFadeSides=35, fontsize=12)
def AddIconCell(self, texturePath = None, iconID = None, iconSize = 24): icon = Icon(pos=(0, 0, iconSize, iconSize), align=uiconst.CENTER, ignoreSize=True, state=uiconst.UI_DISABLED, icon=texturePath or iconID) self.AddCell(icon) return icon
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.jobData = attributes.jobData self.videoThread = None self.iconCont = Container(name='iconCont', parent=self, align=CENTER, state=uiconst.UI_NORMAL, width=64, height=64) self.errorFrame = ErrorFrame(parent=self, align=uiconst.CENTER, pos=(0, 0, 64, 64), state=uiconst.UI_HIDDEN) self.qtyLabel = EveLabelLargeBold(parent=self, align=CENTER, top=42) FrameThemeColored(name='bgVignette', parent=self, texturePath='res:/UI/Texture/Classes/Industry/Output/bgVignette.png', cornerSize=30) self.videoCont = Container(name='videoCont', parent=self, align=uiconst.CENTER, width=324, height=199) self.previewContFill = FillThemeColored(parent=self) self.previewCont = PreviewContainer(parent=self, align=uiconst.TOALL, state=uiconst.UI_HIDDEN) self.leftProbabilityGradient = GradientSprite(name='leftProbabilityGradient', parent=self, align=uiconst.CENTERLEFT, state=uiconst.UI_HIDDEN, pos=(0, 0, 160, 64), rgbData=((0, (1.0, 1.0, 1.0)),), alphaData=((0.0, 0.5), (1.0, 0.0))) self.rightProbabilityGradient = GradientSprite(name='rightProbabilityGradient', parent=self, align=uiconst.CENTERRIGHT, state=uiconst.UI_HIDDEN, pos=(0, 0, 160, 64), rgbData=((0, (1.0, 1.0, 1.0)),), alphaData=((0.0, 0.0), (1.0, 0.5))) self.previewCont.navigation.LoadTooltipPanel = self.LoadIconContTooltipPanel self.previewCont.navigation.GetTooltipDelay = self.GetIconContTooltipDelay self.previewCont.navigation.GetMenu = self.GetMenu self.iconCont.LoadTooltipPanel = self.LoadIconContTooltipPanel self.iconCont.GetTooltipDelay = self.GetIconContTooltipDelay self.iconCont.OnMouseEnter = self.OnIconContMouseEnter self.iconCont.OnMouseExit = self.OnIconContMouseExit self.iconCont.OnClick = self.OnIconContClick self.iconCont.GetMenu = self.GetMenu self.iconCont.GetDragData = self.GetIconContDragData self.iconCont.isDragObject = True self.techIcon = Sprite(name='techIcon', parent=self.iconCont, width=16, height=16) self.icon = Icon(parent=self.iconCont, align=CENTER, state=uiconst.UI_DISABLED) self.bgCont = Container(name='bgCont', parent=self, align=uiconst.CENTER, width=201, height=192) self.bg = Sprite(bgParent=self.bgCont, texturePath='res:/UI/Texture/Classes/Industry/Output/itemBg.png') self.itemPattern = Sprite(bgParent=self.bgCont, texturePath='res:/UI/Texture/Classes/Industry/Output/itemBgColor.png') self.UpdateState() self.AnimEntry()
def SetHeaderIcon(self, iconNo='ui_73_16_50', shiftLabel=12, hint=None, size=16): par = self.sr.captionParent if self.sr.headerIcon: self.sr.headerIcon.Close() self.sr.headerIcon = None if iconNo is None: if self.sr.caption: self.sr.caption.left = 8 else: self.sr.headerIcon = Icon(icon=iconNo, parent=par, pos=(4, 0, size, size), align=uiconst.RELATIVE, ignoreSize=True) self.sr.headerIcon.SetAlpha(0.8) self.sr.headerIcon.OnMouseEnter = self.HeaderIconMouseEnter self.sr.headerIcon.OnMouseExit = self.HeaderIconMouseExit self.sr.headerIcon.expandOnLeft = 1 if self.sr.caption: self.sr.caption.left = 8 + shiftLabel self.headerIconNo = iconNo self.headerIconHint = hint if self.sr.tab: self.sr.tab.SetIcon(iconNo, 14, hint)
def AddColumnBlueprintLabel(self): col = self.AddColumnContainer() texturePath, hint = uix.GetTechLevelIconPathAndHint( self.jobData.blueprint.blueprintTypeID) if texturePath: techIconSize = 16 if self.viewMode == VIEWMODE_ICONLIST else 12 Sprite(name='techIcon', parent=col, texturePath=texturePath, hint=hint, width=techIconSize, height=techIconSize) if self.viewMode == VIEWMODE_ICONLIST: iconSize = 32 Icon(parent=col, typeID=self.jobData.blueprint.blueprintTypeID, isCopy=not self.jobData.blueprint.original, ignoreSize=True, align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, width=iconSize, height=iconSize, left=2) else: iconSize = 0 Label(parent=col, text=self.jobData.blueprint.GetLabel(), align=uiconst.CENTERLEFT, left=iconSize + 4, idx=0)
def _PrepareProductIcon(self): icon = Container(name='productIcon', align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, width=self.iconSize, height=self.iconSize) techIcon = GetTechLevelIcon(typeID=self.typeID) if techIcon: techIcon.SetParent(icon) Icon(parent=icon, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, size=self.iconSize, typeID=self.typeID, isCopy=True) return icon
def DrawDraggedItems(self, dragData): if getattr(dragData[0], '__guid__', None) != 'xtriui.InvItem': return self.hasDrawn = True uicore.animations.FadeOut(self.dropLabel, duration=0.15) noOfItems = len(dragData) noOfAvailable = math.floor((self.width - 16) / 28) for i, dragItem in enumerate(dragData): c = Container(parent=self.fakeItemsCont, align=uiconst.TOLEFT, padding=2, width=24) if noOfItems > noOfAvailable and i == noOfAvailable - 1: icon = Sprite( parent=c, texturePath= 'res:/UI/Texture/classes/MultiSell/DotDotDot.png', state=uiconst.UI_DISABLED, width=24, height=24, align=uiconst.CENTER) icon.SetAlpha(0.6) return icon = Icon(parent=c, typeID=dragItem.item.typeID, state=uiconst.UI_DISABLED) icon.SetSize(24, 24)
def ApplyAttributes(self, attributes): BaseFramedContainer.ApplyAttributes(self, attributes) self.labelCont = Container(parent=self.contentCont, align=uiconst.CENTERLEFT, left=8, width=237, height=38) IndustryCaptionLabel(parent=self.labelCont, align=uiconst.TOTOP, text=localization.GetByLabel('UI/Industry/Facility')) self.label = Label(parent=self.labelCont, align=uiconst.TOTOP, fontsize=10) self.icon = Icon(name='installationIcon', parent=self.contentCont, align=CENTERRIGHT, state=UI_DISABLED, pos=(1, 0, 43, 42)) self.removeIcon = Sprite(parent=self.contentCont, align=uiconst.TOPRIGHT, state=uiconst.UI_DISABLED, texturePath='res:/ui/texture/icons/73_16_45.png', pos=(46, 2, 12, 12), color=Color.RED, opacity=0.0)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) typeID = attributes.typeID qty = attributes.qty iconPadding = 1 * const.defaultPadding typeIcon = Icon(name='typeIcon', parent=self, state=uiconst.UI_NORMAL, size=32, left=iconPadding, ignoreSize=True, typeID=typeID) techIcon = uix.GetTechLevelIcon(typeID=typeID) if techIcon: techIcon.left = iconPadding techIcon.SetParent(self, idx=0) typeName = evetypes.GetName(typeID) link = '<url="showinfo:%s">%s</url>' % (typeID, typeName) text = '%sx %s' % (qty, link) left = iconPadding * 2 + typeIcon.width + 10 label = EveLabelMedium(parent=self, left=left, text=text, state=uiconst.UI_NORMAL, align=uiconst.CENTERLEFT) self.width = label.left + label.textwidth + 10
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) typeID = attributes.Get('typeID', None) iskAmount = attributes.Get('iskAmount', 0) amount = attributes.Get('amount', 0) typeName = evetypes.GetName(typeID) mainCont = Container(name='mainCont', parent=self) iconCont = Container(name='iconCont', parent=mainCont, align=uiconst.TOLEFT, width=18) textCont = Container(name='textCont', parent=mainCont, align=uiconst.TOALL, padding=const.defaultPadding) icon = Icon(parent=iconCont, align=uiconst.TOALL, size=18, typeID=typeID, ignoreSize=True) icon.OnClick = (self.ShowInfo, None, typeID) icon.hint = typeName iskLabel = EveLabelSmall(text=FmtISK(iskAmount, 0), parent=textCont, align=uiconst.TORIGHT, maxLines=1) amountLabel = EveLabelSmall(text='%ix' % amount, parent=textCont, align=uiconst.TOLEFT, maxLines=1) if amount == 0: mainCont.opacity = 0.5
def ApplyAttributes(self, attributes): InfoBubble.ApplyAttributes(self, attributes) self.typeID = attributes.typeID self.caption.text = cfg.invtypes.Get(self.typeID).name self.icon = Icon(name='icon', parent=self.iconCont, pos=(0, 0, 80, 80), typeID=self.typeID, ignoreSize=True, cursor=uiconst.UICURSOR_MAGNIFIER) self.icon.OnClick = self.OnIconClicked fsdType = cfg.fsdTypeOverrides.Get(self.typeID) if hasattr(fsdType, 'infoBubbleTypeElement'): self.ConstructElements(fsdType.infoBubbleTypeElement) isTrialRestricted = sm.GetService('skills').IsTrialRestricted( self.typeID) if isTrialRestricted: TrialRestrictionButton(parent=self.mainContent, align=uiconst.TOTOP, padding=(0, 8, 0, 8), callback=self.OpenSubscriptionPage, message='UI/ShipTree/ShipTrialRestricted') TraitsContainer(parent=self.mainContent, typeID=self.typeID) price = cfg.invtypes.Get(self.typeID).averagePrice or 0 text = GetByLabel('UI/Inventory/EstIskPrice', iskString=FmtISKAndRound(price, False)) Label(parent=self.topRightCont, text=text, align=uiconst.TOTOP, padTop=7) uicore.animations.FadeTo(self.icon, 1.5, 1.0, duration=0.6) self.AnimShow() sm.GetService('shipTree').LogIGS('HoverType')
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 AddRow(self, idx): labelPath, what, iconNo, labelHintPath = rowsInfo[idx] rowName = 'row_%s' % what row = Container(name='row_%s' % rowName, parent=self, align=uiconst.TOTOP, height=32) mainIcon = Icon(icon=iconNo, parent=row, pos=(0, 0, 32, 32), ignoreSize=True) mainIcon.hint = GetByLabel(labelPath) statusLabel = Label(text='', parent=row, left=mainIcon.left + mainIcon.width, state=uiconst.UI_NORMAL, align=uiconst.CENTERLEFT, width=62) statusLabel.hint = GetByLabel(labelHintPath) self.statsLabelsByIdentifier[what] = statusLabel dmgContainer = Container(parent=row, name='dmgContainer', left=self.col1Width) gaugeCont = DamageGaugeContainerFitting(parent=dmgContainer) self.statsContsByIdentifier[what] = gaugeCont
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.shipFighterState = GetShipFighterState() self.typeID = None self.squadronSize = None self.squadronMaxSize = None self.noHealthyFighters = 0 self.squadronState = attributes.get('state', None) self.tubeFlagID = attributes.get('tubeFlagID', None) dashColors = self.GetDashColors() self.classIcon = Sprite(name='classIcon', parent=self, align=uiconst.CENTERBOTTOM, width=16, height=16, top=18) self.classIcon.OnMouseEnter = self.OnMouseEnter self.classIcon.OnMouseExit = self.OnMouseExit self.classIcon.GetDragData = self.GetDragData self.fightersGauge = FighterHealthGaugeLine(parent=self, dashColors=dashColors, align=uiconst.CENTER) Sprite( parent=self, align=uiconst.CENTER, width=86, height=86, texturePath= 'res:/UI/Texture/classes/ShipUI/Fighters/fighterItemOverlay.png', state=uiconst.UI_DISABLED) self.fighterIcon = Icon( parent=self, align=uiconst.CENTER, width=52, height=52, state=uiconst.UI_DISABLED, blendMode=1, textureSecondaryPath= 'res:/UI/Texture/classes/ShipUI/Fighters/fighterItemMask.png', spriteEffect=trinity.TR2_SFX_MODULATE) Sprite( parent=self, align=uiconst.CENTER, width=86, height=86, texturePath= 'res:/UI/Texture/classes/ShipUI/Fighters/fighterItemUnderlay.png', state=uiconst.UI_DISABLED) self.hilite = Sprite( parent=self, name='hilite', width=86, height=86, align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath= 'res:/UI/Texture/classes/ShipUI/Fighters/fighterItemUnderlayOver.png' ) self.hilite.display = False
def AddIcon(iconNum, left=-1): Icon(icon=iconNum, parent=self, pos=(left, -2, 16, 16), align=uiconst.TOPRIGHT, idx=0, state=uiconst.UI_DISABLED) self.width += 14
def get_agent_icon(name, parent, align, size, agent_id): agent_icon = Icon(name=name, parent=parent, align=align, size=size, ignoreSize=True) sm.GetService('photo').GetPortrait(agent_id, size, agent_icon) return agent_icon
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.activeCurve = None self.activationPendingCurve = None self.deactivationCurve = None self.ramp_active = False self.buttonDisabled = False self.shipFighterState = GetShipFighterState() self.crimewatchSvc = sm.GetService('crimewatchSvc') self.innerCont = Container(name='innerCont', parent=self, align=uiconst.TOBOTTOM, height=self.height) self.stateLabel = EveLabelSmall(parent=self.innerCont, align=uiconst.CENTER) self.controller = attributes.controller self.slotID = self.controller.slotID self.fighterID = attributes.fighterID self.fighterTypeID = attributes.fighterTypeID ability = self.GetAbilityInfo() self.abilityNameID = ability.displayNameID iconID = ability.iconID self.abilityIcon = Icon(parent=self.innerCont, align=uiconst.CENTER, width=32, height=32, icon=iconID, state=uiconst.UI_DISABLED) self.hilite = Sprite( parent=self.innerCont, name='hilite', width=44, height=44, align=uiconst.CENTER, state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/classes/ShipUI/slotHilite.png', blendMode=trinity.TR2_SBM_ADDX2) self.hilite.display = False bgSprite = Sprite( parent=self.innerCont, align=uiconst.CENTER, width=64, height=64, texturePath= 'res:/UI/Texture/classes/ShipUI/Fighters/slotFighterAbility.png', state=uiconst.UI_DISABLED) self.abilityIcon.SetSize(32, 32) self.DrawQtyCont() self.DrawTimer() self.DrawCoolDownTimer() self.DrawSafetyGlow() self.targetMode = ability.targetMode abilityID = GetAbilityIDForSlot(self.fighterTypeID, self.slotID) effectID = GetDogmaEffectIDForAbilityID(abilityID) self.abilityEffect = cfg.dgmeffects.Get(effectID) self.OnAbilityStatusUpdated(self.fighterID, self.slotID) self.shipFighterState.signalOnAbilityActivationStatusUpdate.connect( self.OnAbilityStatusUpdated)
def AddIcon(self, parent, iconNum, tooltipCallback): angle = 306 iconRad = int(310 * GetScaleFactor()) left, top, cos, sin = self.GetPositionNumbers(angle, iconRad, offset=16) icon = Icon(name='%s_Icon' % self.attribute.attributeName, icon=iconNum, parent=parent, state=UI_NORMAL, hint=self.attribute.displayName, pos=(left, top, 32, 32), ignoreSize=True) icon.LoadTooltipPanel = tooltipCallback
def ApplyAttributes(self, attributes): UtilMenuCheckBox.ApplyAttributes(self, attributes) self.subIcon = Icon(parent=self, icon=attributes.subIcon, state=uiconst.UI_DISABLED, left=3, width=16, height=16, align=uiconst.CENTERRIGHT, ignoreSize=True) if attributes.subIconCallback: self.subIcon.hint = attributes.subIconHint self.subIcon.state = uiconst.UI_NORMAL self.subIcon.OnClick = self.OnSubIconClick self.subIcon.OnMouseEnter = self.OnMouseEnter self.subIconCallback = attributes.subIconCallback
def AddTypeAndIcon(self, label, typeID, moduleShortcut=None, moduleDamageAmount=0, iconSize=26, minRowSize=30): self.FillRow() self.AddSpacer(height=minRowSize, width=0) iconCont = Container(pos=(0, 0, iconSize, iconSize), align=uiconst.CENTER) iconObj = Icon(parent=iconCont, pos=(0, 0, iconSize, iconSize), align=uiconst.TOPLEFT, ignoreSize=True) iconObj.LoadIconByTypeID(typeID, size=iconSize, ignoreSize=True) techIcon = Icon(parent=iconCont, width=16, height=16, align=uiconst.TOPLEFT, idx=0, top=0) GetTechLevelIcon(techIcon, typeID=typeID) self.AddCell(iconCont, cellPadding=2) if moduleShortcut: nameColSpan = self.columns - 3 else: nameColSpan = self.columns - 2 if moduleDamageAmount > 0: damagedText = localization.GetByLabel( 'UI/Inflight/ModuleRacks/ModuleDamaged', color='<color=red>', percentageNum=moduleDamageAmount) label += '<br>' + damagedText labelObj = self.AddLabelMedium(text=label, align=uiconst.CENTERLEFT, cellPadding=self.labelPadding, colSpan=nameColSpan) if moduleShortcut: shortcutObj = ShortcutHint(text=moduleShortcut) shortcutObj.width += 10 shortcutObj.padLeft = 10 self.AddCell(shortcutObj) return (iconObj, labelObj)
def LoadTooltipPanel(self, panel, *args): if not self.missionHint: return panel.state = uiconst.UI_NORMAL panel.margin = 8 panel.columns = 2 if self.iconTypeID: agentIcon = Icon(parent=panel, opacity=0.7, size=48, left=0, top=0, state=uiconst.UI_DISABLED) sm.GetService('photo').GetIconByType(agentIcon, self.iconTypeID, self.iconItemID, ignoreSize=True) panel.AddLabelMedium(text=self.missionHint, cellPadding=(6, 0, 0, 2), colSpan=2, align=uiconst.CENTER, state=uiconst.UI_NORMAL)
def ApplyAttributes(self, attributes): uiprimitives.Container.ApplyAttributes(self, attributes) self.booster = attributes.get('booster') self.expiryTime = attributes.get('expiryTime') self.effects = attributes.get('effects') self.positiveEffects = self.effects.get('positive', []) self.negativeEffects = self.effects.get('negative', []) self.typeID = self.booster.typeID self.activeBlink = None self.highlight = Fill(bgParent=self, color=(1, 1, 1, 0.1), state=uiconst.UI_HIDDEN) leftCont = uiprimitives.Container(parent=self, align=uiconst.TOLEFT, width=self.TIME_WIDTH) rightCont = uiprimitives.Container(parent=self, align=uiconst.TOALL) self.time = Label(parent=leftCont, name='counter', text='', fontsize=16, bold=False, align=uiconst.TOPLEFT, color=(1, 1, 1, 0.75), left=2 * const.defaultPadding) self.boosterSprite = Icon(parent=rightCont, name='boosterIcon', icon=evetypes.GetIconID(self.typeID), pos=(0, 0, 24, 24), ignoreSize=True, state=uiconst.UI_DISABLED) left = self.boosterSprite.width boosterName = EveLabelSmall(parent=rightCont, name='name', text=evetypes.GetName(self.typeID), align=uiconst.TOPLEFT, top=1, left=left) self.maxtextwidth = boosterName.textwidth + boosterName.left padTop = boosterName.textheight + 4 allModified = self.GetBoosterEffectsInfo( self.positiveEffects) + self.GetBoosterEffectsInfo( self.negativeEffects, True) for lineText in allModified: effectLabel = EveLabelSmall(parent=rightCont, name='effect', text=lineText, align=uiconst.TOPLEFT, padTop=padTop, left=30) padTop += effectLabel.textheight + 2 self.maxtextwidth = max(self.maxtextwidth, effectLabel.textwidth + effectLabel.left) self.height = max(padTop + 4, self.boosterSprite.height + 2) self.LoadData()
def AddBestRepairPicker(self, tRow): self.bestRepairPickerPanel = None bestPar = Container(name='bestPar', parent=tRow, align=uiconst.TOPLEFT, height=32, width=self.col1Width, state=uiconst.UI_NORMAL) bestPar.OnClick = self.ExpandBestRepair SetFittingTooltipInfo(targetObject=bestPar, tooltipName='ActiveDefenses') expandIcon = Icon(name='expandIcon', icon='ui_38_16_229', parent=bestPar, state=uiconst.UI_DISABLED, align=uiconst.BOTTOMRIGHT) numPar = Container(name='numPar', parent=bestPar, pos=(4, 17, 11, 11), align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED) numLabel = EveLabelMedium(text='', parent=numPar, atop=-1, state=uiconst.UI_DISABLED, align=uiconst.CENTER, shadowOffset=(0, 0)) Fill(parent=numPar, color=BAR_COLORS[1]) self.activeBestRepairNumLabel = numLabel icon = Icon(parent=bestPar, state=uiconst.UI_DISABLED, width=32, height=32) statusLabel = Label(name='statusLabel', text='', parent=bestPar, left=icon.left + icon.width, state=uiconst.UI_DISABLED, align=uiconst.CENTERLEFT) self.activeBestRepairLabel = statusLabel self.activeBestRepairParent = bestPar self.activeBestRepairIcon = icon
def ApplyAttributes(self, attributes): ContainerAutoSize.ApplyAttributes(self, attributes) self.level = attributes.get('level', 0) self.data = attributes.get('data') self.eventListener = attributes.get('eventListener', None) self.parentEntry = attributes.get('parentEntry', None) self.settingsID = attributes.get('settingsID', self.default_settingsID) self.defaultExpanded = attributes.get('defaultExpanded', self.level < 1) self.childrenInitialized = False self.isToggling = False self.canAccess = True self.isSelected = False self.childSelectedBG = False self.icon = None self.childCont = None self.topRightCont = Container(name='topCont', parent=self, align=uiconst.TOTOP, height=self.default_height) self.topRightCont.GetDragData = self.GetDragData left = self.GetSpacerContWidth() if self.data.IsRemovable(): removeBtn = Sprite(texturePath='res:/UI/Texture/icons/73_16_210.png', parent=self.topRightCont, align=uiconst.CENTERLEFT, width=16, height=16, left=left, hint=localization.GetByLabel('UI/Common/Buttons/Close')) left += 20 removeBtn.OnClick = self.Remove icon = self.data.GetIcon() if icon: iconSize = self.height - 2 self.icon = Icon(icon=icon, parent=self.topRightCont, pos=(left, 0, iconSize, iconSize), align=uiconst.CENTERLEFT, state=uiconst.UI_DISABLED, ignoreSize=True) left += iconSize self.label = Label(parent=self.topRightCont, align=uiconst.CENTERLEFT, text=self.data.GetLabel(), left=left + 4) self.UpdateLabel() self.hoverBG = None self.selectedBG = None self.blinkBG = None if self.data.HasChildren(): self.spacerCont = Container(name='spacerCont', parent=self.topRightCont, align=uiconst.TOLEFT, width=self.GetSpacerContWidth()) self.toggleBtn = Container(name='toggleBtn', parent=self.spacerCont, align=uiconst.CENTERRIGHT, width=16, height=16, state=uiconst.UI_HIDDEN) self.toggleBtn.OnClick = self.OnToggleBtnClick self.toggleBtn.OnDblClick = lambda : None self.toggleBtnSprite = Sprite(bgParent=self.toggleBtn, texturePath='res:/UI/Texture/classes/Neocom/arrowDown.png', rotation=pi / 2, padding=(4, 4, 5, 5)) expandChildren = False if not self.data.IsForceCollapsed(): toggleSettingsDict = settings.user.ui.Get('invTreeViewEntryToggle_%s' % self.settingsID, {}) expandChildren = toggleSettingsDict.get(self.data.GetID(), self.defaultExpanded) self.ConstructChildren() else: self.toggleBtn.state = uiconst.UI_NORMAL self.ShowChildCont(expandChildren, animate=False) else: self.ShowChildCont(False, animate=False) if self.eventListener and hasattr(self.eventListener, 'RegisterID'): self.eventListener.RegisterID(self, self.data.GetID())