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()
class AchievementTaskEntry(ContainerAutoSize): default_padLeft = 0 default_padRight = 0 default_padTop = 0 default_padBottom = 4 default_state = uiconst.UI_NORMAL default_clipChildren = False default_alignMode = uiconst.TOTOP checkedTexturePath = 'res:/UI/Texture/Classes/InfoPanels/opportunitiesCheck.png' uncheckedTexturePath = 'res:/UI/Texture/Classes/InfoPanels/opportunitiesIncompleteBox.png' tooltipPointer = uiconst.POINT_LEFT_2 achievementGroup = None autoShowDetails = False detailsParent = None callbackTaskExpanded = None def ApplyAttributes(self, attributes): ContainerAutoSize.ApplyAttributes(self, attributes) self.autoShowDetails = bool(attributes.autoShowDetails) or True Fill(bgParent=self, color=(0, 0, 0, 0.3)) self.headerContainer = Container(parent=self, align=uiconst.TOTOP) self.mouseOverFill = FillThemeColored(bgParent=self.headerContainer, colorType=uiconst.COLORTYPE_UIHILIGHT, opacity=0.0) self.completedFill = FillThemeColored(bgParent=self.headerContainer, colorType=uiconst.COLORTYPE_UIHILIGHT, opacity=0.0) self.backgroundContainer = InfoPanelHeaderBackground(bgParent=self.headerContainer) self.achievementTask = attributes.achievement self.achievementGroup = attributes.achievementGroup self.callbackTaskExpanded = attributes.callbackTaskExpanded self.checkbox = Sprite(parent=self.headerContainer, texturePath=self.uncheckedTexturePath, pos=(4, 3, 14, 14)) self.achievementText = EveLabelMedium(name='achievementText', text=self.achievementTask.name, parent=self.headerContainer, padLeft=2 * self.checkbox.left + self.checkbox.width, align=uiconst.TOTOP, padTop=2) self.UpdateAchievementTaskState() newHeight = max(self.checkbox.height + 2 * self.checkbox.top, self.achievementText.textheight + 2 * self.achievementText.padTop) self.headerContainer.height = newHeight if attributes.blinkIn and self.achievementTask.completed: uthread.new(uicore.animations.BlinkIn, self, duration=0.2, loops=4) def ToggleDetails(self): if self.detailsParent and not self.detailsParent.destroyed: self.HideDetails() else: self.ShowDetails() def HideDetails(self, *args): if self.detailsParent and not self.detailsParent.destroyed: detailsParent = self.detailsParent self.detailsParent = None detailsParent.DisableAutoSize() uicore.animations.FadeOut(detailsParent, duration=0.15) uicore.animations.MorphScalar(detailsParent, 'height', detailsParent.height, 0, duration=0.15, callback=detailsParent.Close) def ShowDetails(self): if self.detailsParent and not self.detailsParent.destroyed: return uthread.new(self._ShowDetails) def _ShowDetails(self): if not self.autoShowDetails: return self.detailsParent = ContainerAutoSize(align=uiconst.TOTOP, parent=self, clipChildren=True) if self.callbackTaskExpanded: self.callbackTaskExpanded(self) self.detailsParent.DisableAutoSize() label = EveLabelMedium(parent=self.detailsParent, text=self.achievementTask.description, align=uiconst.TOTOP, padding=(6, 3, 6, 2)) extraInfo = ACHIEVEMENT_TASK_EXTRAINFO.get(self.achievementTask.achievementID, None) if extraInfo: grid = LayoutGrid(parent=self.detailsParent, align=uiconst.TOTOP, cellPadding=1, columns=2, padLeft=4, padBottom=2) for taskInfoEntry in extraInfo: if isinstance(taskInfoEntry, TaskInfoEntry_Text): label = EveLabelMedium(text=taskInfoEntry.text, color=taskInfoEntry.textColor, width=240, state=uiconst.UI_NORMAL) grid.AddCell(label, colSpan=2) elif isinstance(taskInfoEntry, TaskInfoEntry_ImageText): texturePath = taskInfoEntry.GetTexturePath() icon = Sprite(name='icon', parent=grid, pos=(0, 0, taskInfoEntry.imageSize, taskInfoEntry.imageSize), texturePath=texturePath, state=uiconst.UI_DISABLED, align=uiconst.CENTER, color=taskInfoEntry.imageColor) text = GetByLabel(taskInfoEntry.textPath) label = EveLabelMedium(text=text, color=taskInfoEntry.textColor, width=220, align=uiconst.CENTERLEFT, state=uiconst.UI_NORMAL) grid.AddCell(label) blue.synchro.Yield() height = self.detailsParent.GetAutoSize()[1] uicore.animations.FadeIn(self.detailsParent, duration=0.3) uicore.animations.MorphScalar(self.detailsParent, 'height', self.detailsParent.height, height, duration=0.25, sleep=True) self.detailsParent.EnableAutoSize() def OnMouseEnter(self, *args): if self.autoShowDetails: return uicore.animations.MorphScalar(self, 'opacity', startVal=self.opacity, endVal=2.0, curveType=uiconst.ANIM_OVERSHOT3, duration=0.5) CheckMouseOverUtil(self, self.ResetMouseOverState) def ResetMouseOverState(self, *args): if self.destroyed: return uicore.animations.MorphScalar(self, 'opacity', startVal=self.opacity, endVal=1.0, duration=0.1) def OnClick(self, *args): if self.autoShowDetails: self.ToggleDetails() else: aura = AchievementAuraWindow.GetIfOpen() if aura: aura.Step_TaskInfo_Manual(self.achievementTask, self.achievementGroup) else: AchievementAuraWindow.Open(loadAchievementTask=self.achievementTask, loadAchievementGroup=self.achievementGroup) def UpdateAchievementTaskState(self, animate = False): if self.achievementTask.completed: self.checkbox.SetTexturePath(self.checkedTexturePath) uicore.animations.FadeTo(self.completedFill, startVal=self.completedFill.opacity, endVal=0.75) else: self.checkbox.SetTexturePath(self.uncheckedTexturePath) uicore.animations.FadeTo(self.completedFill, startVal=self.completedFill.opacity, endVal=0.0) def LoadTooltipPanel(self, tooltipPanel, *args, **kwds): return if uicore.uilib.tooltipHandler.IsUnderTooltip(self): return achievementID = self.achievementTask.achievementID tooltipPanel.LoadGeneric2ColumnTemplate() if self.achievementTask.description: tooltipPanel.AddLabelMedium(text=self.achievementTask.description, colSpan=tooltipPanel.columns, wrapWidth=200) extraInfo = ACHIEVEMENT_TASK_EXTRAINFO.get(achievementID, None) if extraInfo: for taskInfoEntry in extraInfo: if isinstance(taskInfoEntry, TaskInfoEntry_Text): tooltipPanel.AddLabelMedium(text=taskInfoEntry.text, color=taskInfoEntry.textColor, colSpan=tooltipPanel.columns, wrapWidth=200) elif isinstance(taskInfoEntry, TaskInfoEntry_ImageText): texturePath = taskInfoEntry.GetTexturePath() icon = Sprite(name='icon', parent=tooltipPanel, pos=(0, 0, taskInfoEntry.imageSize, taskInfoEntry.imageSize), texturePath=texturePath, state=uiconst.UI_DISABLED, align=uiconst.CENTER, color=taskInfoEntry.imageColor) text = GetByLabel(taskInfoEntry.textPath) label = EveLabelMedium(text=text, color=taskInfoEntry.textColor, width=180, align=uiconst.CENTERLEFT) tooltipPanel.AddCell(label) def GetHint(self): return None
class CharacterSheetWindow(uicontrols.Window): __guid__ = 'form.CharacterSheet' default_width = 497 default_height = 456 default_minSize = (497, 456) default_left = 0 default_top = 32 default_windowID = 'charactersheet' default_captionLabelPath = 'UI/CharacterSheet/CharacterSheetWindow/CharacterSheetCaption' default_descriptionLabelPath = 'Tooltips/Neocom/CharacterSheet_description' default_iconNum = 'res:/ui/Texture/WindowIcons/charactersheet.png' default_scope = 'station_inflight' default_topParentHeight = 0 __notifyevents__ = ['OnGodmaItemChange', 'OnSkillsChanged'] def OnUIRefresh(self): pass @telemetry.ZONE_METHOD def ApplyAttributes(self, attributes): uicontrols.Window.ApplyAttributes(self, attributes) panelID = attributes.panelID self.loadingHeader = False self.loading = False self.currPanel = None self.topCont = ContainerAutoSize(name='topCont', parent=self.sr.main, align=uiconst.TOTOP, alignMode=uiconst.TOPLEFT, clipChildren=True, padRight=3) self.leftCont = Container(name='leftSide', parent=self.sr.main, align=uiconst.TOLEFT, left=const.defaultPadding, width=settings.user.ui.Get( 'charsheetleftwidth', 200)) self.panelSelectScroll = uicontrols.Scroll(name='panelSelectScroll', parent=self.leftCont, padding=(0, 4, 0, 4), multiSelect=False) self.panelSelectScroll.OnSelectionChange = self.OnSelectEntry self.mainCont = Container(name='mainCont', parent=self.sr.main, align=uiconst.TOALL, padRight=4) self.ConstructDivider() self.panelCont = Container(name='panelCont', parent=self.mainCont) self.employmentHistoryPanel = EmploymentHistoryPanel( parent=self.panelCont, state=uiconst.UI_HIDDEN) self.jumpClonesPanel = JumpClonesPanel(parent=self.panelCont, state=uiconst.UI_HIDDEN) self.killRightsPanel = KillRightsPanel(parent=self.panelCont, state=uiconst.UI_HIDDEN) self.attributesPanel = AttributesPanel(parent=self.panelCont, state=uiconst.UI_HIDDEN) self.decorationsPanel = DecorationsPanel(parent=self.panelCont, state=uiconst.UI_HIDDEN) self.plexPanel = PLEXPanel(parent=self.panelCont, state=uiconst.UI_HIDDEN) self.skinsPanel = SkinsPanel(parent=self.panelCont, state=uiconst.UI_HIDDEN, padding=(0, 4, 0, 4)) self.bioPanel = BioPanel(parent=self.panelCont, state=uiconst.UI_HIDDEN) self.implantsBoostersPanel = ImplantsBoostersPanel( parent=self.panelCont, state=uiconst.UI_HIDDEN) self.standingsPanel = StandingsPanel(parent=self.panelCont, state=uiconst.UI_HIDDEN) self.securityStatusPanel = SecurityStatusPanel(parent=self.panelCont, state=uiconst.UI_HIDDEN) self.skillsPanel = SkillsPanel(parent=self.panelCont, state=uiconst.UI_HIDDEN, padTop=2) self.combatLogPanel = CombatLogPanel(parent=self.panelCont, state=uiconst.UI_HIDDEN) self.ConstructHeader() self.ConstructPanelSelectScroll() if panelID: self.LoadPanel(panelID) else: self.LoadDefaultPanel() self._CheckShowT3ShipLossMessage() def LoadDefaultPanel(self): self.panelSelectScroll.SetSelected( min( len(TABS) - 1, settings.char.ui.Get('charactersheetselection', 0))) def ConstructDivider(self): divider = Divider(name='divider', align=uiconst.TOLEFT, width=const.defaultPadding - 1, parent=self.mainCont, state=uiconst.UI_NORMAL) divider.Startup(self.leftCont, 'width', 'x', 84, 220) self.sr.divider = divider def ConstructHeader(self): if self.loadingHeader: return self.loadingHeader = True self.topCont.Flush() characterName = cfg.eveowners.Get(session.charid).name if not getattr(self, 'charMgr', None): self.charMgr = sm.RemoteSvc('charMgr') if not getattr(self, 'cc', None): self.charsvc = sm.GetService('cc') self.sr.charinfo = charinfo = self.charMgr.GetPublicInfo( session.charid) if settings.user.ui.Get('charsheetExpanded', 1): parent = self.topCont self.sr.picParent = Container(name='picpar', parent=parent, align=uiconst.TOPLEFT, width=200, height=200, left=const.defaultPadding, top=16) self.sr.pic = Sprite(parent=self.sr.picParent, align=uiconst.TOALL, left=1, top=1, height=1, width=1) self.sr.pic.OnClick = self.OpenPortraitWnd self.sr.pic.cursor = uiconst.UICURSOR_MAGNIFIER uicontrols.Frame(parent=self.sr.picParent, opacity=0.2) sm.GetService('photo').GetPortrait(session.charid, 256, self.sr.pic) infoTextPadding = self.sr.picParent.width + const.defaultPadding * 4 characterLink = GetByLabel( 'UI/Contracts/ContractsWindow/ShowInfoLink', showInfoName=characterName, info=('showinfo', const.typeCharacterAmarr, session.charid)) self.sr.nameText = uicontrols.EveCaptionMedium( text=characterLink, parent=self.topCont, left=infoTextPadding, top=12, state=uiconst.UI_NORMAL) self.sr.raceinfo = raceinfo = cfg.races.Get(charinfo.raceID) self.sr.bloodlineinfo = bloodlineinfo = cfg.bloodlines.Get( charinfo.bloodlineID) self.sr.schoolinfo = schoolinfo = self.charsvc.GetData( 'schools', ['schoolID', charinfo.schoolID]) self.sr.ancestryinfo = ancestryinfo = self.charsvc.GetData( 'ancestries', ['ancestryID', charinfo.ancestryID]) if self.destroyed: self.loadingHeader = False return securityStatus = sm.GetService( 'crimewatchSvc').GetMySecurityStatus() roundedSecurityStatus = localization.formatters.FormatNumeric( securityStatus, decimalPlaces=1) cloneLocationRow = sm.RemoteSvc('charMgr').GetHomeStationRow() if cloneLocationRow: stationID = cloneLocationRow.stationID cloneLocationSystemID = cloneLocationRow.solarSystemID if cloneLocationSystemID: labelPath = 'UI/CharacterSheet/CharacterSheetWindow/CloneLocationHint' cloneLocationHint = GetByLabel( labelPath, locationId=stationID, systemId=cloneLocationSystemID) cloneLocation = cfg.evelocations.Get( cloneLocationSystemID).name else: cloneLocationHint = cfg.evelocations.Get(stationID).name cloneLocation = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/UnknownSystem') else: cloneLocation = GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/UnknownSystem') cloneLocationHint = '' alliance = '' if session.allianceid: cfg.eveowners.Prime([session.allianceid]) alliance = (GetByLabel('UI/Common/Alliance'), cfg.eveowners.Get(session.allianceid).name, '') faction = '' if session.warfactionid: fac = sm.StartService('facwar').GetFactionalWarStatus() faction = (GetByLabel('UI/Common/Militia'), cfg.eveowners.Get(fac.factionID).name, '') bounty = '' bountyOwnerIDs = (session.charid, session.corpid, session.allianceid) bountyAmount = sm.GetService('bountySvc').GetBounty( *bountyOwnerIDs) bountyAmounts = sm.GetService('bountySvc').GetBounties( *bountyOwnerIDs) charBounty = 0 corpBounty = 0 allianceBounty = 0 if len(bountyAmounts): for ownerID, value in bountyAmounts.iteritems(): if util.IsCharacter(ownerID): charBounty = value elif util.IsCorporation(ownerID): corpBounty = value elif util.IsAlliance(ownerID): allianceBounty = value bountyHint = GetByLabel('UI/Station/BountyOffice/BountyHint', charBounty=util.FmtISK(charBounty, 0), corpBounty=util.FmtISK(corpBounty, 0), allianceBounty=util.FmtISK( allianceBounty, 0)) bounty = (GetByLabel('UI/Station/BountyOffice/Bounty'), util.FmtISK(bountyAmount, 0), bountyHint) skillPoints = int(sm.GetService('skills').GetSkillPoints()) textList = [ (GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SkillPoints'), localization.formatters.FormatNumeric(skillPoints, useGrouping=True), ''), (GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/HomeSystem'), cloneLocation, cloneLocationHint), (GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/CharacterBackground' ), GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/CharacterBackgroundInformation', raceName=localization.GetByMessageID(raceinfo.raceNameID), bloodlineName=localization.GetByMessageID( bloodlineinfo.bloodlineNameID), ancestryName=localization.GetByMessageID( ancestryinfo.ancestryNameID)), GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/CharacterBackgroundHint' )), (GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/DateOfBirth'), localization.formatters.FormatDateTime( charinfo.createDateTime, dateFormat='long', timeFormat='long'), ''), (GetByLabel('UI/CharacterSheet/CharacterSheetWindow/School'), localization.GetByMessageID(schoolinfo.schoolNameID), ''), (GetByLabel('UI/Common/Corporation'), cfg.eveowners.Get(session.corpid).name, ''), (GetByLabel( 'UI/CharacterSheet/CharacterSheetWindow/SecurityStatus'), roundedSecurityStatus, localization.formatters.FormatNumeric(securityStatus, decimalPlaces=4)) ] if faction: textList.insert(len(textList) - 1, faction) if alliance: textList.insert(len(textList) - 1, alliance) if bounty: textList.insert(len(textList), bounty) numLines = len(textList) + 2 mtext = 'Xg<br>' * numLines mtext = mtext[:-4] th = GetTextHeight(mtext) topParentHeight = max(220, th + const.defaultPadding * 2 + 2) top = max(34, self.sr.nameText.top + self.sr.nameText.height) leftContainer = Container(parent=self.topCont, left=infoTextPadding, top=top, align=uiconst.TOPLEFT) rightContainer = Container(parent=self.topCont, top=top, align=uiconst.TOPLEFT) subTop = 0 for label, value, hint in textList: label = uicontrols.EveLabelMedium(text=label, parent=leftContainer, idx=0, state=uiconst.UI_NORMAL, align=uiconst.TOPLEFT, top=subTop) label.hint = hint label._tabMargin = 0 display = uicontrols.EveLabelMedium(text=value, parent=rightContainer, idx=0, state=uiconst.UI_NORMAL, align=uiconst.TOPLEFT, top=subTop) display.hint = hint display._tabMargin = 0 subTop += label.height leftContainer.AutoFitToContent() rightContainer.left = leftContainer.left + leftContainer.width + 20 rightContainer.AutoFitToContent() self.topCont.EnableAutoSize() else: self.topCont.DisableAutoSize() self.topCont.height = 18 charsheetExpanded = settings.user.ui.Get('charsheetExpanded', 1) if not charsheetExpanded: uicontrols.EveLabelMedium(text=characterName, parent=self.topCont, left=8, top=1, state=uiconst.UI_DISABLED) expandOptions = [ GetByLabel('UI/CharacterSheet/CharacterSheetWindow/Expand'), GetByLabel('UI/CharacterSheet/CharacterSheetWindow/Collapse') ] a = uicontrols.EveLabelSmall(text=expandOptions[charsheetExpanded], parent=self.topCont, left=15, top=3, state=uiconst.UI_NORMAL, align=uiconst.TOPRIGHT, bold=True) a.OnClick = self.ToggleGeneral expander = Sprite(parent=self.topCont, pos=(3, 2, 11, 11), name='expandericon', state=uiconst.UI_NORMAL, texturePath=[ 'res:/UI/Texture/Shared/expanderDown.png', 'res:/UI/Texture/Shared/expanderUp.png' ][charsheetExpanded], align=uiconst.TOPRIGHT) expander.OnClick = self.ToggleGeneral self.loadingHeader = False def LoadPanel(self, panelID): for entry in self.panelSelectScroll.GetNodes(): if entry.key == panelID: self.panelSelectScroll.SelectNode(entry) return def OnSelectEntry(self, node): if node != []: self._LoadPanel(node[0].key) settings.char.ui.Set('charactersheetselection', node[0].idx) def _LoadPanel(self, panelID, subPanelID=None): if self.loading or self.GetPanelByID(panelID) == self.currPanel: return self.loading = True try: if self.currPanel: self.currPanel.Hide() if hasattr(self.currPanel, 'UnloadPanel'): self.currPanel.UnloadPanel() self.currPanel = self.GetPanelByID(panelID) self.currPanel.state = uiconst.UI_PICKCHILDREN self.currPanel.LoadPanel() finally: self.loading = False def GetPanelByID(self, panelID): if panelID == PANEL_STANDINGS: return self.standingsPanel if panelID == PANEL_SKILLS: return self.skillsPanel if panelID == PANEL_DECORATIONS: return self.decorationsPanel if panelID == PANEL_COMBATLOG: return self.combatLogPanel if panelID == PANEL_ATTRIBUTES: return self.attributesPanel if panelID == PANEL_IMPLANTSBOOTERS: return self.implantsBoostersPanel if panelID == PANEL_BIO: return self.bioPanel if panelID == PANEL_SECURITYSTATUS: return self.securityStatusPanel if panelID == PANEL_KILLRIGHTS: return self.killRightsPanel if panelID == PANEL_JUMPCLONES: return self.jumpClonesPanel if panelID == PANEL_EMPLOYMENT: return self.employmentHistoryPanel if panelID == PANEL_PLEX: return self.plexPanel if panelID == PANEL_SHIPSKINS: return self.skinsPanel def GetActivePanel(self): return self.currPanel def HideAllPanels(self): for panel in self.panelCont.children: panel.Hide() def OpenPortraitWnd(self, *args): PortraitWindow.CloseIfOpen() PortraitWindow.Open(charID=session.charid) def ToggleGeneral(self, *args): charsheetExpanded = not settings.user.ui.Get('charsheetExpanded', 1) settings.user.ui.Set('charsheetExpanded', charsheetExpanded) self.ConstructHeader() def ConstructPanelSelectScroll(self): scrolllist = [] for label, icon, key, UIName, descriptionLabelPath in TABS: data = util.KeyVal() label = GetByLabel(label) data.text = label data.label = label data.icon = icon data.key = key data.hint = label data.name = UIName data.line = False data.labeloffset = 4 data.tooltipPanelClassInfo = TooltipHeaderDescriptionWrapper( header=label, description=GetByLabel(descriptionLabelPath), tooltipPointer=uiconst.POINT_RIGHT_2) scrolllist.append(listentry.Get('IconEntry', data=data)) self.panelSelectScroll.Load(contentList=scrolllist) def GetSelected(self): return self.panelSelectScroll.GetSelected() def DeselectAll(self): self.panelSelectScroll.DeselectAll() def SetSelected(self, idx): self.panelSelectScroll.SetSelected(idx) @telemetry.ZONE_METHOD def _CheckShowT3ShipLossMessage(self): lossMessages = sm.StartService('skills').GetRecentLossMessages() for messageTuple in lossMessages: messageType, messageDict = messageTuple uicore.Message(messageType, messageDict) if len(lossMessages): sm.GetService('skills').ResetSkillHistory() def Close(self, *args, **kwds): settings.user.ui.Set('charsheetleftwidth', self.leftCont.width) uicontrols.Window.Close(self, *args, **kwds) def OnGodmaItemChange(self, item, change): self.ConstructHeader() def OnSkillsChanged(self, *args): self.ConstructHeader() @classmethod def OpenCertificates(cls): panelID = PANEL_SKILLS_CERTIFICATES wnd = cls._OpenSkillSubPanel(panelID) return wnd @classmethod def _OpenSkillSubPanel(cls, panelID): wnd = cls.GetIfOpen() if wnd: wnd.LoadPanel(PANEL_SKILLS) else: wnd = cls.Open(panelID=PANEL_SKILLS) uthread.new(wnd.GetPanelByID(PANEL_SKILLS).SelectTab, panelID) return wnd @classmethod def OpenSkills(cls): panelID = PANEL_SKILLS_SKILLS wnd = cls._OpenSkillSubPanel(panelID) return wnd @classmethod def OpenSkillHistory(cls): panelID = PANEL_SKILLS_HISTORY wnd = cls._OpenSkillSubPanel(panelID) return wnd @classmethod def OpenSkillHistoryHilightSkills(cls, skillIDs): uthread.new(cls._HighlightSkillHistorySkills, skillTypeIds=skillIDs) @classmethod def _HighlightSkillHistorySkills(cls, skillTypeIds): wnd = cls.OpenSkillHistory() wnd.GetPanelByID(PANEL_SKILLS).HighlightSkillHistorySkills( skillTypeIds) def DeselectAllNodes(self, wnd): for node in wnd.sr.scroll.GetNodes(): wnd.sr.scroll._DeselectNode(node)
class TreeViewEntry(ContainerAutoSize): default_name = 'TreeViewEntry' default_align = uiconst.TOTOP default_state = uiconst.UI_NORMAL default_settingsID = '' LEFTPUSH = 10 default_height = 22 isDragObject = True noAccessColor = (0.33, 0.33, 0.33, 1.0) iconColor = util.Color.WHITE @telemetry.ZONE_METHOD 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()) def GetSpacerContWidth(self): return (1 + self.level) * self.LEFTPUSH + 8 def Close(self): try: if self.eventListener and hasattr(self.eventListener, 'UnregisterID'): self.eventListener.UnregisterID(self.data.GetID()) if self.parentEntry and self.data in self.parentEntry.data._children: self.parentEntry.data._children.remove(self.data) finally: ContainerAutoSize.Close(self) @telemetry.ZONE_METHOD def ConstructChildren(self): self.childrenInitialized = True children = self.data.GetChildren() if self.destroyed: return if self.childCont is None: self.childCont = ContainerAutoSize(parent=self, name='childCont', align=uiconst.TOTOP, clipChildren=True, state=uiconst.UI_HIDDEN) if children: for child in children: cls = self.GetTreeViewEntryClassByTreeData(child) child = cls(parent=self.childCont, parentEntry=self, level=self.level + 1, eventListener=self.eventListener, data=child, settingsID=self.settingsID, state=uiconst.UI_HIDDEN) child.UpdateLabel() if self.childCont.children: self.childCont.children[-1].padBottom = 5 self.toggleBtn.state = uiconst.UI_NORMAL def GetTreeViewEntryClassByTreeData(self, treeData): """ Can be overridden to return custom tree view entry classes """ return TreeViewEntry def ShowChildCont(self, show=True, animate=True): if self.childCont is None or self.childCont.display == show or not self.data.HasChildren( ): return for child in self.childCont.children: child.display = show self.isToggling = True if animate: if show: self.childCont.display = True uicore.animations.Tr2DRotateTo(self.toggleBtnSprite, pi / 2, 0.0, duration=0.15) self.childCont.DisableAutoSize() _, height = self.childCont.GetAutoSize() uicore.animations.FadeIn(self.childCont, duration=0.3) uicore.animations.MorphScalar(self.childCont, 'height', self.childCont.height, height, duration=0.15, sleep=True) self.childCont.EnableAutoSize() else: uicore.animations.Tr2DRotateTo(self.toggleBtnSprite, 0.0, pi / 2, duration=0.15) self.childCont.DisableAutoSize() uicore.animations.FadeOut(self.childCont, duration=0.15) uicore.animations.MorphScalar(self.childCont, 'height', self.childCont.height, 0, duration=0.15, sleep=True) self.childCont.display = False self.toggleBtn.Enable() else: self.childCont.display = show if show: self.toggleBtnSprite.rotation = 0.0 self.childCont.opacity = 1.0 else: self.toggleBtnSprite.rotation = pi / 2 self.childCont.DisableAutoSize() self.childCont.opacity = 0.0 self.isToggling = False def UpdateSelectedState(self, selectedIDs): invID = self.data.GetID() isSelected = selectedIDs[-1] == invID isChildSelected = not isSelected and invID in selectedIDs self.SetSelected(isSelected, isChildSelected) def SetSelected(self, isSelected, isChildSelected=False): self.isSelected = isSelected if isSelected or self.selectedBG: self.CheckConstructSelectedBG() self.selectedBG.display = isSelected self.UpdateLabel() if isChildSelected: if not self.childSelectedBG: self.childSelectedBG = GradientThemeColored( bgParent=self.spacerCont, rotation=0, alphaData=[(0, 0.5), (1.0, 0.0)], padBottom=1, colorType=uiconst.COLORTYPE_UIHILIGHT) else: self.childSelectedBG.Show() elif self.childSelectedBG: self.childSelectedBG.Hide() if isSelected and self.parentEntry: self.parentEntry.ExpandFromRoot() @telemetry.ZONE_METHOD def UpdateLabel(self): if self.isSelected and self.canAccess: self.label.color = util.Color.WHITE elif self.canAccess: self.label.color = Label.default_color else: self.label.color = self.noAccessColor if session.role & (service.ROLE_GML | service.ROLE_WORLDMOD): if settings.user.ui.Get('invPrimingDebugMode', False) and hasattr( self.data, 'invController') and self.data.invController.IsPrimed(): self.label.color = util.Color.RED def ExpandFromRoot(self): """ Make sure a selected item is visible in the tree """ self.ToggleChildren(forceShow=True) if self.parentEntry: self.parentEntry.ExpandFromRoot() def OnClick(self, *args): if self.eventListener and hasattr(self.eventListener, 'OnTreeViewClick'): self.eventListener.OnTreeViewClick(self, *args) def OnDblClick(self, *args): if self.eventListener and hasattr(self.eventListener, 'OnTreeViewDblClick'): self.eventListener.OnTreeViewDblClick(self, *args) def OnToggleBtnClick(self, *args): if not self.isToggling: self.ToggleChildren() def ToggleChildren(self, forceShow=False): show = forceShow or self.childCont is None or not self.childCont.display toggleSettingsDict = settings.user.ui.Get( 'invTreeViewEntryToggle_%s' % self.settingsID, {}) toggleSettingsDict[self.data.GetID()] = show settings.user.ui.Set('invTreeViewEntryToggle_%s' % self.settingsID, toggleSettingsDict) if not self.data.HasChildren(): return if not self.childrenInitialized: self.ConstructChildren() self.ShowChildCont(show) def GetMenu(self): m = self.data.GetMenu() if session.role & service.ROLE_PROGRAMMER: idString = repr(self.data.GetID()) m.append((idString, blue.pyos.SetClipboardData, (idString, ))) if self.data.IsRemovable(): m.append(None) m.append((localization.GetByLabel('UI/Common/Buttons/Close'), self.Remove, ())) return m def GetHint(self): return self.data.GetHint() def GetFullPathLabelList(self): labelTuple = [self.data.GetLabel()] if self.parentEntry: labelTuple = self.parentEntry.GetFullPathLabelList() + labelTuple return labelTuple def Remove(self, *args): self.eventListener.RemoveTreeEntry(self, byUser=True) def OnMouseDown(self, *args): if self.eventListener and hasattr(self.eventListener, 'OnTreeViewMouseDown'): self.eventListener.OnTreeViewMouseDown(self, *args) def OnMouseUp(self, *args): if self.eventListener and hasattr(self.eventListener, 'OnTreeViewMouseUp'): self.eventListener.OnTreeViewMouseUp(self, *args) def CheckConstructHoverBG(self): if self.hoverBG is None: self.hoverBG = ListEntryUnderlay(bgParent=self.topRightCont) def CheckConstructSelectedBG(self): if self.selectedBG is None: self.selectedBG = FillThemeColored( bgParent=self.topRightCont, colorType=uiconst.COLORTYPE_UIHILIGHT, state=uiconst.UI_HIDDEN, opacity=0.5) def CheckConstructBlinkBG(self): if self.blinkBG is None: self.blinkBG = Fill(bgParent=self.topRightCont, color=(1.0, 1.0, 1.0, 0.0)) def OnMouseEnter(self, *args): self.CheckConstructHoverBG() self.hoverBG.ShowHilite() if self.eventListener and hasattr(self.eventListener, 'OnTreeViewMouseEnter'): self.eventListener.OnTreeViewMouseEnter(self, *args) def OnMouseExit(self, *args): self.CheckConstructHoverBG() self.hoverBG.HideHilite() if self.eventListener and hasattr(self.eventListener, 'OnTreeViewMouseExit'): self.eventListener.OnTreeViewMouseExit(self, *args) def OnDropData(self, *args): if self.eventListener and hasattr(self.eventListener, 'OnTreeViewDropData'): self.eventListener.OnTreeViewDropData(self, *args) def OnDragEnter(self, dragObj, nodes): self.CheckConstructHoverBG() self.hoverBG.ShowHilite() if self.eventListener and hasattr(self.eventListener, 'OnTreeViewDragEnter'): self.eventListener.OnTreeViewDragEnter(self, dragObj, nodes) def GetDragData(self): if self.data.IsDraggable(): self.eventListener.OnTreeViewGetDragData(self) return [self.data] def OnDragExit(self, *args): self.CheckConstructHoverBG() self.hoverBG.HideHilite() if self.eventListener and hasattr(self.eventListener, 'OnTreeViewDragExit'): self.eventListener.OnTreeViewDragExit(self, *args) def Blink(self): self.CheckConstructBlinkBG() uicore.animations.FadeTo(self.blinkBG, 0.0, 0.25, duration=0.25, curveType=uiconst.ANIM_WAVE, loops=2) @telemetry.ZONE_METHOD def SetAccessability(self, canAccess): self.canAccess = canAccess if self.icon: self.icon.color = self.iconColor if canAccess else util.Color( *self.iconColor).SetAlpha(0.5).GetRGBA() self.UpdateLabel()
class QuestEntry(ContainerAutoSize): default_alignMode = uiconst.TOTOP default_clipChildren = False default_state = uiconst.UI_NORMAL default_padTop = 4 def ApplyAttributes(self, attributes): super(QuestEntry, self).ApplyAttributes(attributes) self.quest = attributes.quest self.isCompleteMode = self.quest.isComplete self._updateThread = None self.details = None self.Layout() self.UpdateQuest() if self.isCompleteMode: self.ShowCompleted() else: self.ShowDetails() def Layout(self): Fill(bgParent=self, color=(0, 0, 0, 0.2)) BlurredBackgroundSprite(bgParent=self, color=(1, 1, 1, 0.9)) headerContainer = ContainerAutoSize(parent=self, align=uiconst.TOTOP, alignMode=uiconst.TOPLEFT) self.completedFill = FillThemeColored( bgParent=headerContainer, colorType=uiconst.COLORTYPE_UIHILIGHT, opacity=0.0) self.headerFill = InfoPanelHeaderBackground(bgParent=headerContainer) headerGrid = LayoutGrid(parent=headerContainer) if self.quest.isComplete: texturePath = RES_COMPLETED else: texturePath = RES_AVAILABLE self.check = Sprite(align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, texturePath=texturePath, width=14, height=14) headerGrid.AddCell(self.check, cellPadding=(4, 3, 4, 3)) headerGrid.AddCell(EveLabelMedium(align=uiconst.TOPLEFT, text=self.quest.titleLabel), cellPadding=(0, 2, 0, 2)) self.timer = EveLabelMedium(parent=headerContainer, align=uiconst.CENTERRIGHT, state=uiconst.UI_DISABLED, left=4, opacity=0.0) def ShowCompleted(self): self.check.SetTexturePath(RES_COMPLETED) self.completedFill.opacity = 0.5 self.timer.opacity = 0.6 self.timer.state = uiconst.UI_NORMAL def UpdateQuest(self, quest=None): if quest is None: quest = self.quest if self.quest.id != quest.id: return self.quest = quest if not self.isCompleteMode and self.quest.isComplete: self.isCompleteMode = True self.AnimComplete() self.timer.state = uiconst.UI_NORMAL elif self.isCompleteMode and not self.quest.isComplete: self.isCompleteMode = False self.AnimAvailable() self.timer.state = uiconst.UI_DISABLED if self.isCompleteMode: if not self._updateThread: self._updateThread = uthread.new(self._UpdateThread) self.timer.text = self.quest.nextAvailableShortLabel self.timer.hint = self.quest.nextAvailableLabel def AnimComplete(self): self.check.SetTexturePath(RES_COMPLETED) animations.BlinkIn(self.check) animations.MorphScalar(self.completedFill, 'displayWidth', startVal=0.0, endVal=self.displayWidth) animations.FadeTo(self.completedFill, startVal=1.5, endVal=0.5, duration=1.5, timeOffset=0.5) animations.FadeIn(self.timer, endVal=0.6, timeOffset=0.5) def AnimAvailable(self): self.check.SetTexturePath(RES_AVAILABLE) animations.BlinkIn(self.check) animations.FadeTo(self.completedFill, startVal=self.completedFill.opacity, endVal=0.0) animations.FadeOut(self.timer, duration=0.3) def OnClick(self, *args): self.ToggleDetails() def ToggleDetails(self): if self.details and not self.details.destroyed: self.HideDetails() else: self.ShowDetails() def HideDetails(self): if not self.details or self.details.destroyed: return details = self.details self.details = None details.DisableAutoSize() animations.FadeOut(details, duration=0.15) animations.MorphScalar(details, 'height', startVal=details.height, endVal=0, duration=0.15, callback=details.Close) def ShowDetails(self): if self.details: return def thread(): self.details = ContainerAutoSize(parent=self, align=uiconst.TOTOP, clipChildren=True) self.details.DisableAutoSize() EveLabelMedium(parent=self.details, align=uiconst.TOTOP, padding=(6, 3, 6, 2), text=self.quest.descriptionLabel) EveLabelMedium( parent=self.details, align=uiconst.TOTOP, padding=(6, 3, 6, 2), text=localization.GetByLabel('UI/Quest/RewardTitle')) EveLabelMedium(parent=self.details, align=uiconst.TOTOP, padding=(12, 6, 6, 12), text=self.quest.rewardLabel) _, height = self.details.GetAutoSize() animations.FadeIn(self.details, duration=0.3) animations.MorphScalar(self.details, 'height', startVal=self.details.height, endVal=height, duration=0.25, callback=self.details.EnableAutoSize) uthread.new(thread) def OnMouseEnter(self, *args): animations.FadeTo(self.headerFill.colorFill, startVal=self.headerFill.colorFill.opacity, endVal=0.3, curveType=uiconst.ANIM_OVERSHOT3, duration=0.5) def OnMouseExit(self, *args): animations.FadeTo(self.headerFill.colorFill, startVal=self.headerFill.colorFill.opacity, endVal=0.15, duration=0.1) def _UpdateThread(self): while self and not self.destroyed and self.isCompleteMode: self.UpdateQuest() blue.pyos.synchro.SleepWallclock(1000) self._updateThread = None
class AssetSafetyDeliverWindow(Window): __guid__ = 'form.AssetSafetyDeliverWindow' default_width = 600 default_height = 100 default_windowID = 'AssetSafetyDeliverWindow' default_topParentHeight = 0 default_clipChildren = True default_isPinable = False LINE_COLOR = (1, 1, 1, 0.2) BLUE_COLOR = (0.0, 0.54, 0.8, 1.0) GREEN_COLOR = (0.0, 1.0, 0.0, 0.8) GRAY_COLOR = Color.GRAY5 PADDING = 15 def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.solarSystemID = attributes.solarSystemID self.assetWrapID = attributes.assetWrapID self.nearestNPCStationInfo = attributes.nearestNPCStationInfo self.autoDeliveryTimestamp = attributes.autoDeliveryTimestamp self.manualDeliveryTimestamp = attributes.manualDeliveryTimestamp self.Layout() uthread.new(self.ReloadContent) def Layout(self): self.MakeUnMinimizable() self.HideHeader() self.MakeUnResizeable() self.container = ContainerAutoSize(parent=self.GetMainArea(), align=uiconst.TOTOP, alignMode=uiconst.TOTOP, state=uiconst.UI_PICKCHILDREN, padding=(self.PADDING, self.PADDING, self.PADDING, self.PADDING), callback=self.OnContainerResized) text = GetByLabel('UI/Inventory/AssetSafety/DeliverToStation') header = EveLabelLargeBold(parent=self.container, align=uiconst.TOTOP, text=text) self.explanationLabel = EveLabelMedium(parent=self.container, align=uiconst.TOTOP, text='', color=self.GRAY_COLOR, padding=(0, 0, 0, 15), state=uiconst.UI_NORMAL) Line(parent=self.container, align=uiconst.TOTOP, color=self.LINE_COLOR) self.sameSolarSystemParent = ScrollContainer(parent=self.container, align=uiconst.TOTOP) self.sameSolarSystem = ContainerAutoSize(parent=self.sameSolarSystemParent, align=uiconst.TOTOP, alignMode=uiconst.TOTOP) self.nearestStationLabel = EveLabelMedium(parent=self.container, align=uiconst.TOTOP, text='', color=self.GRAY_COLOR, padding=(0, 0, 0, 0)) self.closeButton = Button(parent=self.container, label=GetByLabel('UI/Generic/Cancel'), func=self.Close, align=uiconst.TOTOP, fontsize=13, padding=(220, 10, 220, 0)) uicore.animations.FadeTo(self.container, startVal=0.0, endVal=1.0, duration=0.5) 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 OnContainerResized(self): self.width = self.default_width self.height = self.container.height + self.PADDING * 2 def ReloadContent(self): if self.destroyed: return self.sameSolarSystem.DisableAutoSize() self.sameSolarSystem.Flush() systemStations, nearestNPCStation = sm.RemoteSvc('structureAssetSafety').GetStructuresICanDeliverTo(self.solarSystemID) self.SetText(systemStations) if systemStations: stationIDs = [ station['itemID'] for station in systemStations ] cfg.evelocations.Prime(stationIDs) stations = [ s for s in systemStations if evetypes.GetCategoryID(s['typeID'] == const.categoryStation) ] sortedStations = GetSortedStationList(self.solarSystemID, systemStations) otherStructures = GetSortedStructures(self.solarSystemID, systemStations) buttonIsDisabled = self.manualDeliveryTimestamp - blue.os.GetWallclockTime() > 0 for each in otherStructures + sortedStations: self.AddStation(each, buttonIsDisabled) self.sameSolarSystem.EnableAutoSize() self.sameSolarSystemParent.height = min(MAX_STATIONCONT_HEIGHT, self.sameSolarSystem.height) 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 DoDeliver(self, *args): if eve.Message('SureYouWantToMoveAssetSafetyItemsToLocation', {}, uiconst.YESNO) != uiconst.ID_YES: return try: sm.RemoteSvc('structureAssetSafety').MoveSafetyWrapToStructure(self.assetWrapID, self.solarSystemID, destinationID=args[0]) finally: AssetSafetyDeliverWindow.CloseIfOpen() sm.GetService('objectCaching').InvalidateCachedMethodCall('structureAssetSafety', 'GetStructuresICanDeliverTo') sm.GetService('objectCaching').InvalidateCachedMethodCall('structureAssetSafety', 'GetItemsInSafety')