def RenderText(self, text, name): txt = uicontrols.EveHeaderMedium(text=text, parent=None, state=uiconst.UI_NORMAL) hb = trinity.Tr2HostBitmap(txt.actualTextWidth, txt.actualTextHeight, 1, trinity.PIXEL_FORMAT.B8G8R8A8_UNORM) txt.measurer.DrawToHostBitmap(hb) fileName = 'cache:/Temp/%s.dds' % name hb.SaveAsync(blue.paths.ResolvePathForWriting(fileName)) hb.WaitForSave()
def ApplyAttributes(self, attributes): uicontrols.Window.ApplyAttributes(self, attributes) self.shipid = util.GetActiveShip() self.shipItem = self.GetShipItem() self.SetTopparentHeight(72) self.SetWndIcon() self.SetMinSize([300, 200]) self.sr.top = uiprimitives.Container(name='top', align=uiconst.TOTOP, parent=self.sr.topParent, pos=(const.defaultPadding, const.defaultPadding, const.defaultPadding, 64)) icon = uicontrols.Icon(parent=self.sr.top, align=uiconst.TOLEFT, left=const.defaultPadding, size=64, state=uiconst.UI_NORMAL, typeID=self.shipItem.typeID) icon.GetMenu = self.ShipMenu uiprimitives.Container(name='push', align=uiconst.TOLEFT, pos=(5, 0, 5, 0), parent=self.sr.top) uicontrols.EveHeaderMedium(name='label', text=cfg.evelocations.Get(self.shipItem.itemID).name, parent=self.sr.top, align=uiconst.TOTOP, bold=True, state=uiconst.UI_NORMAL) uicontrols.EveLabelMedium(name='label', text=evetypes.GetName(self.shipItem.typeID), parent=self.sr.top, align=uiconst.TOTOP, state=uiconst.UI_NORMAL) self.ship = moniker.GetShipAccess() self.conf = self.ship.GetShipConfiguration(self.shipid) modules = self.GetShipModules() for module in modules: self.sr.Set('%sPanel' % module.lower(), uiprimitives.Container(name=module, align=uiconst.TOALL, state=uiconst.UI_HIDDEN, parent=self.sr.main, pos=(0, 0, 0, 0))) tabs = [ [name, self.sr.Get('%sPanel' % module.lower(), None), self, module] for module, name in modules.iteritems() if self.sr.Get('%sPanel' % module.lower()) ] if tabs: self.sr.maintabs = uicontrols.TabGroup(name='tabparent', align=uiconst.TOTOP, height=18, parent=self.sr.main, idx=0, tabs=tabs, groupID='pospanel') else: uicontrols.CaptionLabel(text=localization.GetByLabel('UI/Ship/ShipConfig/ShipConfig'), parent=self.sr.main, size=18, uppercase=0, left=const.defaultPadding, width=const.defaultPadding, top=const.defaultPadding)
def ApplyAttributes(self, attributes): uicls.InfoPanelBase.ApplyAttributes(self, attributes) self.isGaugeInitialized = False self.benefitIcons = [] self.factionIcon = None self.headerTextCont = uiprimitives.Container(name='headerTextCont', parent=self.headerCont, align=uiconst.TOALL) self.title = self.headerCls( name='title', text= '<color=white url=localsvc:service=cmd&method=OpenMilitia>%s</url>' % localization.GetByLabel('UI/FactionWarfare/FactionalWarfare'), parent=self.headerTextCont, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL) self.subTitle = uicontrols.EveHeaderMedium(name='subtitle', parent=self.headerTextCont, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, left=self.title.width + 5, top=2, bold=True) self.headerControlGauge = uicls.Gauge(parent=self.headerCont, align=uiconst.TOALL, gaugeHeight=16, padTop=6, padRight=6, color=(0.5, 0.5, 0.5, 1.0), width=0, height=0, state=uiconst.UI_HIDDEN) self.headerControlGauge.OnClick = self.topCont.OnClick self.headerControlGauge.OnMouseEnter = self.topCont.OnMouseEnter self.headerControlGauge.OnMouseExit = self.topCont.OnMouseExit self.headerControlGauge.GetHint = self.GetGaugeHint self.controlGauge = uicls.Gauge(parent=self.mainCont, align=uiconst.TOTOP, padTop=2, gaugeHeight=15, color=(0.5, 0.5, 0.5, 1.0)) self.controlGauge.GetHint = self.GetGaugeHint self.bottomContainer = uicontrols.ContainerAutoSize( parent=self.mainCont, name='bottomContainer', align=uiconst.TOTOP) self.bottomContainer.EnableAutoSize() self.mainCont.EnableAutoSize()
def CreateCell(self, parent, height, width, backgroundColorTuple, foregroundColorTuple): newCell = uiprimitives.Container(parent=parent, name='hackingCell', align=uiconst.TOLEFT, state=uiconst.UI_DISABLED, pos=(0, 0, width, height), padding=(self.cellPaddingHorizontal, self.cellPaddingVertical, self.cellPaddingHorizontal, self.cellPaddingVertical)) newCell.sr.background = uiprimitives.Fill(parent=newCell, color=backgroundColorTuple) newCellFill = uiprimitives.Container(parent=newCell, name='hackFill', align=uiconst.TOPLEFT, pos=(0, 0, width, height), padding=(self.cellPaddingHorizontal, self.cellPaddingVertical, self.cellPaddingHorizontal, self.cellPaddingVertical)) newCellFill.sr.background = uiprimitives.Fill(parent=newCellFill, color=foregroundColorTuple) newCellFill.opacity = 0.0 newCell.sr.fill = newCellFill newCell.sr.text = uicontrols.EveHeaderMedium(text=random.choice(self.cellGlyphs), parent=newCell, align=uiconst.CENTER, fontsize=self.cellTextSize, height=height, state=uiconst.UI_DISABLED) return newCell
def ApplyAttributes(self, attributes): uicls.InfoPanelBase.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.lastInfluence = None self.headerTextCont = uiprimitives.Container(name='headerTextCont', parent=self.headerCont, align=uiconst.TOALL) self.title = self.headerCls(name='title', text='<color=white url=localsvc:service=journal&method=ShowIncursionTab&constellationID=%d&open=1>%s</url>' % (session.constellationid, localization.GetByLabel(self.label)), parent=self.headerTextCont, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL) self.subTitle = uicontrols.EveHeaderMedium(name='subtitle', parent=self.headerTextCont, left=self.title.width + 4, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, top=3) self.finalEncounterIcon = IncursionFinalEncounterIcon(name='finalEncounterIcon', parent=self.headerCont, align=uiconst.CENTERRIGHT, left=8) self.headerInfluenceBar = uicls.SystemInfluenceBar(parent=self.headerCont, state=uiconst.UI_HIDDEN, align=uiconst.TOALL, height=0, padding=(0, 6, 24, 6)) self.headerInfluenceBar.OnClick = self.topCont.OnClick self.headerInfluenceBar.OnMouseEnter = self.topCont.OnMouseEnter self.headerInfluenceBar.OnMouseExit = self.topCont.OnMouseExit self.influenceBar = uicls.SystemInfluenceBar(parent=self.mainCont, padding=(0, 0, 0, 2)) self.bottomContainer = uiprimitives.Container(name='bottomContainer', parent=self.mainCont, align=uiconst.TOTOP, height=33) self.severityIcon = uicontrols.Icon(name='severityIcon', parent=self.bottomContainer, align=uiconst.RELATIVE, color=COLOR_ENABLED, pos=(0, 10, 32, 32), ignoreSize=True, size=48, state=uiconst.UI_NORMAL) self.corpIcon = uicontrols.Icon(name='corpIcon', parent=self.bottomContainer, align=uiconst.RELATIVE, color=COLOR_ENABLED, pos=(35, 10, 32, 32), ignoreSize=True, size=48, state=uiconst.UI_NORMAL) iconCont = uicontrols.ContainerAutoSize(name='iconCont', parent=self.bottomContainer, align=uiconst.CENTERLEFT, pos=(70, 0, 0, 22)) iconParams = {'align': uiconst.TOLEFT, 'parent': iconCont, 'color': COLOR_ENABLED, 'width': iconCont.height, 'padRight': 6} self.effects = self._GetEffectsForTale(iconParams) uthread.new(self.UpdateInfluenceThread)
def CreateLayout(self): icon = 'ui_44_32_7' commandPinObject = sm.GetService( 'planetUI').GetCurrentPlanet().GetCommandCenterForCharacter( session.charid) commandPin = commandPinObject is not None and not commandPinObject.IsInEditMode( ) buttonList = [(const.groupExtractionControlUnitPins, 'ui_77_32_26'), (const.groupProcessPins, 'ui_77_32_30'), (const.groupStoragePins, 'ui_77_32_25'), (const.groupSpaceportPins, 'ui_77_32_27'), (const.groupPlanetaryLinks, 'ui_77_32_31')] if not commandPin: buttonList.insert(0, (const.groupCommandPins, 'ui_77_32_29')) for groupID, icon in buttonList: groupEnabled = commandPin or groupID == const.groupCommandPins if groupEnabled: color = self.COLOR_ENABLED else: color = self.COLOR_DISABLED buildEntry = uiprimitives.Container(parent=self.buildContainer, name='buildEntry' + str(groupID), align=uiconst.TOTOP, pos=(0, 0, 0, ICON_SIZE), state=uiconst.UI_NORMAL) buildEntry.groupID = groupID buildEntry.headerContainer = header = uiprimitives.Container( parent=buildEntry, name='buildHeaderContainer', align=uiconst.TOTOP, pos=(0, 0, 0, ICON_SIZE)) buildEntry.iconButton = iconButton = IconButton( parent=header, name='pin_' + str(groupID), icon=icon, align=uiconst.TOLEFT, pos=(0, 0, ICON_SIZE, 0), state=uiconst.UI_NORMAL, size=ICON_SIZE, color=color) iconButton.OnMouseEnter = (self.OnBuildIconButtonMouseEnter, buildEntry) iconButton.OnMouseExit = (self.OnBuildIconButtonMouseExit, buildEntry) if commandPin: iconButton.OnClick = (self.OnBuildIconButtonClicked, buildEntry) buildEntry.heading = uicontrols.EveHeaderMedium( parent=header, text='<b>' + cfg.invgroups.Get(groupID).name + '</b>', state=uiconst.UI_NORMAL, hilightable=1, pos=(ICON_SIZE + 4, 6, 200, ICON_SIZE), color=color) buildEntry.heading.OnMouseEnter = ( self.OnBuildIconButtonMouseEnter, buildEntry) buildEntry.heading.OnMouseExit = (self.OnBuildIconButtonMouseExit, buildEntry) buildEntry.heading.OnClick = (self.OnBuildIconButtonClicked, buildEntry) buildEntry.structureScroll = uicontrols.Scroll( parent=buildEntry, name='structureScroll', padLeft=ICON_SIZE) buildEntry.structureScroll.state = uiconst.UI_HIDDEN buildEntry.structureScroll.HideBackground() buildEntry.structureScroll.RemoveActiveFrame() buildEntry.structureScroll.scrollEnabled = 0 buildEntry.structureScroll.multiSelect = False try: self.LoadStructureScroll(buildEntry, commandPin, color) except AttributeError: if buildEntry.destroyed or not self or self.destroyed: return raise
def ApplyAttributes(self, attributes): uicls.InfoPanelBase.ApplyAttributes(self, attributes) sm.RegisterNotify(self) self.lastInfluence = None self.headerTextCont = uiprimitives.Container(name='headerTextCont', parent=self.headerCont, align=uiconst.TOALL) self.title = self.headerCls( name='title', text= '<color=white url=localsvc:service=journal&method=ShowIncursionTab&constellationID=%d&open=1>%s</url>' % (session.constellationid, localization.GetByLabel(self.label)), parent=self.headerTextCont, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL) self.subTitle = uicontrols.EveHeaderMedium(name='subtitle', parent=self.headerTextCont, left=self.title.width + 4, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL, top=3) self.bossIcon = uicls.IncursionBossIcon(name='bossIcon', parent=self.headerCont, align=uiconst.CENTERRIGHT, left=8) self.headerInfluenceBar = uicls.SystemInfluenceBar( parent=self.headerCont, state=uiconst.UI_HIDDEN, align=uiconst.TOALL, height=0, padding=(0, 6, 24, 6)) self.headerInfluenceBar.OnClick = self.topCont.OnClick self.headerInfluenceBar.OnMouseEnter = self.topCont.OnMouseEnter self.headerInfluenceBar.OnMouseExit = self.topCont.OnMouseExit self.influenceBar = uicls.SystemInfluenceBar(parent=self.mainCont, padding=(0, 0, 0, 2)) self.bottomContainer = uiprimitives.Container(name='bottomContainer', parent=self.mainCont, align=uiconst.TOTOP, height=33) self.severityIcon = uicontrols.Icon(name='severityIcon', parent=self.bottomContainer, align=uiconst.RELATIVE, color=COLOR_ENABLED, pos=(0, 0, 32, 32), ignoreSize=True, size=48, state=uiconst.UI_NORMAL) iconCont = uicontrols.ContainerAutoSize(name='iconCont', parent=self.bottomContainer, align=uiconst.CENTERLEFT, pos=(45, 0, 0, 22)) iconParams = { 'align': uiconst.TOLEFT, 'parent': iconCont, 'color': COLOR_ENABLED, 'width': iconCont.height, 'padRight': 6 } self.effects = [ uiprimitives.Sprite( name='effectIcon_cyno', texturePath= 'res:/UI/Texture/classes/InfluenceBar/effectCyno.png', hint=localization.GetByLabel( 'UI/Incursion/HUD/SystemEffectCynoHint'), **iconParams), uiprimitives.Sprite( name='effectIcon_tax', texturePath= 'res:/UI/Texture/classes/InfluenceBar/effectTax.png', hint=localization.GetByLabel( 'UI/Incursion/HUD/SystemEffectTaxHint'), **iconParams), uiprimitives.Sprite( name='effectIcon_tank', texturePath= 'res:/UI/Texture/classes/InfluenceBar/effectResistance.png', hint=localization.GetByLabel( 'UI/Incursion/HUD/SystemEffectTankingHint'), **iconParams), uiprimitives.Sprite( name='effectIcon_damage', texturePath= 'res:/UI/Texture/classes/InfluenceBar/effectDamage.png', hint=localization.GetByLabel( 'UI/Incursion/HUD/SystemEffectDamageHint'), **iconParams) ] uthread.new(self.UpdateInfluenceThread)