def _CreateBanners(self): globalConfig = sm.GetService('machoNet').GetGlobalConfig() self.bannerTargets = { PLEX_TARGET_KEY: globalConfig.get('newedenstore.banner_target.plex', PLEX_TARGET_DEFAULT_VALUE), AURUM_TARGET_KEY: globalConfig.get('newedenstore.banner_target.aurum', AURUM_TARGET_DEFAULT_VALUE) } self.banners = GetBanners(session.languageID, boot.region, BANNER_FEED_CHANNEL_ID) if not self.HasBanners(): self.display = False return self.currentBannerIndex = 0 self.buttons = {} self.selectedButton = None if len(self.banners) > 1: for index, (bannerImageUrl, action) in enumerate(self.banners): self.buttons[bannerImageUrl] = BannerButton( parent=self.buttonContainer, align=uiconst.TOLEFT, bannerReel=self, bannerIndex=index) self.transitionTimer = AutoTimer(TRANSITION_DELAY_AUTO, self._AdvanceToNextBanner) self._SetBanner(self.currentBannerIndex)
def OnMouseEnter(self, *args): uicore.animations.FadeTo(self.backgroundSprite, startVal=self.backgroundSprite.opacity, endVal=1.0, duration=0.2, curveType=uiconst.ANIM_OVERSHOT) self.moTimer = AutoTimer(10, self.CheckMouseOver) if not SLOT_SHOW_MOUSEOVER_INFO: self.mouseEnterDelay = AutoTimer(100, self.CheckMouseEnter)
def OnServiceSettingsChanged_thread(self): DELAY = 500 recentlyLoaded = gametime.GetTimeDiff(self.serviceChangedTimestamp, gametime.GetWallclockTimeNow()) / const.MSEC < DELAY if recentlyLoaded: self.serviceChangedTimer = AutoTimer(DELAY, self.DoUpdateScroll) else: self.DoUpdateScroll()
def OnMouseEnter(self, *args): activeGroupID = sm.GetService('achievementSvc').GetActiveAchievementGroupID() if activeGroupID == self.achievementGroupID: r, g, b, a = sm.GetService('uiColor').GetUIColor(uiconst.COLORTYPE_UIHILIGHT) uicore.animations.SpColorMorphTo(self.backgroundSprite, startColor=(r, g, b, 1.5), endColor=(r, g, b, 3.0), duration=0.1, curveType=uiconst.ANIM_OVERSHOT) else: uicore.animations.FadeTo(self.backgroundSprite, startVal=self.backgroundSprite.opacity, endVal=1.0, duration=0.1, curveType=uiconst.ANIM_OVERSHOT) self.moTimer = AutoTimer(10, self.CheckMouseOver) if not SLOT_SHOW_MOUSEOVER_INFO: self.mouseEnterDelay = AutoTimer(300, self.CheckMouseEnter)
def StartTimer(self, duration): if self.destroyed: return leftTimer, rightTimer = self._GetTimers() if leftTimer and rightTimer: durationInSec = duration / 1000 curveSet = animations.CreateCurveSet(useRealTime=False) if self.timeIncreases: curvePoints = ([0, math.pi], [0.5, 0], [1, 0]) else: curvePoints = ([0, 0], [0.5, -math.pi], [1, -math.pi]) animations.MorphScalar(rightTimer, 'rotationSecondary', duration=durationInSec, curveType=curvePoints, curveSet=curveSet) if self.timeIncreases: curvePoints = ([0, 0], [0.5, 0], [1, -math.pi]) else: curvePoints = ([0, math.pi], [0.5, math.pi], [1, 0]) animations.MorphScalar(leftTimer, 'rotationSecondary', duration=durationInSec, curveType=curvePoints, curveSet=curveSet) if self.blink: blinkIn = max(self.BLINK_MIN_DURATION, durationInSec - self.BLINK_MAX_DURATION) self.blinkTimer = AutoTimer(blinkIn * 1000, self._BlinkModule)
def OnAchievementTreeMouseOver(self, groupID): if self.loadedAchievementGroupID != groupID: self.LoadAchievementGroup(groupID) uicore.animations.FadeTo(self, startVal=self.opacity, endVal=1.0, duration=0.1) activeAchievementGroupID = sm.GetService('achievementSvc').GetActiveAchievementGroupID() if groupID != activeAchievementGroupID: self.resetToActiveTimer = AutoTimer(3000, self.ResetToActive)
def LoadTooltip(self): if not self.owner: return self.ownerGuid = self.owner.__guid__ if self.ownerGuid == 'xtriui.ModuleButton': self.moduleItemID = self.owner.moduleinfo.itemID else: self.moduleItemID = self.controller.GetModuleID() if not self.moduleItemID: return if self.ownerGuid == 'xtriui.FittingSlotGhost': self.dogmaLocation = sm.GetService( 'fittingSvc').GetCurrentDogmaLocation() else: self.dogmaLocation = sm.GetService( 'clientDogmaIM').GetDogmaLocation() self.moduleInfoItem = self.dogmaLocation.GetDogmaItem( self.moduleItemID) self.moduleGroupID = evetypes.GetGroupID(self.moduleInfoItem.typeID) self.numSlaves = self.GetNumberOfSlaves(self.moduleInfoItem, self.ownerGuid) if self.stateManager.GetDefaultEffect(self.moduleInfoItem.typeID): self.moduleShortcut = self.GetModuleShortcut(self.moduleInfoItem) else: self.moduleShortcut = None self.typeName = evetypes.GetName(self.moduleInfoItem.typeID) self.onHUDModuleButton = self.ownerGuid == 'xtriui.ModuleButton' self.UpdateToolTips() self._toolTooltipUpdateTimer = AutoTimer(1000, self.UpdateToolTips)
def BrowseNextLoop(self, *args): if self.autoLoadTimer: self.browseLoopButton.SetLabel('Browse next loop') self.autoLoadTimer = None else: self.browseLoopButton.SetLabel('Stop') self.autoLoadTimer = AutoTimer(1, self.AutoBrowse)
def UpdatePosition(self, fromWhere = None, loadNodes = True): if self.destroyed: return clipperWidth, clipperHeight = self.sr.clipper.GetAbsoluteSize() self.sr.content.top = int(-self._position) self.UpdateScrollHandle(clipperHeight, fromWhere='UpdatePosition') scrollPosition = self._position UI_HIDDEN = uiconst.UI_HIDDEN while self.visibleNodes: node = self.visibleNodes.pop() displayScrollEntry = node.panel if not displayScrollEntry: continue if displayScrollEntry.state != UI_HIDDEN: aboveVisible = node.positionFromTop + displayScrollEntry.height < scrollPosition belowVisible = scrollPosition + clipperHeight < node.positionFromTop if aboveVisible or belowVisible: if getattr(displayScrollEntry, '__notifyevents__', None) is not None: sm.UnregisterNotify(displayScrollEntry) displayScrollEntry.state = UI_HIDDEN positionFromTop = 0 for node in self.sr.nodes: nodeheight = node.height positionFromTop = node.positionFromTop displayScrollEntry = node.panel if scrollPosition > positionFromTop + nodeheight: continue belowVisible = scrollPosition + clipperHeight < positionFromTop if belowVisible: break if not displayScrollEntry: decoClass = node.decoClass displayScrollEntry = decoClass(parent=self.sr.content, align=uiconst.TOPLEFT, pos=(0, positionFromTop, clipperWidth, nodeheight), state=uiconst.UI_NORMAL, node=node) displayScrollEntry.sr.node = node node.panel = displayScrollEntry node.scroll = self.sr.selfProxy if hasattr(displayScrollEntry, 'Startup'): displayScrollEntry.Startup(self.sr.selfProxy) elif displayScrollEntry.display: self.visibleNodes.append(node) displayScrollEntry.top = positionFromTop displayScrollEntry.height = nodeheight continue self.visibleNodes.append(node) displayScrollEntry.state = uiconst.UI_NORMAL displayScrollEntry.top = positionFromTop displayScrollEntry.width = clipperWidth displayScrollEntry.height = nodeheight if loadNodes: displayScrollEntry.Load(node) if getattr(displayScrollEntry, '__notifyevents__', None) is not None: sm.RegisterNotify(displayScrollEntry) self.updatePositionThread = None if self.autoPurgeHiddenEntries: self.cleanupTimer = AutoTimer(1500, self.PurgeInvisibleEntries)
def _LoadDamageTooltip(self, tooltipPanel): tooltipPanel.LoadGeneric3ColumnTemplate() tooltipPanel.margin = (6, 4, 8, 4) for key, iconNo, labelText in (('Shield', 'res:/UI/Texture/Icons/1_64_13.png', GetByLabel('Tooltips/Hud/Shield')), ('Armor', 'res:/UI/Texture/Icons/1_64_9.png', GetByLabel('Tooltips/Hud/Armor')), ('Structure', 'res:/UI/Texture/Icons/2_64_12.png', GetByLabel('Tooltips/Hud/Structure'))): iconObj, labelObj, valueObj = tooltipPanel.AddIconLabelValue( iconNo, labelText, '', iconSize=36) valueObj.fontsize = 16 valueObj.bold = True valueObj.top = -2 labelObj.bold = False setattr(tooltipPanel, 'label' + key, labelObj) setattr(tooltipPanel, 'valueLabel' + key, valueObj) tooltipPanel.AddCell() f = Container(align=uiconst.TOPLEFT, width=100, height=1) tooltipPanel.AddCell(f, colSpan=2) self._UpdateDamageTooltip(tooltipPanel) self._damageTooltipUpdate = AutoTimer(10, self._UpdateDamageTooltip, tooltipPanel)
def ApplyAttributes(self, attributes): Container.ApplyAttributes(self, attributes) self.content = Container(parent=self, state=uiconst.UI_PICKCHILDREN, align=uiconst.TOALL) sm.RegisterNotify(self) if attributes.achievementGroupID: self.LoadAchievementGroup(attributes.achievementGroupID) self.mouseOverTimer = AutoTimer(10, self.MonitorMouseOver)
def ShowUtilButtons(self, *args): flagID = self.controller.GetFlagID() self.controller.parentController.SetSlotWithMenu(flagID) for button in self.utilButtons: button.SetBtnColorBasedOnIsActive() self.utilButtonsTimer = AutoTimer(500, self.HideUtilButtons)
def ApplyAttributes(self, attributes): Window.ApplyAttributes(self, attributes) self.MakeUnMinimizable() self.MakeUnpinable() self.MakeUnstackable() mainArea = self.GetMainArea() mainArea.clipChildren = True self.isFadingOut = False leftSide = Container(parent=mainArea, align=uiconst.TOLEFT, width=AURA_SIZE * 0.8) auraSprite = Sprite( parent=leftSide, texturePath='res:/UI/Texture/classes/achievements/auraAlpha.png', pos=(0, -4, AURA_SIZE, AURA_SIZE), align=uiconst.CENTERTOP) self.mainContent = ContainerAutoSize(parent=self.GetMainArea(), align=uiconst.TOTOP, alignMode=uiconst.TOTOP, padding=(0, 6, 10, 10)) self.opacity = 0.0 self.fadeoutState = FADE_STATE_OUT self.sizeTimer = AutoTimer(10, self.UpdateWindowSize) if not settings.char.ui.Get('opportunities_aura_introduced', False): settings.char.ui.Set('opportunities_aura_introduced', True) self.Step_Intro() elif attributes.loadAchievementTask: self.Step_TaskInfo_Manual(attributes.loadAchievementTask, attributes.loadAchievementGroup) else: self.UpdateOpportunityState()
def OnChange(self, *args): if self.adjustQtyAndPriceTimer: self.adjustQtyAndPriceTimer.KillTimer() self.adjustQtyAndPriceTimer = AutoTimer(200, self.AdjustQtyAndPrice_thread, *args) self.SetItemLoading()
def SetStatus(self, title, strng, portion=None, total=None, abortFunc=None, useMorph=1, autoTick=1): if self is None or self.destroyed: return 1 self.Prepare_ProgressBar_() self._SetCaption(title) self.SetAbortFunc(abortFunc) if len(strng) > 128: strng = strng[:128] + '...' self.Update_ProgressText_(strng) self.Update_ProgressBar_(portion, total, useMorph) self.Update_Height_() if portion is not None and total is not None: if portion >= total: self.sr.tickTimer = None self.stophide = 0 self.AutoDelayHideOnProgressComplete() else: if autoTick: self.sr.tickTimer = AutoTimer(75, self.Tick) else: self.sr.tickTimer = None self.stophide = 1 if self.parent and not self.parent.destroyed: self.parent.state = uiconst.UI_NORMAL return 0
def GetWndMenu(self): if uicore.registry.GetModalWindow(): return if not getattr( self, 'chooseWndMenu', None ) or self.chooseWndMenu.destroyed or self.chooseWndMenu.state == uiconst.UI_HIDDEN: ClearMenuLayer() wnds = [ each for each in uicore.registry.GetWindows() if not getattr(each, 'defaultExcludeFromWindowMenu', 0) ] showhide = uicore.layer.main.state == uiconst.UI_PICKCHILDREN m = [] for each in wnds: if not hasattr(each, 'Maximize'): continue if hasattr(each, 'GetCaption'): label = each.GetCaption() else: label = each.name m.append((label, each.Maximize)) if m: mv = menu.CreateMenuView(menu.CreateMenuFromList(m), None, None) mv.left, mv.top = (uicore.desktop.width - mv.width) // 2, ( uicore.desktop.height - mv.height) // 2 uicore.layer.menu.children.insert(0, mv) self.chooseWndMenu = mv self.wmTimer = AutoTimer(10, self._CheckWndMenu) else: self.chooseWndMenu = None return self.chooseWndMenu
def ShowSearchResult(self, result): searchResultMenu = None if self.searchResultMenu: searchResultMenu = self.searchResultMenu() if searchResultMenu and searchResultMenu.destroyed: searchResultMenu = None if not result: self.CloseResultMenu() return if not searchResultMenu: l, t, w, h = self.GetAbsolute() searchResultMenu = Container(name='resultMenuParent', parent=uicore.layer.utilmenu, pos=(l, t + h + 1, max(w, 200), 300), align=uiconst.TOPLEFT, opacity=0.0) searchResultMenu.searchScroll = Scroll(parent=searchResultMenu, align=uiconst.TOALL, padding=1) searchResultMenu.searchScroll.sr.underlay.opacity = 0.0 if self.OnSearchEntrySelected: searchResultMenu.searchScroll.OnSelectionChange = self.OnSelectionChanged MenuUnderlay(bgParent=searchResultMenu) self.searchResultMenu = weakref.ref(searchResultMenu) self.updateThread = AutoTimer(1, self.UpdateDropdownState) startHeight = 0 else: startHeight = searchResultMenu.height if self.scrollPosition and self.searchString == self.scrollPosition[0]: scrollTo = self.scrollPosition[1] else: scrollTo = 0.0 self.scrollTo = scrollTo searchResultMenu.searchScroll.LoadContent(contentList=result, scrollTo=scrollTo) visibleEntriesHeight = sum([ node.height for node in searchResultMenu.searchScroll.sr.nodes[:self.searchResultVisibleEntries] ]) endHeight = min(searchResultMenu.searchScroll.GetContentHeight(), visibleEntriesHeight) + 4 uicore.animations.MorphScalar(searchResultMenu, 'height', startVal=startHeight, endVal=endHeight, duration=0.25, callback=self.SetScrollPosition) uicore.animations.FadeTo(searchResultMenu, startVal=searchResultMenu.opacity, endVal=1.0, duration=0.5)
def OnMouseDown(self, button, *etc): if uicore.uilib.mouseTravel > 10: return if hasattr(self, 'RegisterFocus'): self.RegisterFocus(self) gettingFocus = uicore.registry.GetFocus() != self if gettingFocus: uicore.registry.SetFocus(self) leftClick = button == uiconst.MOUSELEFT if uicore.uilib.Key(uiconst.VK_SHIFT): if self.selFrom is None: self.selFrom = self.caretIndex self.selTo = self.caretIndex = self.GetIndexUnderCursor() self.RefreshCaretPosition() self.RefreshSelectionDisplay() self.RefreshTextClipper() elif leftClick: self.caretIndex = self.mouseDownCaretIndex = self.GetIndexUnderCursor() self.selFrom = None self.selTo = None self.RefreshCaretPosition() self.RefreshSelectionDisplay() self.RefreshTextClipper() if self.autoselect and gettingFocus: self.SelectAll() else: self.sr.selectionTimer = AutoTimer(50, self.UpdateSelection)
def OnMouseEnter(self, *args): uicore.Message('ContextMenuEnter') if self.sr.hilite is None: self.Prepare_Hilite_() self.sr.hilite.ShowHilite() self.expandTimer = AutoTimer(10, self.ExpandMenu) if self.triangle.display: self.triangle.OnMouseEnter()
def SetPasswordChar(self, char): SinglelineEditCore.SetPasswordChar(self, char) if self.passwordchar: self.capsWarning = TooltipGeneric(parent=uicore.layer.hint, idx=0, opacity=0.0) self.capsWarning.defaultPointer = uiconst.POINT_LEFT_2 self.capsLockUpdateThread = AutoTimer(1, self.UpdateCapsState) else: self.capsLockUpdateThread = None
def ShowCaret(self): self.GetCaret() self.RefreshCaretPosition() w, h = self.GetAbsoluteSize() self.sr.caret.height = h - 4 self.sr.caret.top = 2 self.sr.caret.state = uiconst.UI_DISABLED self.sr.caretTimer = AutoTimer(400, self.BlinkCaret)
def LoadTooltipPanel(self, tooltipPanel, *args): tooltipPanel.LoadGeneric3ColumnTemplate() tooltipPanel.AddLabelMedium(text=GetByLabel('Tooltips/Hud/HeatStatus'), bold=True, colSpan=tooltipPanel.columns) tooltipPanel.lowHeatValue = tooltipPanel.AddLabelMedium(align=uiconst.CENTERRIGHT, cellPadding=(0, 0, 14, 0), bold=True) tooltipPanel.mediumHeatValue = tooltipPanel.AddLabelMedium(align=uiconst.CENTERRIGHT, cellPadding=(0, 0, 14, 0), bold=True) tooltipPanel.highHeatValue = tooltipPanel.AddLabelMedium(align=uiconst.CENTERRIGHT, bold=True) self._UpdateHeatTooltip(tooltipPanel) self._heatTooltipUpdate = AutoTimer(10, self._UpdateHeatTooltip, tooltipPanel)
def OnMouseDown(self, button, *args): if button == uiconst.MOUSELEFT: self.StopAnimations() self.dragData = (self.left, self.top, uicore.uilib.x, uicore.uilib.y) self.dragThread = AutoTimer(1, self.PanUpdate)
def LoadTooltip(self): if not self.owner: return self.ability = self.controller.GetAbilityInfo() self.abilityNameID = self.ability.displayNameID self.abilityTooltipID = self.ability.tooltipTextID self.slotID = self.controller.slotID self.UpdateToolTips() self._toolTooltipUpdateTimer = AutoTimer(1000, self.UpdateToolTips)
def MonitorMouseOver(self): if self.destroyed: self.mouseOverTimer = None return if uicore.uilib.mouseOver.IsUnder(self): self.StopAnimations() self.opacity = 1.0 elif not self.resetToActiveTimer: self.resetToActiveTimer = AutoTimer(3000, self.ResetToActive)
def SetFolderVisibility(self, folderID, isVisible): logger.debug('Setting bookmark folder %s visibility to %s', folderID, isVisible) if isVisible: self.bookmarkFolderIdsHiddenFromSensorOverlay.discard(folderID) else: self.bookmarkFolderIdsHiddenFromSensorOverlay.add(folderID) self.persistVisibleFoldersTimer = AutoTimer(5000, self.PersistVisibleFolders)
def _CountRotations(self, curYaw): """ Count the number of full ship rotations that have occurred. fetch positive or negative from direction (float) fetch the yaw from the camera rotation quaternion """ spinDirection = mathCommon.GetLesserAngleBetweenYaws( self.prevYaw, curYaw) if spinDirection == 0.0: return if self.prevDirection is None: self.prevDirection = spinDirection if self.prevDirection * spinDirection < 0.0: self.prevYaw = self.startYaw = curYaw self.prevDirection = spinDirection caughtSpin = False if self.prevYaw < curYaw: caughtSpin = self.prevYaw < self.startYaw < curYaw and spinDirection > 0.0 elif self.prevYaw > curYaw: caughtSpin = self.prevYaw > self.startYaw > curYaw and spinDirection < 0.0 if caughtSpin: self.numSpins += 1 self.spinCounterLabel.text = util.FmtAmt(self.numSpins) self.spinCounterTimer = AutoTimer(30000, self.HideSpinCounter) if self.numSpins >= self.spinCounterLabel.startSpinCount + 10 and not self.spinCounterLabel.displayTriggered: self.spinCounterLabel.Show() uicore.animations.BlinkIn(self.spinCounterLabel, duration=0.5, endVal=0.6, loops=2) self.spinCounterLabel.displayTriggered = True elif self.numSpins % 1000 == 0 and self.spinCounterLabel.displayTriggered: uicore.animations.SpColorMorphTo(self.spinCounterLabel, startColor=(1.0, 1.0, 1.0, 0.6), endColor=(0.0, 1.0, 1.0, 1.0), duration=1.0, sleep=True) uicore.animations.SpColorMorphTo(self.spinCounterLabel, startColor=(0.0, 1.0, 1.0, 1.0), endColor=(1.0, 1.0, 1.0, 0.6), duration=1.0) elif self.numSpins % 100 == 0 and self.spinCounterLabel.displayTriggered: uicore.animations.SpColorMorphTo(self.spinCounterLabel, startColor=(1.0, 1.0, 1.0, 0.6), endColor=(1.0, 1.0, 1.0, 1.0), duration=0.75, sleep=True) uicore.animations.SpColorMorphTo(self.spinCounterLabel, startColor=(1.0, 1.0, 1.0, 1.0), endColor=(1.0, 1.0, 1.0, 0.6), duration=0.75) self.prevYaw = curYaw
def OnChallengeExpiredInClient(self, challengeID): if challengeID is None: return if not self._IsChallengeAlreadyShown(challengeID): self.challenge = self.seasonService.get_challenge(challengeID) self._ConstructPanel() self.challengeTaskEntry.expire_challenge() setattr( self, 'hideChallengeTimerThread', AutoTimer(HIDE_CHALLENGE_TIMEOUT, self._HideCompletedChallenge))
def OnMouseEnter(self, *args): uicore.Message('ContextMenuEnter') for each in self.parent.children: if each.sr.hilite: each.sr.hilite.Close() each.sr.hilite = None if self.sr.hilite is None: self.Prepare_Hilite_() self.expandTimer = AutoTimer(10, self.ExpandMenu)
def OnMouseEnter(self, *args): if not self.callback: self.opacity = DISABLED_OPACITY else: self.opacity = MOUSEOVER_OPACITY uicore.Message('ListEntryEnter') if not self._hiliteSprite: self._hiliteSprite = SpriteThemeColored(parent=self, name='hiliteSprite', texturePath='res:/UI/Texture/classes/UtilMenu/entryHilite.png', opacity=0.0, padding=(1, 0, 1, 0), align=uiconst.TOALL, state=uiconst.UI_DISABLED) uicore.animations.FadeIn(self._hiliteSprite, 0.2, duration=uiconst.TIME_ENTRY) self.hiliteTimer = AutoTimer(1, self._CheckIfStillHilited)