def UpdatePosition(self): cameraOffset = sm.GetService('sceneManager').GetCameraOffset() halfWidth = uicore.desktop.width / 2 baseOffset = -cameraOffset * halfWidth wndLeft = settings.char.windows.Get('shipuialignleftoffset', 0) maxRight, minLeft = self.GetShipuiOffsetMinMax() self.hudContainer.left = min(maxRight, max(minLeft, baseOffset + wndLeft)) self.ewarCont.left = self.hudContainer.left if IsShipHudTopAligned(): self.hudContainer.SetAlign(uiconst.CENTERTOP) self.ewarCont.SetAlign(uiconst.CENTERTOP) self.sr.indicationContainer.top = self.hudContainer.height + self.ewarCont.height else: self.hudContainer.SetAlign(uiconst.CENTERBOTTOM) self.ewarCont.SetAlign(uiconst.CENTERBOTTOM) self.sr.indicationContainer.top = -(self.ewarCont.height + self.sr.indicationContainer.height) if self.IsFightersDetached(): left, top = settings.char.ui.Get('fightersDetachedPosition', (0, 0)) buttonWidth = 32 left = min(left, uicore.desktop.width - buttonWidth) top = min(top, uicore.desktop.height - self.fighterCont.height) self.fighterCont.left = left self.fighterCont.top = top settings.char.ui.Set('fightersDetachedPosition', (left, top)) self.AlignFighters() self.sr.shipAlertContainer.UpdatePosition()
def GetTooltipPosition(self): left, top, width, height = self.GetAbsolute() left += width / 2 if IsShipHudTopAligned(): top += height - 7 else: top += 9 return (left, top, 0, 0)
def AlignFighters(self): if self.IsFightersDetached(): self.fighterCont.SetAlign(uiconst.TOPLEFT) elif IsShipHudTopAligned(): self.fighterCont.SetAlign(uiconst.TOTOP) else: self.fighterCont.SetAlign(uiconst.TOBOTTOM) self.fighterCont.top = 10
def GetDefaultAlignmentValues(self, *args): offset = sm.GetService('window').GetCameraLeftOffset( 300, align=uiconst.CENTERTOP, left=0) if IsShipHudTopAligned(): top = uicore.desktop.height * 0.7 else: top = max(uicore.desktop.height * 0.32, 225) defaultConfig = (uiconst.CENTERTOP, uiconst.CENTERBOTTOM, offset, top) return defaultConfig
def ToggleAlign(self): SetShipHudTopAligned(not IsShipHudTopAligned()) self.UpdatePosition() for each in uicore.layer.abovemain.children[:]: if each.name == 'message': each.Close() break msg = getattr(uicore.layer.target, 'message', None) if msg: msg.Close()
def UpdatePosition(self): if self.parent is None: return self.height = uicore.desktop.height - self.parent.height self.width = self.parent.width self.top = self.parent.height self.labelCont.height = self.height self.alignedTop = IsShipHudTopAligned() if not self.alignedTop: self.align = uiconst.CENTERBOTTOM self.warningLabelCont.align = uiconst.TOBOTTOM self.exceptionLabel.align = uiconst.TOBOTTOM else: self.align = uiconst.CENTERTOP self.warningLabelCont.align = uiconst.TOTOP self.exceptionLabel.align = uiconst.TOTOP
def GetHUDOptionMenu(self, menuParent): showPassive = settings.user.ui.Get('showPassiveModules', 1) text = GetByLabel('UI/Inflight/HUDOptions/DisplayPassiveModules') menuParent.AddCheckBox(text=text, checked=showPassive, callback=self.ToggleShowPassive) showEmpty = settings.user.ui.Get('showEmptySlots', 0) text = GetByLabel('UI/Inflight/HUDOptions/DisplayEmptySlots') menuParent.AddCheckBox(text=text, checked=showEmpty, callback=self.ToggleShowEmpty) showReadout = settings.user.ui.Get('showReadout', 0) text = GetByLabel('UI/Inflight/HUDOptions/DisplayReadout') menuParent.AddCheckBox(text=text, checked=showReadout, callback=self.ToggleReadout) readoutType = settings.user.ui.Get('readoutType', 1) text = GetByLabel('UI/Inflight/HUDOptions/DisplayReadoutAsPercentage') if showReadout: callback = self.ToggleReadoutType else: callback = None menuParent.AddCheckBox(text=text, checked=readoutType, callback=callback) showZoomBtns = settings.user.ui.Get('showZoomBtns', 0) text = GetByLabel('UI/Inflight/HUDOptions/DisplayZoomButtons') menuParent.AddCheckBox(text=text, checked=showZoomBtns, callback=self.ToggleShowZoomBtns) showTooltips = settings.user.ui.Get('showModuleTooltips', 1) text = GetByLabel('UI/Inflight/HUDOptions/DisplayModuleTooltips') menuParent.AddCheckBox(text=text, checked=showTooltips, callback=self.ToggleShowModuleTooltips) lockModules = settings.user.ui.Get('lockModules', 0) text = GetByLabel('UI/Inflight/HUDOptions/LockModulesInPlace') menuParent.AddCheckBox(text=text, checked=lockModules, callback=self.ToggleLockModules) menuParent.AddCheckBox(text=GetByLabel('UI/Inflight/HUDOptions/BlinkCargo'), checked=self.GetCargoBlinkValue(), callback=self.ToggleBlinkCargo) lockOverload = settings.user.ui.Get('lockOverload', 0) text = GetByLabel('UI/Inflight/HUDOptions/LockOverloadState') menuParent.AddCheckBox(text=text, checked=lockOverload, callback=self.ToggleOverloadLock) text = GetByLabel('UI/Inflight/HUDOptions/AlignHUDToTop') cb = menuParent.AddCheckBox(text=text, checked=IsShipHudTopAligned(), callback=self.ToggleAlign) cb.isToggleEntry = False menuParent.AddDivider() text = GetByLabel('UI/Inflight/NotifySettingsWindow/DamageAlertSettings') iconPath = 'res:/UI/Texture/classes/UtilMenu/BulletIcon.png' menuParent.AddIconEntry(icon=iconPath, text=text, callback=self.ShowNotifySettingsWindow) if sm.GetService('logger').IsInDragMode(): text = GetByLabel('UI/Accessories/Log/ExitMessageMovingMode') enterArgs = False else: text = GetByLabel('UI/Accessories/Log/EnterMessageMovingMode') enterArgs = True menuParent.AddIconEntry(icon='res:/UI/Texture/classes/UtilMenu/BulletIcon.png', text=text, callback=(sm.GetService('logger').MoveNotifications, enterArgs))
def GetTooltipPointer(self): if IsShipHudTopAligned(): return uiconst.POINT_TOP_2 return uiconst.POINT_BOTTOM_2
def ApplyAttributes(self, attributes): uiprimitives.Container.ApplyAttributes(self, attributes) currentSafetyLevel = attributes.get('safetyLevel') self.isTabStop = True self.confirmationButton = None self.anchor = attributes.get('anchor') self.canBeModified = attributes.get('canBeModified', True) FillThemeColored(bgParent=self, opacity=OPACITY_BG) self.lineTrace = None bodyText = '<center>%s</center>' % localization.GetByLabel( 'UI/Crimewatch/SafetyLevel/SafetyLevelSelectionBody', suspectColor=crimewatchConst.Colors.Yellow.GetHex(), criminalColor=crimewatchConst.Colors.Red.GetHex()) captionCont = uiprimitives.Container(parent=self, align=uiconst.TOTOP, name='captionCont', height=24) text = uicontrols.EveLabelMediumBold( parent=captionCont, align=uiconst.CENTERTOP, text='<center>%s</center>' % localization.GetByLabel( 'UI/Crimewatch/SafetyLevel/SafetySettingsCaption'), width=self.width - 2 * TEXT_PADDING, padTop=TEXT_PADDING, color=util.Color.WHITE) textCont = uiprimitives.Container(parent=self, align=uiconst.TOTOP, name='textCont') text = uicontrols.EveLabelSmall(parent=textCont, align=uiconst.CENTERTOP, text=bodyText, width=self.width - 2 * TEXT_PADDING, padTop=TEXT_PADDING) textCont.height = text.textheight + 2 * TEXT_PADDING uiprimitives.Container(parent=self, align=uiconst.TOTOP, name='padding', height=TEXT_PADDING) self.securityButtons = [] for safetyLevel in (const.shipSafetyLevelNone, const.shipSafetyLevelPartial, const.shipSafetyLevelFull): cont = uiprimitives.Container(parent=self, name='SecButtonCont', align=uiconst.TOTOP, height=44) securityButton = SecurityButton(parent=cont, safetyLevel=safetyLevel, align=uiconst.CENTERTOP, canBeModified=self.canBeModified) securityButton.SetSelected(safetyLevel == currentSafetyLevel) securityButton.OnClick = (self.OnSecurityButtonClick, securityButton) self.securityButtons.append(securityButton) height = 0 for container in self.children: if container.GetAlign() == uiconst.TOTOP: height += container.height self.height = height alignToTop = IsShipHudTopAligned() self.DrawFrame(alignToTop) self.DrawPointer(alignToTop) self.SetPosition(alignToTop) self.opacity = 0.0 uicore.animations.FadeIn(self, duration=0.1, loops=1) uicore.registry.SetFocus(self)