systemmenu.py (138895B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\systemMenu\systemmenu.py 2 import sys 3 import blue 4 import carbon.client.script.sys.appUtils as appUtils 5 import carbonui 6 import carbonui.text.styles 7 import eve.common.lib.appConst as const 8 import eveicon 9 import evespacemouse 10 import langutils 11 import localization 12 import log 13 import logging 14 import monolithsentry 15 import telemetry 16 import trinity 17 import uthread 18 import uthread2 19 import utillib 20 from carbon.client.script.environment.AudioUtil import PlaySound 21 from carbon.common.script.sys.serviceConst import ROLE_QA, ROLEMASK_ELEVATEDPLAYER, ROLE_WORLDMOD 22 from carbon.common.script.sys.sessions import ThrottlePerSecond 23 from carbonui import Axis, AxisAlignment, TextColor, uiconst, Align, Density, ButtonVariant, const as uiconst, IdealSize 24 from carbonui.button.group import ButtonGroup, ButtonSizeMode, OverflowAlign 25 from carbonui.button.menu import MenuButton 26 from carbonui.control.button import Button 27 from carbonui.control.buttonIcon import ButtonIcon 28 from carbonui.control.checkbox import Checkbox 29 from carbonui.control.combo import Combo 30 from carbonui.control.contextMenu.menuData import MenuData 31 from carbonui.control.layer import LayerCore 32 from carbonui.control.message import QuickMessage 33 from carbonui.control.radioButton import RadioButton 34 from carbonui.control.scrollContainer import ScrollContainer 35 from carbonui.decorative.blurredSceneUnderlay import BlurredSceneUnderlay 36 from carbonui.decorative.panelUnderlay import PanelUnderlay 37 from carbonui.primitives.container import Container 38 from carbonui.primitives.containerAutoSize import ContainerAutoSize 39 from carbonui.primitives.line import Line 40 from carbonui.primitives.sprite import Sprite 41 from carbonui.mousesettings import CursorSize, cursor_size_setting 42 from carbonui.text.settings import set_font_size_setting, is_new_font_size_options_enabled, FontSizeOption, get_default_font_size_setting, font_shadow_enabled_setting 43 from carbonui.uianimations import animations 44 from carbonui.uicore import uicore 45 from carbonui.util import colorblind 46 from carbonui.util.colorBlindHuePalette import ColorBlindHuePalette 47 from carbonui.util.colorBlindHuePicker import ColorBlindHuePicker 48 from carbonui.util.various_unsorted import GetAttrs, SortListOfTuples 49 from carbonui.window.settings import WindowCompactModeSetting, window_compact_mode_default_setting, only_tint_active_window, WindowMarginModeOption, window_margin_mode 50 from characterSettingsStorage.characterSettingsConsts import DISABLE_EMERGENCY_WARP 51 from chat.client.chat_settings import default_compact_member_entries_setting, default_font_size_setting, default_light_background_setting, default_message_mode_setting, default_show_member_list_setting 52 from chat.client.const import CHAT_MESSAGE_MODE_LABEL_PATH 53 from eve.client.script.ui.camera import cameraUtil 54 from eve.client.script.ui.control import eveEdit, eveScroll 55 from eve.client.script.ui.control.entries.button import ButtonEntry 56 from eve.client.script.ui.control.entries.util import GetFromClass 57 from eve.client.script.ui.control.themeColored import FillThemeColored 58 from eve.client.script.ui.control.treeData import TreeData 59 from eve.client.script.ui.control.treeViewEntry import TreeViewEntryHeader 60 from eve.client.script.ui.quickFilter import QuickFilterEdit 61 from eve.client.script.ui.services import uiColorSettings 62 from eve.client.script.ui.services.uiColorSettings import show_window_bg_blur_setting 63 from eve.client.script.ui.shared.mapView.settings import classic_map_enabled_setting 64 from eve.client.script.ui.shared.neocom.neocom.neocomUtil import IsInventoryBadgingEnabled, ToggleInventoryBadgingEnabledInClient 65 from eve.client.script.ui.shared.radialMenu.radialMenuSvc import RADIAL_MENU_EXPAND_DELAY_DEFAULT, RADIAL_MENU_EXPAND_DELAY_MIN, RADIAL_MENU_EXPAND_DELAY_MAX 66 from eve.client.script.ui.shared.systemMenu import systemMenuConst, optimizeSettings 67 from eve.client.script.ui.shared.systemMenu.cmdListEntry import CmdListEntry 68 from eve.client.script.ui.shared.systemMenu.colorTheme import ColorThemeContainer 69 from eve.client.script.ui.shared.systemMenu.customersatisficationcont import CustomerSatisficationCont 70 from eve.client.script.ui.shared.systemMenu.feature_preview.data import get_available_feature_previews 71 from eve.client.script.ui.shared.systemMenu.feature_preview.panel import FeaturePreviewsPanel 72 from eve.client.script.ui.shared.systemMenu.graphicsOptionsConst import shader_quality_options, texture_quality_options, lod_quality_options, shadow_quality_options, reflection_quality_options, ao_quality_options, post_processing_quality_options, upscaling_technique_options, upscaling_settings_options, volumetric_quality_options, windowed_options 73 from eve.client.script.ui.shared.systemMenu.systemMenuCombo import SystemMenuCombo 74 from eve.client.script.ui.shared.systemMenu.systemMenuConst import PANELID_ABOUTEVE, PANELID_AUDIO, PANELID_DISPLAY_AND_GRAPHICS, PANELID_FEATUREPREVIEW, PANELID_USERINTERFACE, PANELID_LANGUAGE, PANELID_RESETSETTINGS, PANELID_SHORTCUTS, LABEL_WIDTH, system_menu_selected_tab_setting, PANEL_IDS_SHORTCUTS, PANELID_GAMEPLAY, PANELID_CAMERA 75 from eve.client.script.ui.shared.systemMenu.systemMenuHeader import SystemMenuHeader 76 from eve.client.script.ui.shared.systemMenu.systemMenuSlider import SystemMenuSlider 77 from eve.client.script.ui.shared.systemMenu.theme.feature_flag import is_only_tint_active_window_setting_enabled 78 from eve.client.script.ui.tooltips.tooltipHandler import TOOLTIP_SETTINGS_GENERIC, TOOLTIP_SETTINGS_BRACKET, TOOLTIP_DELAY_GENERIC, TOOLTIP_DELAY_MIN, TOOLTIP_DELAY_MAX, TOOLTIP_DELAY_BRACKET 79 from eve.common.lib import appConst 80 from eve.common.script.sys import eveCfg 81 from eve.common.script.sys.eveCfg import IsControllingStructure 82 from evegraphics import settings as gfxsettings 83 from evegraphics.gamma import GammaSlider 84 from eveprefs import prefs, boot 85 from eveservices.menu import GetMenuService 86 from globalConfig.getFunctions import AllowCharacterLogoff 87 from localization import GetByLabel, formatters 88 from notifications.client.notificationSettings.notificationSettingHandler import NotificationSettingHandler 89 from player_messaging.client.ui_message import prompt_player_fsd_dialog 90 from storylines.client.airnpe import is_air_npe_active, skip_air_npe 91 from trinity.sceneRenderJobSpace import CanSupportSsao 92 WIDTH = 1024 93 logger = logging.getLogger(__name__) 94 95 class SystemMenu(LayerCore): 96 __guid__ = 'form.SystemMenu' 97 __nonpersistvars__ = [] 98 __notifyevents__ = ['OnEndChangeDevice', 'OnUIScalingChange', 'OnUIRefresh'] 99 isTopLevelWindow = True 100 _suppressed = False 101 _was_ui_visible = None 102 103 def __init__(self, *args, **kwargs): 104 super(SystemMenu, self).__init__(*args, **kwargs) 105 self.windowState = None 106 uiColorSettings.show_window_bg_blur_setting.on_change.connect(self.OnWindowBgBlurSetting) 107 uiColorSettings.color_theme_by_ship_faction_setting.on_change.connect(self.OnColorThemeByShipFactionSetting) 108 109 def OnColorThemeByShipFactionSetting(self, *args): 110 self._RebuildUserInterfacePanel() 111 sm.GetService('uiColor').SelectThemeFromShip() 112 113 def OnUIScalingChange(self, change, *args): 114 if uicore.layer.systemmenu.isopen: 115 self.isAboutEveInited = False 116 if self.messageEdit: 117 self.messageEdit.Close() 118 self._CheckApplyCameraOffset() 119 120 def OnUIRefresh(self): 121 self.CloseView() 122 uicore.layer.systemmenu.OpenView() 123 124 @telemetry.ZONE_METHOD 125 def Reset(self): 126 self.isUserInterfaceInited = False 127 self.isGameplayInited = False 128 self.isDisplayAndGraphicsInited = False 129 self.isCameraPanelInited = False 130 self.isAudioInited = False 131 self.isResetSettingsInited = False 132 self.isShortcutsInited = False 133 self.isLanguageInited = False 134 self.isAboutEveInited = False 135 self.colorBlindModeChanged = False 136 self.panelsByID = {} 137 self.messageEdit = None 138 self.fpsThread = None 139 self.fpsText = None 140 self.menuTreeData = TreeData() 141 self.menuTreeData.on_selected.connect(self.OnMenuNodeSelected) 142 self.menuTreeData.on_click.connect(self.OnMenuNodeClicked) 143 self._experiments_panel = None 144 self._suppressed = False 145 self._background = None 146 self.layerCont = None 147 self.genericSysteMenu = None 148 self.shortcutsFilterEdit = None 149 self.closing = 0 150 self.init_language = langutils.get_client_language() 151 self.tempStuff = [] 152 153 def OnMenuNodeClicked(self, node): 154 if node.IsLeaf(): 155 self.menuTreeData.DeselectAll() 156 node.SetSelected() 157 else: 158 node.ToggleExpanded() 159 160 def OnMenuNodeSelected(self, node, animate = True): 161 self.ShowPanel(node.GetID()) 162 163 def ShowPanel(self, panel_id): 164 panel = self.panelsByID.get(panel_id, None) 165 for child in self.panelCont.children: 166 if child == panel: 167 child.Show() 168 else: 169 child.Hide() 170 171 self.LoadPanel(panel_id) 172 173 @telemetry.ZONE_METHOD 174 def OnCloseView(self): 175 sm.ScatterEvent('OnSettingsCloseStarted') 176 if session.userid: 177 sm.GetService('ui').UnsuppressUI() 178 if self.windowState: 179 self.ApplyDeviceChanges() 180 if getattr(self, 'optimizeWnd', None) is not None: 181 self.optimizeWnd.Close() 182 self.ApplyGraphicsSettings() 183 sm.GetService('settings').SaveSettings() 184 if session.userid is not None: 185 sm.GetService('sceneManager').UpdateCameraOffset() 186 if session.charid: 187 if sm.GetService('viewState').IsViewActive('starmap'): 188 sm.GetService('starmap').UpdateRoute() 189 sm.GetService('settings').LoadSettings() 190 if self.fpsThread: 191 self.fpsThread.kill() 192 self.fpsThread = None 193 self.Reset() 194 sm.UnregisterNotify(self) 195 196 @telemetry.ZONE_METHOD 197 def OnOpenView(self, tabID = None, subTabID = None, **kwargs): 198 sm.RegisterNotify(self) 199 self.Reset() 200 self.InitDeviceSettings() 201 self.ReconstructLayout(tabID) 202 sm.GetService('ui').SuppressUI(duration=0.1) 203 animations.FadeTo(self.layerCont, 0.0, 1.0, duration=0.1) 204 sm.ScatterEvent('OnSettingsOpened') 205 if self.fpsText: 206 self.fpsThread = uthread2.start_tasklet(self._UpdateFPSThread) 207 208 def SelectMenuEntry(self, tabID): 209 node = self.menuTreeData.GetChildByID(tabID or system_menu_selected_tab_setting.get()) 210 if node: 211 node.SetSelected(animate=False) 212 213 def _UpdateFPSThread(self): 214 while not self.destroyed: 215 self.fpsText.text = u'FPS: {:.1f}'.format(blue.os.fps) 216 uthread2.Sleep(0.5) 217 218 def ReconstructLayout(self, tabID = None): 219 self.Flush() 220 self.layerCont = Container(name='layerCont', parent=self) 221 self.layerCont.cacheContents = True 222 self.ConstructLayout() 223 self.SelectMenuEntry(tabID) 224 225 def ConstructBackground(self): 226 self._background = BlurredSceneUnderlay(name='systemMenuBackground', bgParent=self.content, isInFocus=True) 227 228 def suppress(self, show_ui = True): 229 if not self._suppressed and not getattr(self, 'closing', False) and self.layerCont is not None: 230 self._suppressed = True 231 self._background.Hide() 232 self.layerCont.opacity = 0.0 233 self.layerCont.state = uiconst.UI_DISABLED 234 if show_ui: 235 sm.GetService('ui').UnsuppressUI() 236 237 def unsuppress(self): 238 if self._suppressed and not getattr(self, 'closing', False) and self.layerCont is not None: 239 self._suppressed = False 240 self._background.Show() 241 self.layerCont.opacity = 1.0 242 self.layerCont.state = uiconst.UI_PICKCHILDREN 243 sm.GetService('ui').SuppressUI() 244 245 def GetPanelData(self): 246 if session.userid: 247 panelData = [(PANELID_DISPLAY_AND_GRAPHICS, self.displayAndGraphicsPanel), 248 (PANELID_CAMERA, self.cameraPanel), 249 (PANELID_AUDIO, self.audioPanel), 250 (PANELID_USERINTERFACE, self.userInterfacePanel), 251 (PANELID_GAMEPLAY, self.gameplayPanel), 252 (PANELID_SHORTCUTS, self.shortcutsPanel)] 253 if get_available_feature_previews(): 254 panelData.append((PANELID_FEATUREPREVIEW, self.featurePreviewPanel)) 255 panelData.extend(((PANELID_RESETSETTINGS, self.resetSettingsPanel), (PANELID_LANGUAGE, self.languagePanel), (PANELID_ABOUTEVE, self.aboutEvePanel))) 256 return panelData 257 else: 258 return ((PANELID_DISPLAY_AND_GRAPHICS, self.displayAndGraphicsPanel), 259 (PANELID_AUDIO, self.audioPanel), 260 (PANELID_USERINTERFACE, self.userInterfacePanel), 261 (PANELID_RESETSETTINGS, self.resetSettingsPanel), 262 (PANELID_ABOUTEVE, self.aboutEvePanel)) 263 264 def ConstructLayout(self): 265 self.isElevatedUser = bool(session.role & ROLEMASK_ELEVATEDPLAYER) 266 self.scalingCombo = None 267 self.layerCont.Hide() 268 sm.GetService('settings').LoadSettings() 269 self.content = Container(name='content', parent=self.layerCont, align=Align.HORIZONTALLY_CENTERED, width=0.4, minWidth=WIDTH, maxWidth=IdealSize.SIZE_1200) 270 self.topCont = Container(name='topCont', parent=self.content, align=uiconst.TOTOP, height=64) 271 self.ConstructTopCont() 272 self.bottomCont = Container(name='bottomCont', parent=self.content, align=uiconst.TOBOTTOM, height=96) 273 FillThemeColored(bgParent=self.bottomCont, opacity=0.5) 274 self.ConstructContent() 275 self.ConstructBottomCont() 276 self.ConstructPanels() 277 self.ConstructBackground() 278 if self.layerCont: 279 self.layerCont.state = uiconst.UI_NORMAL 280 self.gammaSlider = None 281 282 def ConstructTopCont(self): 283 FillThemeColored(bgParent=self.topCont, opacity=0.5) 284 Line(parent=self.topCont, align=uiconst.TOBOTTOM, opacity=0.1) 285 Sprite(parent=self.topCont, align=Align.CENTERLEFT, pos=(32, 0, 32, 32), texturePath='res:/UI/Texture/WindowIcons/settings.png') 286 carbonui.text.styles.TextHeadline(parent=self.topCont, align=Align.CENTERLEFT, left=68, text=localization.GetByLabel('UI/Common/Settings')) 287 ButtonIcon(parent=self.topCont, align=uiconst.CENTERRIGHT, state=uiconst.UI_NORMAL, pos=(4, 0, 32, 32), iconSize=16, texturePath=eveicon.close, func=self.CloseMenuClick, idx=0) 288 if session.userid: 289 carbonui.text.styles.TextDetail(text=GetByLabel('UI/SystemMenu/VersionInfo', version=boot.keyval['version'].split('=', 1)[1], build=boot.build), parent=self.layerCont, align=Align.TOPRIGHT, pos=(8, 8, 0, 0), color=TextColor.SECONDARY) 290 self.fpsText = carbonui.text.styles.TextDetail(parent=self.layerCont, align=Align.TOPLEFT, color=TextColor.SECONDARY, pos=(8, 8, 0, 0)) 291 292 def ConstructContent(self): 293 self.centerCont = Container(name='centerCont', parent=self.content, padding=(16, 32, 32, 32), state=uiconst.UI_NORMAL) 294 self.treeCont = ScrollContainer(name='treeCont', parent=self.centerCont, align=Align.TOLEFT, width=300) 295 PanelUnderlay(bgParent=self.treeCont, padding=(-16, -32, 0, -32)) 296 self.panelCont = Container(name='panelCont', parent=self.centerCont, padLeft=32) 297 self._CheckApplyCameraOffset() 298 299 def ConstructPanels(self): 300 self.languagePanel = ScrollContainer(name=PANELID_LANGUAGE, parent=self.panelCont, display=False) 301 self.aboutEvePanel = Container(name=PANELID_ABOUTEVE, parent=self.panelCont, display=False) 302 self.resetSettingsPanel = Container(name=PANELID_RESETSETTINGS, parent=self.panelCont, display=False) 303 self.shortcutsPanel = Container(name=PANELID_SHORTCUTS, parent=self.panelCont, display=False) 304 self.userInterfacePanel = ScrollContainer(name=PANELID_USERINTERFACE, parent=self.panelCont, display=False) 305 self.gameplayPanel = ScrollContainer(name=PANELID_GAMEPLAY, parent=self.panelCont, display=False) 306 self.audioPanel = ScrollContainer(name=PANELID_AUDIO, parent=self.panelCont, display=False) 307 self.displayAndGraphicsPanel = ScrollContainer(name=PANELID_DISPLAY_AND_GRAPHICS, parent=self.panelCont, display=False) 308 self.cameraPanel = ScrollContainer(name=PANELID_CAMERA, parent=self.panelCont, display=False) 309 self.featurePreviewPanel = Container(name=PANELID_FEATUREPREVIEW, parent=self.panelCont, display=False) 310 self.panelsByID = {PANELID_LANGUAGE: self.languagePanel, 311 PANELID_ABOUTEVE: self.aboutEvePanel, 312 PANELID_RESETSETTINGS: self.resetSettingsPanel, 313 PANELID_SHORTCUTS: self.shortcutsPanel, 314 PANELID_USERINTERFACE: self.userInterfacePanel, 315 PANELID_GAMEPLAY: self.gameplayPanel, 316 PANELID_AUDIO: self.audioPanel, 317 PANELID_DISPLAY_AND_GRAPHICS: self.displayAndGraphicsPanel, 318 PANELID_CAMERA: self.cameraPanel, 319 PANELID_FEATUREPREVIEW: self.featurePreviewPanel} 320 for panel_id in PANEL_IDS_SHORTCUTS: 321 self.panelsByID[panel_id] = self.shortcutsPanel 322 323 self.ConstructTreeView() 324 325 def ConstructTreeView(self): 326 self.ConstructTreeData() 327 for node in self.menuTreeData.GetChildren(): 328 TreeViewEntryHeader(parent=self.treeCont, align=uiconst.TOTOP, data=node, iconColor=TextColor.SECONDARY) 329 330 def ConstructTreeData(self): 331 for panel_id, panel in self.GetPanelData(): 332 label = GetByLabel(systemMenuConst.NAME_BY_PANELID[panel_id]) 333 icon = systemMenuConst.ICON_BY_PANELID.get(panel_id, None) 334 self.menuTreeData.AddNode(label=label, nodeID=panel_id, icon=icon) 335 336 self.ConstructShortcutsTreeBranch() 337 338 def ConstructShortcutsTreeBranch(self): 339 shortcutsNode = self.menuTreeData.GetChildByID(PANELID_SHORTCUTS) 340 if not shortcutsNode: 341 return 342 for panel_id in PANEL_IDS_SHORTCUTS: 343 label = GetByLabel(systemMenuConst.NAME_BY_PANELID[panel_id]) 344 shortcutsNode.AddNode(label=label, nodeID=panel_id) 345 346 def ConstructBottomCont(self): 347 self.buttonGroup = ButtonGroup(name='mainButtonGroup', parent=ContainerAutoSize(parent=self.bottomCont, align=uiconst.TORIGHT), align=Align.CENTERRIGHT, padRight=16, button_alignment=AxisAlignment.END, button_size_mode=ButtonSizeMode.DYNAMIC, density=Density.EXPANDED, overflow_align=OverflowAlign.LEFT) 348 self.ConstructBottomButtons() 349 if bool(session.charid): 350 CustomerSatisficationCont(parent=self.bottomCont, align=Align.TOALL, padding=(32, 0, 8, 0)) 351 352 def ConstructBottomButtons(self): 353 if session.charid: 354 if is_air_npe_active(): 355 self.skipTutorialButton = self.buttonGroup.AddButton(label=GetByLabel('UI/SystemMenu/SkipTutorial'), func=self.SkipTutorial) 356 self.buttonGroup.AddButton(label=GetByLabel('UI/SystemMenu/ReturnToGame'), func=self.CloseMenuClick) 357 if session.userid: 358 if eveCfg.InShipInSpace(): 359 if not sm.GetService('viewState').SafeLogoffInProgress(): 360 label = GetByLabel('UI/Inflight/SafeLogoff') 361 hint = GetByLabel('UI/SystemMenu/SafeLogoffHint') 362 icon = 'res:/UI/Texture/classes/CSAT/logOut.png' 363 if not AllowCharacterLogoff(sm.GetService('machoNet')): 364 label = GetByLabel('UI/Inflight/SafeLogoff/SafeLogoffQuitGame') 365 hint = GetByLabel('UI/SystemMenu/SafeLogoffQuitGameHint') 366 icon = 'res:/UI/Texture/classes/CSAT/quitGame.png' 367 self.buttonGroup.AddButton(label=label, hint=hint, func=self.SafeLogoff, texturePath=icon) 368 elif session.charid and AllowCharacterLogoff(sm.GetService('machoNet')): 369 self.buttonGroup.AddButton(label=GetByLabel('UI/SystemMenu/LogOff'), hint=GetByLabel('UI/SystemMenu/LogOffHint'), func=self.LogoffBtnClick, texturePath='res:/UI/Texture/classes/CSAT/logOut.png') 370 self.buttonGroup.AddButton(label=GetByLabel('UI/SystemMenu/QuitGame'), func=self.QuitBtnClick, texturePath='res:/UI/Texture/classes/CSAT/quitGame.png') 371 372 def _CheckApplyCameraOffset(self): 373 offset = sm.GetService('window').GetCameraOffsetSettingValue() / 100.0 374 self.content.left = offset 375 376 def SkipTutorial(self, *args): 377 skip_air_npe('SkipTutorialOffer') 378 if getattr(self, 'skipTutorialButton', None) and not self.skipTutorialButton.destroyed: 379 self.skipTutorialButton.Close() 380 uicore.cmd.OnEsc() 381 382 def OnWindowBgBlurSetting(self, *args): 383 self._RebuildUserInterfacePanel() 384 385 def CloseMenuClick(self, *args): 386 PlaySound(uiconst.SOUND_BUTTON_CLICK) 387 uicore.cmd.OnEsc() 388 389 def SafeLogoff(self, button, *args): 390 if not eveCfg.InShipInSpace(): 391 button.Close() 392 else: 393 uicore.cmd.OnEsc() 394 if AllowCharacterLogoff(sm.GetService('machoNet')): 395 sm.GetService('cmd').CmdLogOff() 396 else: 397 GetMenuService().SafeLogoff() 398 399 def LogoffBtnClick(self, *args): 400 self.CloseMenuClick() 401 sm.GetService('cmd').CmdLogOff() 402 403 def LoadPanel(self, panel_id, *args): 404 if panel_id == PANELID_DISPLAY_AND_GRAPHICS: 405 self.LoadDisplayAndGraphics() 406 elif panel_id == PANELID_CAMERA: 407 self.LoadCameraPanel() 408 elif panel_id == PANELID_AUDIO: 409 self.LoadAudio() 410 elif panel_id == PANELID_USERINTERFACE: 411 self.LoadUserInterface() 412 elif panel_id == PANELID_GAMEPLAY: 413 self.LoadGameplay() 414 elif panel_id == PANELID_SHORTCUTS: 415 self.LoadShortcuts(systemMenuConst.PANELID_SHORTCUTS_GENERAL) 416 elif panel_id in PANEL_IDS_SHORTCUTS: 417 self.LoadShortcuts(panel_id) 418 elif panel_id == PANELID_FEATUREPREVIEW: 419 self.LoadFeaturePreview() 420 elif panel_id == PANELID_RESETSETTINGS: 421 self.LoadResetSettings() 422 elif panel_id == PANELID_LANGUAGE: 423 self.LoadLanguage() 424 elif panel_id == PANELID_ABOUTEVE: 425 self.LoadAboutEve() 426 system_menu_selected_tab_setting.set(panel_id) 427 uthread.new(uicore.registry.SetFocus, self.panelCont) 428 429 def InitDeviceSettings(self): 430 self.windowState = trinity.mainWindow.GetWindowState() 431 self.uiScaleValue = self._GetSelectedUiScaleOption() 432 433 def ConstructDisplaySettings(self, whatChanged = ''): 434 deviceSvc = sm.GetService('device') 435 windowState = trinity.mainWindow.GetWindowState() 436 windowed = self.windowState.windowMode != trinity.Tr2WindowMode.FULL_SCREEN 437 isMaximized = windowState.showState == trinity.Tr2WindowShowState.MAXIMIZED 438 adapterOps = deviceSvc.GetAdaptersEnumerated() 439 resolutionOps = deviceSvc.GetResolutionOptions(self.windowState) 440 if (self.windowState.width, self.windowState.height) not in [ x[1] for x in resolutionOps ]: 441 self.windowState.width, self.windowState.height = deviceSvc.GetDefaultResolution(self.windowState) 442 scalingOps = deviceSvc.GetUIScalingOptions(windowed=windowed, height=self.windowState.height) 443 SystemMenuHeader(parent=self.displayAndGraphicsPanel, padTop=0, text=GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/Header')) 444 SystemMenuCombo(parent=self.displayAndGraphicsPanel, name='Windowed', select=self.windowState.windowMode, label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/WindowedOrFullscreen'), options=windowed_options, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/WindowedOrFullscreenTooltip'), callback=self.OnWindowedOrFullscreenCombo) 445 label = GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/WindowSize') if windowed else GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/AdapterResolution') 446 hint = GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/WindowSizeTooltip') if windowed else GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/AdapterResolutionTooltip') 447 combo = SystemMenuCombo(parent=self.displayAndGraphicsPanel, name='BackBufferSize', select=(self.windowState.width, self.windowState.height), label=label, options=resolutionOps, hint=hint, callback=self.OnResolutionCombo) 448 if isMaximized and windowed: 449 combo.Disable() 450 SystemMenuCombo(parent=self.displayAndGraphicsPanel, name='UIScaling', select=self.uiScaleValue, label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/UIScaling'), options=scalingOps, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/UIScalingTooltip'), callback=self.OnUIScalingCombo) 451 if len(adapterOps) > 1: 452 SystemMenuCombo(parent=self.displayAndGraphicsPanel, name='Adapter', select=self.windowState.adapter, label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/DisplayAdapter'), options=adapterOps, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/DisplayAdapterTooltip'), callback=self.OnAdapterCombo) 453 options = deviceSvc.GetPresentationIntervalOptions(self.windowState.windowMode) 454 SystemMenuCombo(parent=self.displayAndGraphicsPanel, name='VSync', select=self.windowState.presentInterval, label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/VSync'), options=options, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/VSyncTooltip'), callback=self.OnVsyncCombo) 455 self.CreateUpscalingMenu() 456 457 def OnAdapterCombo(self, combo, *args): 458 self.windowState.adapter = combo.GetValue() 459 self.ApplyDeviceChanges() 460 if not trinity.device.SupportsRaytracing() and gfxsettings.Get(gfxsettings.GFX_SHADOW_QUALITY) == 3: 461 gfxsettings.Set(gfxsettings.GFX_SHADOW_QUALITY, 2) 462 self.ApplyGraphicsSettings() 463 464 def OnUIScalingCombo(self, combo, *args): 465 self.uiScaleValue = combo.GetValue() 466 self.ApplyDeviceChanges() 467 468 def OnResolutionCombo(self, combo, *args): 469 width, height = combo.GetValue() 470 self.windowState.width = width 471 self.windowState.height = height 472 self.ApplyDeviceChanges() 473 474 def OnWindowedOrFullscreenCombo(self, combo, *args): 475 self.ChangeWindowMode(combo.GetValue()) 476 self.ApplyDeviceChanges() 477 478 def OnVsyncCombo(self, combo, *args): 479 self.windowState.presentInterval = combo.GetValue() 480 self.ApplyDeviceChanges() 481 482 def LoadCameraPanel(self): 483 if self.isCameraPanelInited: 484 return 485 SystemMenuHeader(parent=self.cameraPanel, text=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/InSpaceCameraSettings'), padTop=0) 486 self.ConstructSlider(self.cameraPanel, 'cameraSensitivitySlider', ('user', 'ui'), gfxsettings.GetDefault(gfxsettings.UI_CAMERA_SENSITIVITY), 'UI/SystemMenu/DisplayAndGraphics/CameraSettings/CameraSensitivity', (-5.0, 5.0), 120, 10, leftHint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/CameraSensitivitySlow'), rightHint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/CameraSensitivityFast'), hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/CameraSensitivityTooltip'), increments=[0.0], snapToIncrements=False) 487 self.ConstructSlider(self.cameraPanel, 'cameraInertiaSlider', ('user', 'ui'), gfxsettings.GetDefault(gfxsettings.UI_CAMERA_INERTIA), 'UI/SystemMenu/DisplayAndGraphics/CameraSettings/CameraInertia', (-3.0, 3.0), 120, 10, leftHint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/CameraInertiaSmooth'), rightHint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/CameraInertiaStiff'), hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/CameraInertiaTooltip'), increments=[0.0], snapToIncrements=False) 488 SystemMenuSlider(parent=self.cameraPanel, name='cameraOffset', config=('cameraOffset', ('user', 'ui'), gfxsettings.GetDefault(gfxsettings.UI_CAMERA_OFFSET)), minValue=-100, maxValue=100, label='UI/SystemMenu/DisplayAndGraphics/DisplaySetup/CameraCenter', hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/CameraCenterSliderTooltip'), minLabel=GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/CameraCenterSliderLeft'), maxLabel=GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/CameraCenterSliderRight'), increments=[0.0], snapToIncrements=False, callback=self.OnCameraOffsetSlider, getHintFunc=self.GetCameraOffsetHintText, on_dragging=self.OnCameraOffsetSliderDragged) 489 self.ConstructCheckbox(self.cameraPanel, gfxsettings.GetSettingKey(gfxsettings.UI_CAMERA_SHAKE_ENABLED), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_CAMERA_SHAKE_ENABLED), GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/CameraShake'), None, None, GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/CameraShakeTooltip')) 490 self.ConstructCheckbox(self.cameraPanel, gfxsettings.GetSettingKey(gfxsettings.UI_CAMERA_BOBBING_ENABLED), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_CAMERA_BOBBING_ENABLED), GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/CameraBobbing'), None, None, GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/CameraBobbingTooltip')) 491 self.ConstructCheckbox(self.cameraPanel, gfxsettings.GetSettingKey(gfxsettings.UI_INVERT_CAMERA_ZOOM), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_INVERT_CAMERA_ZOOM), GetByLabel('UI/SystemMenu/DisplayAndGraphics/Miscellaneous/InvertCameraZoom'), None, None, GetByLabel('UI/SystemMenu/DisplayAndGraphics/Miscellaneous/InvertCameraZoomTooltip')) 492 self.ConstructCheckbox(self.cameraPanel, 'offsetUIwithCamera', ('user', 'ui'), gfxsettings.GetDefault(gfxsettings.UI_OFFSET_UI_WITH_CAMERA), GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/OffsetUIWithCamera'), None, None, GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/OffsetUIWithCameraTooltip')) 493 self.ConstructCheckbox(self.cameraPanel, 'cameraDynamicMovement', ('user', 'ui'), gfxsettings.GetDefault(gfxsettings.UI_CAMERA_DYNAMIC_CAMERA_MOVEMENT), GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/CameraDynamicMovement'), None, None, GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/CameraDynamicMovementTooltip')) 494 self.ConstructCheckbox(self.cameraPanel, 'cameraInvertY', ('user', 'ui'), gfxsettings.Get(gfxsettings.UI_CAMERA_INVERT_Y), GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/IncarnaCamera/InvertY'), None, None, GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/IncarnaCamera/InvertYTooltip')) 495 self.isCameraPanelInited = True 496 497 def ConstructSpaceMouseSettings(self, parent): 498 self.ConstructHeader(parent, GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/Header')) 499 self.ConstructSlider(parent, 'spaceMouseSpeed', ('user', 'ui'), gfxsettings.GetDefault(gfxsettings.UI_CAMERA_SPACEMOUSE_SPEED_COEFFICIENT), 'UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/Speed', (0, 1), 120, leftHint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/SpeedMin'), rightHint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/SpeedMax'), hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/SpeedTooltip'), increments=[0.5], snapToIncrements=False) 500 self.ConstructSlider(parent, 'spaceMouseAcceleration', ('user', 'ui'), gfxsettings.GetDefault(gfxsettings.UI_CAMERA_SPACEMOUSE_ACCELERATION_COEFFICIENT), 'UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/Acceleration', (0, 1), 120, leftHint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/AccelerationMin'), rightHint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/AccelerationMax'), hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/AccelerationTooltip'), increments=[0.5], snapToIncrements=False) 501 502 def ApplyDeviceChanges(self, *args): 503 if not self.windowState: 504 return 505 device_service = sm.GetService('device') 506 window_state = trinity.mainWindow.GetWindowState() 507 self.windowState.left = window_state.left 508 self.windowState.top = window_state.top 509 device_service.SetDevice(self.windowState) 510 windowed = self.windowState.windowMode != trinity.Tr2WindowMode.FULL_SCREEN 511 auto_key = gfxsettings.GFX_UI_SCALE_WINDOWED_SET_AUTOMATICALLY if windowed else gfxsettings.GFX_UI_SCALE_FULLSCREEN_SET_AUTOMATICALLY 512 is_auto_scale = self.uiScaleValue == uiconst.AUTO_UI_SCALE_OPTION_ID 513 gfxsettings.Set(auto_key, is_auto_scale, pending=False) 514 fallback_scale = device_service.GetUIScaleValue(self.windowState.windowMode) 515 desired_scale = fallback_scale if is_auto_scale else self.uiScaleValue 516 device_service.SetUIScaleValue(desired_scale, self.windowState.windowMode) 517 518 def OnEndChangeDevice(self, *args): 519 if not self.destroyed and self.isopen: 520 self.windowState = trinity.mainWindow.GetWindowState() 521 self._RebuildDisplayAndGraphicsPanel() 522 self._CheckApplyCameraOffset() 523 524 def ChangeWindowMode(self, windowed): 525 deviceSvc = sm.GetService('device') 526 self.uiScaleValue = deviceSvc.GetUIScaleValue(windowed) 527 self.windowState.windowMode = windowed 528 self.windowState.width, self.windowState.height = deviceSvc.GetDefaultResolution(self.windowState) 529 530 def _GetSelectedUiScaleOption(self): 531 windowed = self.windowState.windowMode != trinity.Tr2WindowMode.FULL_SCREEN 532 key = gfxsettings.GFX_UI_SCALE_WINDOWED_SET_AUTOMATICALLY if windowed else gfxsettings.GFX_UI_SCALE_FULLSCREEN_SET_AUTOMATICALLY 533 auto = gfxsettings.Get(key) 534 if auto: 535 return uiconst.AUTO_UI_SCALE_OPTION_ID 536 else: 537 return sm.GetService('device').GetUIScaleValue(windowed) 538 539 def OnComboChange(self, combo, header, value, *args): 540 setting_id = combo.name 541 if setting_id == 'autoTargetBack': 542 settings.user.ui.Set('autoTargetBack', value) 543 elif setting_id == 'actionmenuBtn': 544 settings.user.ui.Set('actionmenuBtn', value) 545 elif setting_id == 'clientFontSize': 546 set_font_size_setting(value) 547 elif setting_id == 'dblClickUser': 548 settings.user.ui.Set('dblClickUser', value) 549 elif gfxsettings.GetSettingFromSettingKey(setting_id) is not None: 550 setting = gfxsettings.GetSettingFromSettingKey(setting_id) 551 gfxsettings.Set(setting, value) 552 elif setting_id == 'pseudolocalizationPreset': 553 self.SetPseudolocalizationSettingsByPreset(value) 554 self.RefreshLanguage(allUI=False) 555 elif setting_id == 'characterReplacementMethod': 556 self.setCharacterReplacementMethod = value 557 if value > 0: 558 self.setSimulateTooltip = False 559 self.RefreshLanguage(allUI=False) 560 elif setting_id == 'localizationImportantNames': 561 self.setImpNameSetting = value 562 self.RefreshLanguage(allUI=False) 563 564 def OnGraphicsSettingCombo(self, combo, *args): 565 setting = gfxsettings.GetSettingFromSettingKey(combo.name) 566 if combo.GetValue() is None: 567 return 568 gfxsettings.Set(setting, combo.GetValue()) 569 self.ApplyGraphicsSettings() 570 571 def OnGraphicsSettingComboWithRebuild(self, combo, *args): 572 setting = gfxsettings.GetSettingFromSettingKey(combo.name) 573 value = combo.GetValue() 574 gfxsettings.Set(setting, value) 575 self._RebuildDisplayAndGraphicsPanel() 576 self.ApplyGraphicsSettings() 577 578 def OnShaderQualityCombo(self, combo, *args): 579 setting = gfxsettings.GetSettingFromSettingKey(combo.name) 580 value = combo.GetValue() 581 gfxsettings.Set(setting, value) 582 if value == gfxsettings.SHADER_MODEL_LOW: 583 gfxsettings.Set(gfxsettings.GFX_REFLECTION_QUALITY, gfxsettings.GFX_REFLECTION_QUALITY_OFF, pending=False) 584 gfxsettings.Set(gfxsettings.GFX_AO_QUALITY, gfxsettings.GFX_AO_QUALITY_OFF, pending=False) 585 gfxsettings.Set(gfxsettings.GFX_SHADOW_QUALITY, 0, pending=False) 586 else: 587 if gfxsettings.Get(gfxsettings.GFX_REFLECTION_QUALITY) == gfxsettings.GFX_REFLECTION_QUALITY_OFF: 588 gfxsettings.SetDefault(gfxsettings.GFX_REFLECTION_QUALITY, pending=False) 589 if gfxsettings.Get(gfxsettings.GFX_AO_QUALITY) == gfxsettings.GFX_AO_QUALITY_OFF: 590 gfxsettings.SetDefault(gfxsettings.GFX_AO_QUALITY, pending=False) 591 if gfxsettings.Get(gfxsettings.GFX_SHADOW_QUALITY) == 0: 592 gfxsettings.SetDefault(gfxsettings.GFX_SHADOW_QUALITY, pending=False) 593 self._RebuildDisplayAndGraphicsPanel() 594 self.ApplyGraphicsSettings() 595 596 def _RebuildDisplayAndGraphicsPanel(self): 597 self.isDisplayAndGraphicsInited = False 598 self.LoadDisplayAndGraphics() 599 600 def __RebuildAudioPanel(self): 601 if not self.isAudioInited: 602 return 603 self.isAudioInited = False 604 self.LoadAudio() 605 606 def LoadShortcuts(self, key = None): 607 if self.shortcutsFilterEdit: 608 self.shortcutsFilterEdit.Clear(docallback=False) 609 self._ConstructShortcutsPanel() 610 self._PopulateShortcutsScroll(key, filterText='') 611 612 def RefreshShortcutsScroll(self): 613 self._PopulateShortcutsScroll(filterText=self.shortcutsFilterEdit.GetValue()) 614 615 def _PopulateShortcutsScroll(self, key = None, filterText = ''): 616 if key is None and not filterText: 617 key = self.GetSelectedPanelID() 618 scrolllist = [] 619 for c in uicore.cmd.commandMap.GetAllCommands(): 620 if key and c.category and c.category != key: 621 continue 622 if not uicore.cmd.IsCommandAllowed(c.name): 623 continue 624 data = utillib.KeyVal() 625 data.cmdname = c.name 626 hintList = [] 627 if filterText: 628 tabPath = systemMenuConst.NAME_BY_PANELID.get(c.category, '') 629 if tabPath: 630 hintList.append(GetByLabel('UI/SystemMenu/TabName', tabName=GetByLabel(tabPath))) 631 if c.hint: 632 hintList.append(GetByLabel(c.hint)) 633 if hintList: 634 data.hint = '<br>'.join(hintList) 635 description = c.GetDescription() 636 if filterText and description.lower().find(filterText) < 0: 637 continue 638 data.context = uicore.cmd.GetCategoryContext(c.category) 639 shortcutString = c.GetShortcutAsString() or GetByLabel('UI/SystemMenu/Shortcuts/NoShortcut') 640 data.label = description + '<t>' + shortcutString 641 data.locked = c.isLocked 642 data.refreshcallback = self.RefreshShortcutsScroll 643 data.vspace = 8 644 scrolllist.append(GetFromClass(CmdListEntry, data)) 645 646 if filterText: 647 noContentHint = GetByLabel('UI/SystemMenu/Shortcuts/NoShortcutsFoundWithFilter') 648 else: 649 noContentHint = '' 650 self.shortcutsScroll.Load(contentList=scrolllist, headers=[GetByLabel('UI/SystemMenu/Shortcuts/Command'), GetByLabel('UI/SystemMenu/Shortcuts/Shortcut')], scrollTo=self.shortcutsScroll.GetScrollProportion(), noContentHint=noContentHint) 651 652 def GetSelectedPanelID(self): 653 selected_nodes = self.menuTreeData.GetSelected() 654 if selected_nodes: 655 return selected_nodes[0].GetID() 656 657 def RestoreShortcuts(self, *args): 658 if prompt_player_fsd_dialog('ConfirmResetAllShortcuts', {}, uiconst.YESNO, uiconst.ID_YES) == uiconst.ID_YES: 659 uicore.cmd.RestoreDefaults() 660 self.LoadShortcuts() 661 662 def ClearCommand(self, cmdName): 663 uicore.cmd.ClearMappedCmd(cmdName) 664 self.LoadShortcuts() 665 666 def LoadFeaturePreview(self): 667 if self._experiments_panel is None: 668 if self.featurePreviewPanel: 669 self._experiments_panel = FeaturePreviewsPanel(parent=self.featurePreviewPanel) 670 671 def ShowExperimentalFeature(self, experiment_id): 672 node = self.menuTreeData.GetChildByID(PANELID_FEATUREPREVIEW) 673 if node: 674 node.SetSelected() 675 self.LoadFeaturePreview() 676 uthread2.start_tasklet(self._experiments_panel.select_experiment, experiment_id) 677 678 def LoadAboutEve(self): 679 if self.isAboutEveInited: 680 return 681 self.messageEdit = eveEdit.Edit(parent=self.aboutEvePanel, padLeft=8, padRight=8, readonly=1) 682 self.messageEdit.AllowResizeUpdates(0) 683 html = GetByLabel('UI/SystemMenu/AboutEve/AboutEve', title=GetByLabel('UI/SystemMenu/AboutEve/ReleaseTitle'), subtitle='', version=boot.keyval['version'].split('=', 1)[1], build=boot.build, currentYear=blue.os.GetTimeParts(blue.os.GetTime())[0], EVECredits=GetByLabel('UI/SystemMenu/AboutEve/EVECredits'), VanguardCredits=GetByLabel('UI/SystemMenu/AboutEve/VanguardCredits'), CCPCredits=GetByLabel('UI/SystemMenu/AboutEve/CCPCredits')) 684 self.messageEdit.LoadHTML(html) 685 self.isAboutEveInited = 1 686 687 def ValidateData(self, entries): 688 valid = [] 689 for rec in entries: 690 if rec[0] not in ('checkbox', 'combo', 'slider', 'button'): 691 valid.append(rec) 692 continue 693 if session.charid: 694 valid.append(rec) 695 elif len(rec) > 1: 696 if rec[1] is None: 697 valid.append(rec) 698 continue 699 _, prefsType, _ = rec[1] 700 if type(prefsType) is tuple: 701 if prefsType[0] == 'char': 702 if session.charid: 703 valid.append(rec) 704 elif prefsType[0] == 'user': 705 if session.userid: 706 valid.append(rec) 707 else: 708 valid.append(rec) 709 else: 710 valid.append(rec) 711 712 return valid 713 714 def ParseData(self, entries, parent, validateEntries = 1): 715 if validateEntries: 716 validEntries = self.ValidateData(entries) 717 if not validEntries: 718 return 719 for rec in entries: 720 if rec[0] == 'topcontainer': 721 c = Container(name='container', align=uiconst.TOTOP, height=rec[1], parent=parent) 722 if len(rec) > 2: 723 c.name = rec[2] 724 elif rec[0] == 'button': 725 self.ConstructButton(parent, *rec[1:]) 726 elif rec[0] == 'header': 727 self.ConstructHeader(parent, *rec[1:]) 728 elif rec[0] == 'text': 729 self.ConstructText(parent, *rec[1:]) 730 elif rec[0] == 'checkbox': 731 self.ConstructCheckbox(parent, *(rec[1] + rec[2:])) 732 elif rec[0] == 'combo': 733 self.ConstructCombo(parent, *rec[1:]) 734 elif rec[0] == 'slider': 735 self.ConstructSlider(parent, *(rec[1] + rec[2:])) 736 elif rec[0] == 'element': 737 self.AddElement(parent, rec[1]) 738 739 def ConstructButton(self, parent, btnName, label, func, hint = None): 740 btnpar = ContainerAutoSize(name='buttonpar', parent=parent, align=uiconst.TOTOP, top=4) 741 return Button(name=btnName, parent=btnpar, label=label, func=func, hint=hint) 742 743 def ConstructHeader(self, parent, text): 744 if len(parent.children) == 0: 745 return SystemMenuHeader(parent=parent, text=text, padTop=0) 746 else: 747 return SystemMenuHeader(parent=parent, text=text) 748 749 def ConstructText(self, parent, text, memberVarName = None): 750 t = carbonui.text.styles.TextBody(name='sysheader', text=text, parent=parent, align=uiconst.TOTOP, padTop=4, padBottom=4, state=uiconst.UI_NORMAL) 751 if memberVarName: 752 raise ValueError('dafuq: ', memberVarName) 753 return t 754 755 def ConstructCheckbox(self, parent, cfgName, prefsType, defaultValue, label, value = None, group = None, hint = None, focus = None, disabled = False, indent = 0): 756 checked = int(self.GetSettingsValue(cfgName, prefsType, defaultValue)) 757 value = None 758 if value is not None: 759 checked = bool(checked == value) 760 if prefsType == 'server_setting': 761 prefsType = None 762 if group: 763 cb = RadioButton(text=label, parent=parent, settingsKey=cfgName, retval=value, checked=checked, groupname=group, callback=self.OnCheckBoxChange, settingsPath=prefsType, padLeft=indent, padBottom=4) 764 else: 765 cb = Checkbox(text=label, parent=parent, settingsKey=cfgName, checked=checked, callback=self.OnCheckBoxChange, settingsPath=prefsType, padLeft=indent, padBottom=4) 766 if disabled: 767 cb.Disable() 768 cb.opacity = 0.5 769 if focus: 770 uicore.registry.SetFocus(cb) 771 cb.sr.hint = hint 772 self.tempStuff.append(cb) 773 return cb 774 775 def AddElement(self, parent, element): 776 element.SetParent(parent) 777 778 def ConstructSlider(self, parent, cfgName, prefsType, defaultValue, label, minAndMax, labelWidth = 0, step = None, leftHint = None, rightHint = None, disabled = False, height = 10, hint = None, increments = None, snapToIncrements = True): 779 minVal, maxVal = minAndMax 780 slider = SystemMenuSlider(parent=parent, name=cfgName, config=(cfgName, prefsType, defaultValue), minValue=minVal, maxValue=maxVal, label=label, hint=hint, labelWidth=labelWidth, minLabel=leftHint, maxLabel=rightHint, increments=increments, snapToIncrements=snapToIncrements, callback=self.OnSliderChanged, getHintFunc=self.GetSliderHint, on_dragging=self.OnSliderChanged, state=disabled) 781 if disabled: 782 slider.Disable() 783 slider.opacity = 0.5 784 slider.label.Disable() 785 slider.label.opacity = 0.5 786 return slider 787 788 def ConstructCombo(self, parent, settings, label, options, labelleft = LABEL_WIDTH, hint = None, focus = None, isDisabled = False): 789 cfgName, prefsType, defaultValue = settings 790 if prefsType: 791 defaultValue = self.GetSettingsValue(cfgName, prefsType, defaultValue) 792 if cfgName == 'UIScaling': 793 newValue = False 794 for optionLabel, value in options: 795 if defaultValue == value: 796 newValue = True 797 798 if not newValue: 799 defaultValue = options[-1][1] 800 combo = SystemMenuCombo(label=label, parent=parent, options=options, name=cfgName, select=defaultValue, callback=self.OnComboChange, labelleft=labelleft, align=uiconst.TOTOP, hint=hint) 801 if cfgName == 'UIScaling': 802 self.scalingCombo = combo 803 if focus: 804 uicore.registry.SetFocus(combo) 805 if isDisabled: 806 combo.Disable() 807 return combo 808 809 def OnCameraOffsetSliderDragged(self, slider, *args): 810 self.SetGfxSetting(gfxsettings.UI_CAMERA_OFFSET, slider.GetValue()) 811 812 def OnCameraOffsetSlider(self, slider, *args): 813 self.SetGfxSetting(gfxsettings.UI_CAMERA_OFFSET, slider.GetValue()) 814 self._CheckApplyCameraOffset() 815 816 def OnSetCameraInertiaSliderValue(self, value, *args): 817 self.SetGfxSetting(gfxsettings.UI_CAMERA_INERTIA, value) 818 819 def OnSetCameraSensitivitySliderValue(self, value, *args): 820 self.SetGfxSetting(gfxsettings.UI_CAMERA_SENSITIVITY, value) 821 822 def SetGfxSetting(self, settingName, value): 823 oldValue = gfxsettings.Get(settingName) 824 if oldValue != value: 825 gfxsettings.Set(settingName, value, pending=False) 826 sm.ScatterEvent('OnGraphicSettingsChanged', [settingName]) 827 828 def GetCameraOffsetHintText(self, slider): 829 value = slider.GetValue() 830 if value == 0: 831 return GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/CameraCenterSliderCenteredValue') 832 elif value < 0: 833 return GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/CameraCenterSliderLeftValue', value=abs(int(value))) 834 else: 835 return GetByLabel('UI/SystemMenu/DisplayAndGraphics/DisplaySetup/CameraCenterSliderRightValue', value=abs(int(value))) 836 837 def GetSettingsValue(self, cfgName, prefsType, defaultValue): 838 if not prefsType: 839 return defaultValue 840 elif prefsType == 'server_setting': 841 value = sm.GetService('characterSettings').Get(cfgName) 842 return value or defaultValue 843 else: 844 return GetAttrs(settings, *prefsType).Get(cfgName, defaultValue) 845 846 def _RebuildUserInterfacePanel(self): 847 if self.destroyed: 848 return 849 self.isUserInterfaceInited = False 850 self.userInterfacePanel.Flush() 851 self.LoadUserInterface() 852 853 def LoadUserInterface(self): 854 if self.isUserInterfaceInited: 855 return 856 self.userInterfacePanel.Flush() 857 SystemMenuHeader(parent=self.userInterfacePanel, padTop=0, text=GetByLabel('UI/SystemMenu/GeneralSettings/TextHeader')) 858 self.ConstructColumn1MenuData(self.userInterfacePanel) 859 self.ConstructNotificationSection(self.userInterfacePanel) 860 if evespacemouse.IsEnabled(): 861 self.ConstructSpaceMouseSettings(self.userInterfacePanel) 862 self.ConstructAndAppendOptionalClientUpdate(self.userInterfacePanel) 863 if session.charid: 864 self.ConstructWindowAppearanceSection() 865 self.ConstructColorThemeSection() 866 self.AppendColorBlindnessConfiguration(self.userInterfacePanel) 867 self.isUserInterfaceInited = True 868 869 def LoadGameplay(self): 870 if self.isGameplayInited: 871 return 872 self.gameplayPanel.Flush() 873 data = self.ConstructInflightMenuData() 874 self.ParseData(entries=data, parent=self.gameplayPanel, validateEntries=True) 875 menu_data = self.ConstructDuelMenuData() 876 self.ParseData(entries=menu_data, parent=self.gameplayPanel, validateEntries=True) 877 self.ConstructMapSection(self.gameplayPanel) 878 self.ConstructChatSettings(self.gameplayPanel) 879 self.ConstructCrashesSection(self.gameplayPanel) 880 cinematic_data = self.ConstructBoardingCinematicsMenuData() 881 self.ParseData(entries=cinematic_data, parent=self.gameplayPanel, validateEntries=True) 882 self.isGameplayInited = True 883 884 def ConstructColorThemeSection(self): 885 SystemMenuHeader(parent=self.userInterfacePanel, text=GetByLabel('UI/SystemMenu/GeneralSettings/ColorTheme')) 886 if is_only_tint_active_window_setting_enabled(): 887 Checkbox(parent=self.userInterfacePanel, text=localization.GetByLabel('UI/SystemMenu/GeneralSettings/ColorTheme/OnlyTintActiveWindowSettingTitle'), setting=only_tint_active_window) 888 Checkbox(parent=self.userInterfacePanel, setting=uiColorSettings.color_theme_by_ship_faction_setting, text=GetByLabel('UI/SystemMenu/GeneralSettings/General/ShipTheme')) 889 self.AppendColorThemeSelection(self.userInterfacePanel) 890 891 def ConstructWindowAppearanceSection(self): 892 SystemMenuHeader(parent=self.userInterfacePanel, text=GetByLabel('UI/SystemMenu/GeneralSettings/WindowAppearance')) 893 checkbox = Checkbox(parent=self.userInterfacePanel, setting=show_window_bg_blur_setting, text=GetByLabel('UI/SystemMenu/GeneralSettings/General/EnableWindowBlur')) 894 shader_quality = gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_SHADER_QUALITY) 895 if shader_quality <= gfxsettings.SHADER_MODEL_LOW: 896 checkbox.Disable() 897 checkbox.hint = GetByLabel('UI/SystemMenu/GeneralSettings/WindowBlurDisabledHint') 898 if show_window_bg_blur_setting.is_enabled(): 899 setting = uiColorSettings.window_transparency_setting 900 else: 901 setting = uiColorSettings.window_transparency_noblur_setting 902 SystemMenuSlider(parent=self.userInterfacePanel, setting=setting, label='UI/SystemMenu/GeneralSettings/Transparency', minLabel=GetByLabel('UI/SystemMenu/DisplayAndGraphics/Common/Off'), maxLabel=GetByLabel('UI/SystemMenu/GeneralSettings/FullTransparency'), hint=GetByLabel('UI/SystemMenu/GeneralSettings/Tooltips/TransparencyHint')) 903 SystemMenuSlider(parent=self.userInterfacePanel, setting=uiColorSettings.window_transparency_light_mode_setting, label='UI/SystemMenu/GeneralSettings/TransparencyLightMode', minLabel=GetByLabel('UI/SystemMenu/DisplayAndGraphics/Common/Off'), maxLabel=GetByLabel('UI/SystemMenu/GeneralSettings/FullTransparency'), hint=GetByLabel('UI/SystemMenu/GeneralSettings/Tooltips/LightTransparencyHint')) 904 self._ConstructWindowMarginCombo(self.userInterfacePanel) 905 Checkbox(parent=self.userInterfacePanel, align=uiconst.TOTOP, top=8, setting=window_compact_mode_default_setting, text=GetByLabel('UI/SystemMenu/GeneralSettings/Windows/WindowCompactModeDefaultCheckboxLabel'), hint=GetByLabel('UI/SystemMenu/GeneralSettings/Windows/WindowCompactModeDefaultCheckboxHint')) 906 907 def LoadAudio(self): 908 if self.isAudioInited: 909 return 910 self.audioPanel.Flush() 911 audioSvc = sm.GetService('audio') 912 enabled = audioSvc.IsActivated() 913 turretSuppressed = audioSvc.GetTurretSuppression() 914 oldJukeboxOverride = audioSvc.GetOldJukeboxOverride() 915 useCombatMusic = audioSvc.GetCombatMusicUsage() 916 SystemMenuHeader(parent=self.audioPanel, text=GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/Header'), padTop=0) 917 audioData = (('checkbox', ('audioEnabled', ('public', 'audio'), enabled), GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/AudioEnabled')), 918 ('checkbox', ('suppressTurret', ('public', 'audio'), turretSuppressed), GetByLabel('UI/SystemMenu/AudioAndChat/VolumeLevel/SuppressTurretSounds')), 919 ('checkbox', ('overrideWithOldJukebox', ('public', 'audio'), oldJukeboxOverride), GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/OldJukeboxOverride')), 920 ('checkbox', ('useCombatMusic', ('public', 'audio'), useCombatMusic), GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/UseCombatMusic')), 921 ('header', GetByLabel('UI/SystemMenu/AudioAndChat/VolumeLevel/Header'))) 922 self.ParseData(audioData, self.audioPanel) 923 self.ConstructSlider(self.audioPanel, 'masterVolume', ('public', 'audio'), 0.8, 'UI/SystemMenu/AudioAndChat/VolumeLevel/MasterLevel', (0.0, 1.0)) 924 self.ConstructSlider(self.audioPanel, 'eveampGain', ('public', 'audio'), 0.5, 'UI/SystemMenu/AudioAndChat/VolumeLevel/MusicLevel', (0.0, 1.0)) 925 self.ConstructSlider(self.audioPanel, 'uiGain', ('public', 'audio'), 0.5, 'UI/SystemMenu/AudioAndChat/VolumeLevel/UISoundLevel', (0.0, 1.0)) 926 self.ConstructSlider(self.audioPanel, 'evevoiceGain', ('public', 'audio'), 0.7, 'UI/SystemMenu/AudioAndChat/VolumeLevel/UIVoiceLevel', (0.0, 1.0)) 927 self.ConstructSlider(self.audioPanel, 'worldVolume', ('public', 'audio'), 0.7, 'UI/SystemMenu/AudioAndChat/VolumeLevel/WorldLevel', (0.0, 1.0)) 928 if not session.userid: 929 self.isAudioInited = True 930 return 931 self.ConstructHeader(self.audioPanel, GetByLabel('UI/SystemMenu/AudioAndChat/AdvancedHeader')) 932 advancedDisabled = not settings.user.audio.Get('soundLevel_advancedSettings', False) 933 self.ConstructCheckbox(self.audioPanel, 'soundLevel_advancedSettings', ('user', 'audio'), False, GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/AdvancedAudioSettings'), hint=GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/AdvancedWarning')) 934 advancedCont = ContainerAutoSize(name='advancedCont', parent=self.audioPanel, align=uiconst.TOTOP) 935 audioSliderSetting = (('soundLevel_custom_atmosphere', 'UI/SystemMenu/AudioAndChat/AudioEngine/Atmosphere'), 936 ('soundLevel_custom_jumpactivation', 'UI/SystemMenu/AudioAndChat/AudioEngine/JumpActivation'), 937 ('soundLevel_custom_secondaryinterfaces', 'UI/SystemMenu/AudioAndChat/AudioEngine/SecondaryInterfaces'), 938 ('soundLevel_custom_shipeffects', 'UI/SystemMenu/AudioAndChat/AudioEngine/ShipEffects'), 939 ('soundLevel_custom_shipsounds', 'UI/SystemMenu/AudioAndChat/AudioEngine/ShipSounds'), 940 ('soundLevel_custom_turrets', 'UI/SystemMenu/AudioAndChat/AudioEngine/Turrets'), 941 ('soundLevel_custom_uiclick', 'UI/SystemMenu/AudioAndChat/AudioEngine/Uiclick'), 942 ('soundLevel_custom_warningsfx', 'UI/SystemMenu/AudioAndChat/AudioEngine/WarningSounds')) 943 for settingKey, messageLabel in audioSliderSetting: 944 SystemMenuSlider(parent=advancedCont, name=settingKey, config=(settingKey, ('user', 'audio'), 0.5), minValue=0.0, maxValue=1.0, label=messageLabel, callback=self.OnSliderChanged, getHintFunc=self.GetSliderHint, on_dragging=self.OnSliderChanged) 945 946 Container(parent=advancedCont, align=uiconst.TOTOP, height=4) 947 if advancedDisabled: 948 advancedCont.state = uiconst.UI_DISABLED 949 advancedCont.opacity = 0.5 950 advancedDisabled = not settings.user.audio.Get('inactiveSounds_advancedSettings', False) 951 audioData2 = (('checkbox', 952 ('inactiveSounds_advancedSettings', ('user', 'audio'), False), 953 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientDampening'), 954 None, 955 None, 956 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveInfo')), 957 ('checkbox', 958 ('inactiveSounds_master', ('user', 'audio'), False), 959 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientMasterDampening'), 960 None, 961 None, 962 None, 963 None, 964 advancedDisabled, 965 8), 966 ('checkbox', 967 ('inactiveSounds_music', ('user', 'audio'), False), 968 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientMusicDampening'), 969 None, 970 None, 971 None, 972 None, 973 advancedDisabled, 974 8), 975 ('checkbox', 976 ('inactiveSounds_turrets', ('user', 'audio'), False), 977 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientTurretsDampening'), 978 None, 979 None, 980 None, 981 None, 982 advancedDisabled, 983 8), 984 ('checkbox', 985 ('inactiveSounds_shield', ('user', 'audio'), False), 986 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientShieldDampening'), 987 None, 988 None, 989 None, 990 None, 991 advancedDisabled, 992 8), 993 ('checkbox', 994 ('inactiveSounds_armor', ('user', 'audio'), False), 995 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientArmorDampening'), 996 None, 997 None, 998 None, 999 None, 1000 advancedDisabled, 1001 8), 1002 ('checkbox', 1003 ('inactiveSounds_hull', ('user', 'audio'), False), 1004 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientHullDampening'), 1005 None, 1006 None, 1007 None, 1008 None, 1009 advancedDisabled, 1010 8), 1011 ('checkbox', 1012 ('inactiveSounds_shipsound', ('user', 'audio'), False), 1013 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientShipsoundDampening'), 1014 None, 1015 None, 1016 None, 1017 None, 1018 advancedDisabled, 1019 8), 1020 ('checkbox', 1021 ('inactiveSounds_jumpgates', ('user', 'audio'), False), 1022 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientJumpgateDampening'), 1023 None, 1024 None, 1025 None, 1026 None, 1027 advancedDisabled, 1028 8), 1029 ('checkbox', 1030 ('inactiveSounds_wormholes', ('user', 'audio'), False), 1031 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientWormholeDampening'), 1032 None, 1033 None, 1034 None, 1035 None, 1036 advancedDisabled, 1037 8), 1038 ('checkbox', 1039 ('inactiveSounds_jumping', ('user', 'audio'), False), 1040 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientJumpingDampening'), 1041 None, 1042 None, 1043 None, 1044 None, 1045 advancedDisabled, 1046 8), 1047 ('checkbox', 1048 ('inactiveSounds_aura', ('user', 'audio'), False), 1049 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientAuraDampening'), 1050 None, 1051 None, 1052 None, 1053 None, 1054 advancedDisabled, 1055 8), 1056 ('checkbox', 1057 ('inactiveSounds_modules', ('user', 'audio'), False), 1058 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientModulesDampening'), 1059 None, 1060 None, 1061 None, 1062 None, 1063 advancedDisabled, 1064 8), 1065 ('checkbox', 1066 ('inactiveSounds_explosions', ('user', 'audio'), False), 1067 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientExplosionsDampening'), 1068 None, 1069 None, 1070 None, 1071 None, 1072 advancedDisabled, 1073 8), 1074 ('checkbox', 1075 ('inactiveSounds_warping', ('user', 'audio'), False), 1076 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientWarpingDampening'), 1077 None, 1078 None, 1079 None, 1080 None, 1081 advancedDisabled, 1082 8), 1083 ('checkbox', 1084 ('inactiveSounds_locking', ('user', 'audio'), False), 1085 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientLockingDampening'), 1086 None, 1087 None, 1088 None, 1089 None, 1090 advancedDisabled, 1091 8), 1092 ('checkbox', 1093 ('inactiveSounds_planets', ('user', 'audio'), False), 1094 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientPlanetsDampening'), 1095 None, 1096 None, 1097 None, 1098 None, 1099 advancedDisabled, 1100 8), 1101 ('checkbox', 1102 ('inactiveSounds_impacts', ('user', 'audio'), False), 1103 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientImpactsDampening'), 1104 None, 1105 None, 1106 None, 1107 None, 1108 advancedDisabled, 1109 8), 1110 ('checkbox', 1111 ('inactiveSounds_deployables', ('user', 'audio'), False), 1112 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientDeployablesDampening'), 1113 None, 1114 None, 1115 None, 1116 None, 1117 advancedDisabled, 1118 8), 1119 ('checkbox', 1120 ('inactiveSounds_boosters', ('user', 'audio'), False), 1121 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientBoostersDampening'), 1122 None, 1123 None, 1124 None, 1125 None, 1126 advancedDisabled, 1127 8), 1128 ('checkbox', 1129 ('inactiveSounds_stationint', ('user', 'audio'), False), 1130 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientStationIntDampening'), 1131 None, 1132 None, 1133 None, 1134 None, 1135 advancedDisabled, 1136 8), 1137 ('checkbox', 1138 ('inactiveSounds_stationext', ('user', 'audio'), False), 1139 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientStationExtDampening'), 1140 None, 1141 None, 1142 None, 1143 None, 1144 advancedDisabled, 1145 8), 1146 ('checkbox', 1147 ('inactiveSounds_structures', ('user', 'audio'), False), 1148 GetByLabel('UI/SystemMenu/AudioAndChat/AudioEngine/InactiveClientStructureDampening'), 1149 None, 1150 None, 1151 None, 1152 None, 1153 advancedDisabled, 1154 8)) 1155 self.ParseData(audioData2, self.audioPanel) 1156 self.isAudioInited = True 1157 1158 def ConstructChatSettings(self, parent): 1159 dblClickUserOps = [(GetByLabel('UI/Commands/ShowInfo'), 0), (GetByLabel('UI/Chat/StartConversation'), 1)] 1160 SystemMenuHeader(parent=parent, text=GetByLabel('UI/SystemMenu/AudioAndChat/Chat/Header')) 1161 if session.userid: 1162 self.ConstructCombo(parent=parent, settings=('dblClickUser', ('user', 'ui'), 0), label=GetByLabel('UI/SystemMenu/AudioAndChat/Chat/OnDoubleClick'), options=dblClickUserOps) 1163 self.ConstructCheckbox(parent, 'logchat', ('user', 'ui'), 1, GetByLabel('UI/SystemMenu/AudioAndChat/Chat/LogChatToFile')) 1164 self.ConstructCheckbox(parent, 'autoRejectInvitations', ('user', 'ui'), 0, GetByLabel('UI/SystemMenu/AudioAndChat/Chat/AutoRejectInvitations')) 1165 carbonui.text.styles.TextBody(parent=parent, align=uiconst.TOTOP, padding=(0, 16, 0, 8), text=GetByLabel('UI/SystemMenu/AudioAndChat/ChatDefaultsSectionDescription'), color=TextColor.SECONDARY) 1166 Checkbox(parent=parent, align=uiconst.TOTOP, text=GetByLabel('UI/SystemMenu/AudioAndChat/ChatLightBackgroundOption'), setting=default_light_background_setting) 1167 Checkbox(parent=parent, align=uiconst.TOTOP, text=GetByLabel('UI/SystemMenu/AudioAndChat/ChatShowMemberListOption'), setting=default_show_member_list_setting) 1168 Checkbox(parent=parent, align=uiconst.TOTOP, text=GetByLabel('UI/SystemMenu/AudioAndChat/ChatCompactMembersOption'), setting=default_compact_member_entries_setting) 1169 1170 def set_default_font_size(combo, text, value): 1171 default_font_size_setting.set(value) 1172 1173 font_size_options = [ (str(x), x) for x in default_font_size_setting.options ] 1174 font_size_wrap = ContainerAutoSize(parent=parent, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, padding=(0, 8, 0, 8)) 1175 carbonui.text.styles.TextBody(parent=Container(parent=font_size_wrap, align=uiconst.TOLEFT, width=120, padRight=20), align=uiconst.CENTERLEFT, width=120, text=GetByLabel('UI/SystemMenu/AudioAndChat/ChatFontSizeOption')) 1176 Combo(parent=font_size_wrap, align=uiconst.TOTOP, options=font_size_options, select=default_font_size_setting.get(), callback=set_default_font_size) 1177 1178 def set_message_mode(combo, text, value): 1179 default_message_mode_setting.set(value) 1180 1181 message_mode_options = [ (localization.GetByLabel(CHAT_MESSAGE_MODE_LABEL_PATH[x]), x) for x in default_message_mode_setting.options ] 1182 message_mode_wrap = ContainerAutoSize(parent=parent, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, padding=(0, 4, 0, 8)) 1183 carbonui.text.styles.TextBody(parent=Container(parent=message_mode_wrap, align=uiconst.TOLEFT, width=120, padRight=20), align=uiconst.CENTERLEFT, width=120, text=GetByLabel('UI/SystemMenu/AudioAndChat/ChatMessagePortraitsOption')) 1184 Combo(parent=message_mode_wrap, align=uiconst.TOTOP, options=message_mode_options, select=default_message_mode_setting.get(), callback=set_message_mode) 1185 1186 def LoadDisplayAndGraphics(self): 1187 if self.isDisplayAndGraphicsInited: 1188 return 1189 self.InitDeviceSettings() 1190 scrollPos = self.displayAndGraphicsPanel.GetPositionVertical() 1191 self.displayAndGraphicsPanel.Flush() 1192 self.ConstructDisplaySettings() 1193 self.ConstructGraphicsContentSettings() 1194 self.ConstructGraphicsButtons() 1195 if session.userid: 1196 self.ConstructEffectsSettings() 1197 self.ConstructCharacterGraphicsSettings() 1198 uthread2.start_tasklet(self.displayAndGraphicsPanel.ScrollToVertical, scrollPos) 1199 self.isDisplayAndGraphicsInited = True 1200 1201 def ConstructGraphicsContentSettings(self): 1202 deviceSvc = sm.GetService('device') 1203 SystemMenuHeader(parent=self.displayAndGraphicsPanel, text=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/Header')) 1204 carbonui.text.styles.TextBody(parent=self.displayAndGraphicsPanel, align=uiconst.TOTOP, text=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/Description'), padBottom=8, color=TextColor.SECONDARY) 1205 isLowShaderModel = gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_SHADER_QUALITY) == gfxsettings.SHADER_MODEL_LOW 1206 options = deviceSvc.GetAntiAliasingOptions(self.windowState, gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_SHADER_QUALITY)) 1207 availableAAQuality = map(lambda x: x[1], options) 1208 aaQuality = gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_ANTI_ALIASING) 1209 if aaQuality not in availableAAQuality: 1210 gfxsettings.Set(gfxsettings.GFX_ANTI_ALIASING, gfxsettings.AA_QUALITY_DISABLED) 1211 upscalingInfo = trinity.device.GetUpscalingInfo() 1212 aaDisabled = upscalingInfo['temporal'] 1213 selectedAAOption = gfxsettings.AA_QUALITY_DISABLED if aaDisabled else gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_ANTI_ALIASING) 1214 aaMenu = SystemMenuCombo(parent=self.displayAndGraphicsPanel, name=gfxsettings.GetSettingKey(gfxsettings.GFX_ANTI_ALIASING), select=selectedAAOption, label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/AntiAliasing'), options=options, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/AntiAliasingTooltip'), callback=self.OnGraphicsSettingCombo) 1215 if aaDisabled: 1216 aaMenu.Disable() 1217 SystemMenuCombo(parent=self.displayAndGraphicsPanel, name=gfxsettings.GetSettingKey(gfxsettings.GFX_POST_PROCESSING_QUALITY), select=gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_POST_PROCESSING_QUALITY), label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/PostProcessing'), options=post_processing_quality_options, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/PostProcessingTooltip'), callback=self.OnGraphicsSettingCombo) 1218 try: 1219 SystemMenuCombo(parent=self.displayAndGraphicsPanel, name=gfxsettings.GetSettingKey(gfxsettings.GFX_SHADER_QUALITY), select=gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_SHADER_QUALITY), label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/ShaderQuality'), options=shader_quality_options, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/ShaderQualityTooltip'), callback=self.OnShaderQualityCombo) 1220 except: 1221 log.LogException() 1222 1223 SystemMenuCombo(parent=self.displayAndGraphicsPanel, name=gfxsettings.GetSettingKey(gfxsettings.GFX_TEXTURE_QUALITY), select=gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_TEXTURE_QUALITY), label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/TextureQuality'), options=texture_quality_options, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/TextureQualityTooltip'), callback=self.OnGraphicsSettingCombo) 1224 SystemMenuCombo(parent=self.displayAndGraphicsPanel, name=gfxsettings.GetSettingKey(gfxsettings.GFX_LOD_QUALITY), select=gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_LOD_QUALITY), label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/LODQuality'), options=lod_quality_options, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/LODQualityTooltip'), callback=self.OnGraphicsSettingCombo) 1225 if isLowShaderModel: 1226 options = [] 1227 else: 1228 options = list(shadow_quality_options) 1229 if not trinity.device.SupportsRaytracing(): 1230 options.pop() 1231 combo = SystemMenuCombo(parent=self.displayAndGraphicsPanel, name=gfxsettings.GetSettingKey(gfxsettings.GFX_SHADOW_QUALITY), select=gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_SHADOW_QUALITY) if options else None, label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/ShadowQuality'), options=options, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/ShadowQualityTooltip'), nothingSelectedText=GetByLabel('UI/SystemMenu/DisplayAndGraphics/Common/Disabled'), callback=self.OnGraphicsSettingCombo) 1232 if not options: 1233 combo.Disable() 1234 if not isLowShaderModel and CanSupportSsao(): 1235 options = ao_quality_options 1236 else: 1237 options = [] 1238 combo = SystemMenuCombo(parent=self.displayAndGraphicsPanel, name=gfxsettings.GetSettingKey(gfxsettings.GFX_AO_QUALITY), select=gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_AO_QUALITY) if options else None, label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/AOQuality'), options=options, nothingSelectedText=GetByLabel('UI/SystemMenu/DisplayAndGraphics/Common/Disabled'), hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/AOQualityTooltip'), callback=self.OnGraphicsSettingCombo) 1239 if not options: 1240 combo.Disable() 1241 SystemMenuCombo(parent=self.displayAndGraphicsPanel, name=gfxsettings.GetSettingKey(gfxsettings.GFX_VOLUMETRIC_QUALITY), select=gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_VOLUMETRIC_QUALITY), label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/VolumetricsQuality'), options=volumetric_quality_options, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/VolumetricsQualityTooltip'), callback=self.OnGraphicsSettingCombo) 1242 if isLowShaderModel: 1243 options = [] 1244 else: 1245 options = reflection_quality_options 1246 combo = SystemMenuCombo(parent=self.displayAndGraphicsPanel, name=gfxsettings.GetSettingKey(gfxsettings.GFX_REFLECTION_QUALITY), select=gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_REFLECTION_QUALITY) if options else None, label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/ReflectionQuality'), options=options, nothingSelectedText=GetByLabel('UI/SystemMenu/DisplayAndGraphics/Common/Disabled'), hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/ReflectionQualityTooltip'), callback=self.OnGraphicsSettingCombo) 1247 if not options: 1248 combo.Disable() 1249 1250 def ConstructGraphicsButtons(self): 1251 btnGroup = ButtonGroup(name='bottomBtnPar', parent=self.displayAndGraphicsPanel, align=uiconst.TOTOP, padTop=32, orientation=Axis.HORIZONTAL, button_size_mode=ButtonSizeMode.EQUAL, button_alignment=AxisAlignment.START) 1252 btnGroup.AddButton(label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/Brightness'), func=self.ChangeBrightness, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/BrightnessToolTip'), texturePath=eveicon.polestar) 1253 MenuButton(parent=btnGroup, label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/OptimizeSettings'), get_menu_func=self.GetOptimizeSettingsMenu, texturePath=eveicon.tune) 1254 btnGroup.AddButton(label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/ResetGraphicSettings'), func=self.ResetGraphicsSettings, texturePath=eveicon.arrow_rotate_left) 1255 1256 def GetOptimizeSettingsMenu(self): 1257 menuData = MenuData() 1258 for mode in optimizeSettings.OPTIMIZATION_MODES: 1259 menuData.AddEntry(GetByLabel(optimizeSettings.MODE_LABELS[mode]), func=lambda m = mode: self.ApplyOptimizeSettingsFunc(optimizeSettings.FUNC_BY_MODE[m]), hint=GetByLabel(optimizeSettings.MODE_INFO_LABELS[mode])) 1260 1261 return menuData 1262 1263 def ApplyOptimizeSettingsFunc(self, func): 1264 func() 1265 self.ApplyGraphicsSettings() 1266 self._RebuildDisplayAndGraphicsPanel() 1267 1268 def ConstructCharacterGraphicsSettings(self): 1269 entries = [] 1270 entries += (('header', GetByLabel('UI/SystemMenu/DisplayAndGraphics/CharacterCreation/Header')),) 1271 currentFastCharacterCreationValue = gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_CHAR_FAST_CHARACTER_CREATION) 1272 charTextureQualityOptions = [(GetByLabel('UI/SystemMenu/DisplayAndGraphics/Common/LowQuality'), 2), (GetByLabel('UI/SystemMenu/DisplayAndGraphics/Common/MediumQuality'), 1), (GetByLabel('UI/SystemMenu/DisplayAndGraphics/Common/HighQuality'), 0)] 1273 entries += [('checkbox', 1274 (gfxsettings.GetSettingKey(gfxsettings.GFX_CHAR_FAST_CHARACTER_CREATION), None, currentFastCharacterCreationValue), 1275 GetByLabel('UI/SystemMenu/DisplayAndGraphics/CharacterCreation/LowQualityCharacters'), 1276 None, 1277 None, 1278 GetByLabel('UI/SystemMenu/DisplayAndGraphics/CharacterCreation/LowQualityCharactersTooltip'), 1279 None, 1280 False), ('checkbox', 1281 (gfxsettings.GetSettingKey(gfxsettings.UI_NCC_GREEN_SCREEN), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_NCC_GREEN_SCREEN)), 1282 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Miscellaneous/EnableGreenscreen'), 1283 None, 1284 None, 1285 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Miscellaneous/EnableGreenscreenMenuTooltip')), ('combo', 1286 (gfxsettings.GetSettingKey(gfxsettings.GFX_CHAR_TEXTURE_QUALITY), None, gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_CHAR_TEXTURE_QUALITY)), 1287 GetByLabel('UI/SystemMenu/DisplayAndGraphics/CharacterCreation/TextureQuality'), 1288 charTextureQualityOptions, 1289 LABEL_WIDTH, 1290 GetByLabel('UI/SystemMenu/DisplayAndGraphics/CharacterCreation/TextureQualityTooltip'))] 1291 self.ParseData(entries, self.displayAndGraphicsPanel, validateEntries=0) 1292 1293 def ConstructEffectsSettings(self): 1294 entries = [('header', GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/Header')), 1295 ('checkbox', 1296 (gfxsettings.GetSettingKey(gfxsettings.UI_TURRETS_ENABLED), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_TURRETS_ENABLED)), 1297 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/TurretEffects'), 1298 None, 1299 None, 1300 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/TurretEffectsTooltip')), 1301 ('checkbox', 1302 (gfxsettings.GetSettingKey(gfxsettings.UI_EFFECTS_ENABLED), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_EFFECTS_ENABLED)), 1303 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/Effects'), 1304 None, 1305 None, 1306 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/EffectsTooltip')), 1307 ('checkbox', 1308 (gfxsettings.GetSettingKey(gfxsettings.UI_MISSILES_ENABLED), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_MISSILES_ENABLED)), 1309 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/MissileEffects'), 1310 None, 1311 None, 1312 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/EffectsTooltip')), 1313 ('checkbox', 1314 (gfxsettings.GetSettingKey(gfxsettings.UI_EXPLOSION_EFFECTS_ENABLED), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_EXPLOSION_EFFECTS_ENABLED)), 1315 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/ShipExplosions'), 1316 None, 1317 None, 1318 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/ShipExplosionsTooltip')), 1319 ('checkbox', 1320 (gfxsettings.GetSettingKey(gfxsettings.UI_DRONE_MODELS_ENABLED), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_DRONE_MODELS_ENABLED)), 1321 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/DroneModels'), 1322 None, 1323 None, 1324 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/DroneModelsTooltip')), 1325 ('checkbox', 1326 (gfxsettings.GetSettingKey(gfxsettings.UI_TRAILS_ENABLED), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_TRAILS_ENABLED)), 1327 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/Trails'), 1328 None, 1329 None, 1330 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/TrailsTooltip')), 1331 ('checkbox', 1332 (gfxsettings.GetSettingKey(gfxsettings.UI_GPU_PARTICLES_ENABLED), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_GPU_PARTICLES_ENABLED)), 1333 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/GPUParticles'), 1334 None, 1335 None, 1336 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/GPUParticlesTooltip')), 1337 ('checkbox', 1338 (gfxsettings.GetSettingKey(gfxsettings.UI_ASTEROID_ATMOSPHERICS), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_ASTEROID_ATMOSPHERICS)), 1339 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/AsteroidEnvironments'), 1340 None, 1341 None, 1342 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/AsteroidEnvironmentsTooltip')), 1343 ('checkbox', 1344 (gfxsettings.GetSettingKey(gfxsettings.UI_MODELSKINSINSPACE_ENABLED), None, gfxsettings.GetPendingOrCurrent(gfxsettings.UI_MODELSKINSINSPACE_ENABLED)), 1345 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/InSpaceSkinningEffect'), 1346 None, 1347 None, 1348 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/InSpaceSkinningEffectToolTip')), 1349 ('checkbox', 1350 (gfxsettings.GetSettingKey(gfxsettings.GFX_DOF_POSTPROCESS_ENABLED), None, gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_DOF_POSTPROCESS_ENABLED)), 1351 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/DepthOfField'), 1352 None, 1353 None, 1354 GetByLabel('UI/SystemMenu/DisplayAndGraphics/Effects/DepthOfFieldTooltip'))] 1355 self.ParseData(entries, self.displayAndGraphicsPanel, validateEntries=0) 1356 1357 def CreateUpscalingMenu(self): 1358 supportedUpscalingTechniqueInfo = trinity.device.supportedUpscalingTechniques 1359 supportedUpscalingTechniques = [ info[0] for info in supportedUpscalingTechniqueInfo ] + [trinity.UPSCALING_TECHNIQUE.NONE] 1360 currentTechnique = gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_UPSCALING_TECHNIQUE) 1361 currentTechniqueInfo = [ info for info in supportedUpscalingTechniqueInfo if info[0] == currentTechnique ] 1362 currentTechniqueInfo = currentTechniqueInfo[0] if currentTechniqueInfo else None 1363 frameGenSupported = False 1364 techniqueOptions = [ (label, technique) for label, technique in upscaling_technique_options if technique in supportedUpscalingTechniques ] 1365 if currentTechniqueInfo: 1366 settingOptions = [ (label, setting) for label, setting in upscaling_settings_options if setting & currentTechniqueInfo[1] == setting ] 1367 frameGenSupported = currentTechniqueInfo[2] 1368 else: 1369 settingOptions = [(GetByLabel('UI/Generic/NotAvailableShort'), 0)] 1370 SystemMenuCombo(parent=self.displayAndGraphicsPanel, name=gfxsettings.GetSettingKey(gfxsettings.GFX_UPSCALING_TECHNIQUE), select=gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_UPSCALING_TECHNIQUE), label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/Upscaling/Techniques/Label'), options=techniqueOptions, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/Upscaling/Techniques/Tooltip'), callback=self.OnGraphicsSettingCombo) 1371 settingCombo = SystemMenuCombo(parent=self.displayAndGraphicsPanel, name=gfxsettings.GetSettingKey(gfxsettings.GFX_UPSCALING_SETTING), select=gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_UPSCALING_SETTING), label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/Upscaling/Settings/Label'), options=settingOptions, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/Upscaling/Settings/Tooltip'), callback=self.OnGraphicsSettingCombo) 1372 if currentTechnique == trinity.UPSCALING_TECHNIQUE.NONE: 1373 settingCombo.Disable() 1374 if frameGenSupported: 1375 options = [(localization.GetByLabel('UI/SystemMenu/DisplayAndGraphics/Common/Off'), False), (localization.GetByLabel('UI/SystemMenu/DisplayAndGraphics/Common/On'), True)] 1376 SystemMenuCombo(parent=self.displayAndGraphicsPanel, name=gfxsettings.GetSettingKey(gfxsettings.GFX_FRAMEGENERATION_ENABLED), select=gfxsettings.GetPendingOrCurrent(gfxsettings.GFX_FRAMEGENERATION_ENABLED), label=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/Upscaling/FrameGeneration'), options=options, hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/Upscaling/FrameGenerationTooltip'), callback=self.OnGraphicsSettingCombo) 1377 1378 def ResetGraphicsSettings(self, *args): 1379 gfxsettings.SetDefault(gfxsettings.GFX_POST_PROCESSING_QUALITY) 1380 gfxsettings.SetDefault(gfxsettings.GFX_TEXTURE_QUALITY) 1381 gfxsettings.SetDefault(gfxsettings.GFX_SHADER_QUALITY) 1382 gfxsettings.SetDefault(gfxsettings.GFX_LOD_QUALITY) 1383 gfxsettings.SetDefault(gfxsettings.GFX_CHAR_FAST_CHARACTER_CREATION) 1384 gfxsettings.SetDefault(gfxsettings.GFX_CHAR_TEXTURE_QUALITY) 1385 gfxsettings.SetDefault(gfxsettings.GFX_SHADOW_QUALITY) 1386 gfxsettings.SetDefault(gfxsettings.GFX_ANTI_ALIASING) 1387 gfxsettings.SetDefault(gfxsettings.GFX_BRIGHTNESS) 1388 gfxsettings.SetDefault(gfxsettings.GFX_UPSCALING_SETTING) 1389 gfxsettings.SetDefault(gfxsettings.GFX_UPSCALING_TECHNIQUE) 1390 gfxsettings.SetDefault(gfxsettings.GFX_AO_QUALITY) 1391 gfxsettings.SetDefault(gfxsettings.GFX_VOLUMETRIC_QUALITY) 1392 gfxsettings.SetDefault(gfxsettings.GFX_REFLECTION_QUALITY) 1393 if session.userid: 1394 gfxsettings.SetDefault(gfxsettings.UI_TURRETS_ENABLED) 1395 gfxsettings.SetDefault(gfxsettings.UI_EFFECTS_ENABLED) 1396 gfxsettings.SetDefault(gfxsettings.UI_MISSILES_ENABLED) 1397 gfxsettings.SetDefault(gfxsettings.UI_TRAILS_ENABLED) 1398 gfxsettings.SetDefault(gfxsettings.UI_ADVANCED_CAMERA) 1399 gfxsettings.SetDefault(gfxsettings.UI_NCC_GREEN_SCREEN) 1400 gfxsettings.SetDefault(gfxsettings.UI_CAMERA_OFFSET) 1401 gfxsettings.SetDefault(gfxsettings.UI_CAMERA_INVERT_Y) 1402 gfxsettings.SetDefault(gfxsettings.UI_CAMERA_INERTIA) 1403 gfxsettings.SetDefault(gfxsettings.UI_CAMERA_SENSITIVITY) 1404 gfxsettings.SetDefault(gfxsettings.UI_ASTEROID_ATMOSPHERICS) 1405 gfxsettings.SetDefault(gfxsettings.UI_MODELSKINSINSPACE_ENABLED) 1406 self.ApplyGraphicsSettings() 1407 self._RebuildDisplayAndGraphicsPanel() 1408 1409 def ApplyGraphicsSettings(self): 1410 if not self.windowState: 1411 return 1412 deviceSvc = sm.GetService('device') 1413 dev = trinity.device 1414 changes = gfxsettings.ApplyPendingChanges(gfxsettings.SETTINGS_GROUP_DEVICE) 1415 if gfxsettings.IsInitialized(gfxsettings.SETTINGS_GROUP_UI): 1416 changes.extend(gfxsettings.ApplyPendingChanges(gfxsettings.SETTINGS_GROUP_UI)) 1417 if gfxsettings.GFX_REFLECTION_QUALITY in changes: 1418 trinity.settings.SetValue('eveReflectionSetting', gfxsettings.Get(gfxsettings.GFX_REFLECTION_QUALITY)) 1419 if gfxsettings.GFX_DOF_POSTPROCESS_ENABLED in changes: 1420 trinity.settings.SetValue('postprocessDofEnabled', gfxsettings.Get(gfxsettings.GFX_DOF_POSTPROCESS_ENABLED)) 1421 lodChangers = [gfxsettings.GFX_LOD_QUALITY] 1422 if gfxsettings.GFX_LOD_QUALITY in changes: 1423 gfxsettings.ApplyLodSettings() 1424 if gfxsettings.GFX_SHADER_QUALITY in changes: 1425 message = QuickMessage(className='Message', parent=uicore.layer.modal, name='msgDeviceReset') 1426 message.ShowMsg(GetByLabel('UI/SystemMenu/DisplayAndGraphics/GraphicContentSettings/ApplyingSettings')) 1427 blue.synchro.SleepWallclock(200) 1428 trinity.SetShaderModel(deviceSvc.GetShaderModelForShaderQuality(gfxsettings.Get(gfxsettings.GFX_SHADER_QUALITY))) 1429 message.Close() 1430 if gfxsettings.GFX_TEXTURE_QUALITY in changes: 1431 dev.mipLevelSkipCount = gfxsettings.Get(gfxsettings.GFX_TEXTURE_QUALITY) 1432 dev.RefreshDeviceResources() 1433 if gfxsettings.GFX_UPSCALING_TECHNIQUE in changes or gfxsettings.GFX_UPSCALING_SETTING in changes or gfxsettings.GFX_FRAMEGENERATION_ENABLED in changes: 1434 trinity.device.SetUpscaling(gfxsettings.Get(gfxsettings.GFX_UPSCALING_TECHNIQUE), gfxsettings.Get(gfxsettings.GFX_UPSCALING_SETTING), gfxsettings.Get(gfxsettings.GFX_FRAMEGENERATION_ENABLED)) 1435 if gfxsettings.GFX_UPSCALING_TECHNIQUE in changes: 1436 while trinity.device.GetUpscalingInfo()['technique'] != gfxsettings.Get(gfxsettings.GFX_UPSCALING_TECHNIQUE) or not trinity.device.DoesD3DDeviceExist(): 1437 blue.synchro.Yield() 1438 1439 self._RebuildDisplayAndGraphicsPanel() 1440 if len(changes) > 0: 1441 sm.ScatterEvent('OnGraphicSettingsChanged', changes) 1442 monolithsentry.set_sentry_crash_key() 1443 1444 def _ConstructShortcutsPanel(self): 1445 if self.isShortcutsInited: 1446 return 1447 self.shortcutsPanel.Flush() 1448 topCont = ContainerAutoSize(name='topCont', parent=self.shortcutsPanel, align=uiconst.TOTOP, alignMode=uiconst.TOTOP, minHeight=QuickFilterEdit.default_height, padding=(0, 0, 0, 8)) 1449 self.shortcutsFilterEdit = QuickFilterEdit(name='filterInput', parent=topCont, setvalue='', hintText=GetByLabel('UI/Inventory/Filter'), maxLength=64, left=16, width=160, align=uiconst.CENTERLEFT, OnClearFilter=self.LoadShortcuts) 1450 self.shortcutsFilterEdit.OnReturn = self.FilterCommands 1451 self.shortcutsFilterEdit.ReloadFunction = self.FilterCommands 1452 col2 = Container(name='column2', parent=self.shortcutsPanel) 1453 col2.isTabOrderGroup = 1 1454 shortcutoptions = Container(name='options', align=uiconst.TOBOTTOM, height=32, parent=col2, padding=(0, 16, 0, 0)) 1455 ButtonGroup(parent=shortcutoptions, align=uiconst.TOTOP, button_alignment=AxisAlignment.START, buttons=[Button(label=GetByLabel('UI/SystemMenu/Shortcuts/EditShortcut'), func=self.OnEditShortcutBtnClicked, variant=ButtonVariant.GHOST), Button(label=GetByLabel('UI/SystemMenu/Shortcuts/ClearShortcut'), func=self.OnClearShortcutBtnClicked, variant=ButtonVariant.GHOST), Button(label=GetByLabel('UI/SystemMenu/Shortcuts/DefaultShortcuts'), func=self.RestoreShortcuts, variant=ButtonVariant.GHOST)]) 1456 self.shortcutsScroll = eveScroll.Scroll(name='shortcutsScroll', align=uiconst.TOALL, parent=col2, multiSelect=False, id='active_cmdscroll', padding=(6, 0, 6, 0)) 1457 self.isShortcutsInited = 1 1458 1459 def FilterCommands(self): 1460 filterText = self.shortcutsFilterEdit.GetValue() 1461 filterText = filterText.strip().lower() 1462 self._PopulateShortcutsScroll(None, filterText) 1463 1464 def OnEditShortcutBtnClicked(self, *args): 1465 selected = self.shortcutsScroll.GetSelected() 1466 if not selected: 1467 return 1468 p = selected[0].panel 1469 p.Edit() 1470 1471 def OnClearShortcutBtnClicked(self, *args): 1472 selected = self.shortcutsScroll.GetSelected() 1473 if not selected: 1474 return 1475 self.ClearCommand(selected[0].cmdname) 1476 1477 def LoadResetSettings(self, reload = 0): 1478 if self.isResetSettingsInited: 1479 return 1480 self.resetSettingsPanel.Flush() 1481 SystemMenuHeader(parent=self.resetSettingsPanel, padTop=0, text=GetByLabel('UI/SystemMenu/ResetSettings/ResetToDefault/Header')) 1482 suppressScroll = eveScroll.Scroll(parent=self.resetSettingsPanel, align=uiconst.TOTOP, name='defaultsResetScroll') 1483 suppressScroll.HideBackground() 1484 scrollList = [] 1485 lst = [{'label': GetByLabel('UI/SystemMenu/ResetSettings/ResetToDefault/WindowPosition'), 1486 'caption': GetByLabel('UI/SystemMenu/ResetSettings/Reset'), 1487 'OnClick': self.ResetBtnClick, 1488 'args': 'windows'}, 1489 {'label': GetByLabel('UI/SystemMenu/ResetSettings/ResetToDefault/WindowColors'), 1490 'caption': GetByLabel('UI/SystemMenu/ResetSettings/Reset'), 1491 'OnClick': self.ResetBtnClick, 1492 'args': 'window color'}, 1493 {'label': GetByLabel('UI/SystemMenu/ResetSettings/ResetToDefault/WindowCompactMode'), 1494 'caption': GetByLabel('UI/SystemMenu/ResetSettings/Reset'), 1495 'OnClick': lambda button, args: WindowCompactModeSetting.clear_all(), 1496 'args': ()}, 1497 {'label': GetByLabel('UI/SystemMenu/ResetSettings/ResetToDefault/ClearAllSettings'), 1498 'caption': GetByLabel('UI/SystemMenu/ResetSettings/Clear'), 1499 'OnClick': self.ResetBtnClick, 1500 'args': 'clear settings'}, 1501 {'label': GetByLabel('UI/SystemMenu/ResetSettings/ResetToDefault/ClearAllCacheFiles'), 1502 'caption': GetByLabel('UI/SystemMenu/ResetSettings/Clear'), 1503 'OnClick': self.ResetBtnClick, 1504 'args': 'clear cache'}] 1505 if session.charid: 1506 lst.append({'label': GetByLabel('UI/SystemMenu/ResetSettings/ResetToDefault/ClearMailCache'), 1507 'caption': GetByLabel('UI/SystemMenu/ResetSettings/Clear'), 1508 'OnClick': self.ResetBtnClick, 1509 'args': 'clear mail'}) 1510 lst.append({'label': GetByLabel('UI/SystemMenu/ResetSettings/ResetToDefault/NeocomButtons'), 1511 'caption': GetByLabel('UI/SystemMenu/ResetSettings/Reset'), 1512 'OnClick': self.ResetBtnClick, 1513 'args': 'reset neocom'}) 1514 if eveCfg.InShipInSpace() or IsControllingStructure(): 1515 lst.append({'label': GetByLabel('UI/SystemMenu/ResetSettings/ResetToDefault/ReloadHUD'), 1516 'caption': GetByLabel('UI/SystemMenu/ResetSettings/ResetToDefault/ReloadHUDBtn'), 1517 'OnClick': self.ReloadHUD, 1518 'args': None}) 1519 if sm.GetService('chat').has_reported_spammers(): 1520 lst.append({'label': GetByLabel('UI/SystemMenu/ResetSettings/ResetToDefault/ClearISKSpammerList'), 1521 'caption': GetByLabel('UI/SystemMenu/ResetSettings/Clear'), 1522 'OnClick': self.ResetBtnClick, 1523 'args': 'clear iskspammers'}) 1524 for each in lst: 1525 scrollList.append(GetFromClass(ButtonEntry, {'label': each['label'], 1526 'caption': each['caption'], 1527 'OnClick': each['OnClick'], 1528 'args': (each['args'],), 1529 'maxLines': None, 1530 'entryWidth': 600, 1531 'showHilite': True})) 1532 1533 suppressScroll.Load(contentList=scrollList) 1534 suppressScroll.height = suppressScroll.GetEntriesTotalHeight() 1535 SystemMenuHeader(parent=self.resetSettingsPanel, text=GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/Header')) 1536 suppressScroll = eveScroll.Scroll(name='suppressResetScroll', parent=self.resetSettingsPanel, align=uiconst.TOALL) 1537 suppressScroll.HideBackground() 1538 scrollList = [] 1539 for each in settings.user.suppress.GetValues().keys(): 1540 label = self.GetConfigName(each) 1541 entry = GetFromClass(ButtonEntry, {'label': label, 1542 'caption': GetByLabel('UI/SystemMenu/ResetSettings/Reset'), 1543 'OnClick': self.ConfigBtnClick, 1544 'args': (each,), 1545 'maxLines': None, 1546 'entryWidth': 600}) 1547 scrollList.append((label, entry)) 1548 1549 scrollList = SortListOfTuples(scrollList) 1550 suppressScroll.Load(contentList=scrollList) 1551 self.isResetSettingsInited = 1 1552 1553 def RefreshLanguage(self, allUI = True): 1554 self.isLanguageInited = 0 1555 if allUI: 1556 sm.ChainEvent('ProcessUIRefresh') 1557 sm.ScatterEvent('OnUIRefresh') 1558 else: 1559 self.languagePanel.Flush() 1560 self.isLanguageInited = 0 1561 self.LoadLanguage() 1562 1563 def LoadLanguage(self): 1564 if self.isLanguageInited: 1565 return 1566 self._ShowLanguageSelectionOptions() 1567 self._ShowIMEAndVoiceOptions() 1568 self._ShowPseudolocOptions() 1569 self.isLanguageInited = 1 1570 1571 def _GetLanguageMenuOptionList(self, includeHidden): 1572 returnSet = langutils.VALID_CLIENT_LANGUAGES 1573 if includeHidden: 1574 returnSet |= langutils.SECRET_CLIENT_LANGUAGES 1575 for l in returnSet: 1576 l.native = localization.Get('UI/SystemMenu/Language/Language%s' % l.name) or l.native 1577 1578 return langutils.set_to_sorted_list(returnSet) 1579 1580 def _ShowLanguageSelectionOptions(self): 1581 if boot.region == 'optic' and not self.isElevatedUser: 1582 return 1583 validLangs = self._GetLanguageMenuOptionList(includeHidden=self.isElevatedUser) 1584 if len(validLangs) > 1: 1585 SystemMenuHeader(parent=self.languagePanel, padTop=0, text=GetByLabel('UI/SystemMenu/Language/Header')) 1586 gameLanguage = langutils.get_client_language() 1587 selectedLang = langutils.any_to_comfy_language(getattr(self, 'setlanguageID', None), None) or gameLanguage 1588 for lang in validLangs: 1589 RadioButton(parent=self.languagePanel, name='languageCheckbox_%s' % lang.cerberus_code(), text=lang.native if lang == langutils.DEFAULT_CLIENT_LANGUAGE else u'%s - %s' % (lang.native, lang.name), retval=lang.mls_language_id(), groupname='languageSelection', checked=lang == selectedLang, fontsize=12, settingsKey='language', callback=self.OnLanguageCheckBoxChange) 1590 1591 impNameOptions = [(selectedLang.native, 0), (GetByLabel('UI/SystemMenu/Language/EnglishReplacement'), localization.const.IMPORTANT_EN_OVERRIDE)] 1592 if selectedLang != langutils.LANG_EN: 1593 bs = localization.settings.bilingualSettings 1594 if not hasattr(self, 'setImpNameSetting'): 1595 self.setImpNameSetting = bs.GetValue('localizationImportantNames') 1596 if not hasattr(self, 'setLanguageTooltip'): 1597 self.setLanguageTooltip = bs.GetValue('languageTooltip') 1598 if not hasattr(self, 'setLocalizationHighlightImportant'): 1599 self.setLocalizationHighlightImportant = bs.GetValue('localizationHighlightImportant') 1600 if self.setImpNameSetting == localization.const.IMPORTANT_EN_OVERRIDE: 1601 checkboxCaption = GetByLabel('UI/SystemMenu/Language/ShowTooltipInLanguage', language=selectedLang.native) 1602 else: 1603 checkboxCaption = GetByLabel('UI/SystemMenu/Language/ShowTooltipInLanguage', language=langutils.LANG_EN.native) 1604 highlightImportant = GetByLabel('UI/SystemMenu/Language/HighlightImportantNames') 1605 impNameData = [('header', GetByLabel('UI/SystemMenu/Language/ImportantNames')), 1606 ('combo', 1607 ('localizationImportantNames', None, self.setImpNameSetting), 1608 GetByLabel('UI/SystemMenu/Language/Display'), 1609 impNameOptions, 1610 LABEL_WIDTH, 1611 GetByLabel('UI/SystemMenu/Language/ImportantNamesExplanation')), 1612 ('checkbox', ('languageTooltip', None, self.setLanguageTooltip), checkboxCaption), 1613 ('checkbox', ('highlightImportant', None, self.setLocalizationHighlightImportant), highlightImportant)] 1614 else: 1615 impNameData = [] 1616 self.ParseData(impNameData, self.languagePanel) 1617 buttonGroup = ButtonGroup(parent=self.languagePanel, align=uiconst.TOTOP, padTop=8, button_alignment=AxisAlignment.START) 1618 buttonGroup.AddButton(label=GetByLabel('UI/Common/Buttons/Apply'), func=self.ApplyLanguageSettings, variant=ButtonVariant.GHOST) 1619 1620 def _ShowIMEAndVoiceOptions(self): 1621 columnData = [('header', GetByLabel('UI/SystemMenu/Language/VoiceOptions/Header')), ('checkbox', ('forceEnglishVoice', ('public', 'audio'), False), GetByLabel('UI/SystemMenu/Language/VoiceOptions/ForceEnglishVoice'))] 1622 self.ParseData(columnData, self.languagePanel) 1623 1624 def _ShowPseudolocOptions(self): 1625 if session and session.charid and session.role & (ROLE_QA | ROLE_WORLDMOD): 1626 self.DisplayLocalizationQAOptions() 1627 self.DisplayPseudolocalizationSample() 1628 1629 def DisplayLocalizationQAOptions(self): 1630 qaSettings = localization.settings.qaSettings 1631 if not hasattr(self, 'setShowMessageID'): 1632 self.setShowMessageID = qaSettings.GetValue('showMessageID') 1633 if not hasattr(self, 'setEnableBoundaryMarkers'): 1634 self.setEnableBoundaryMarkers = qaSettings.GetValue('enableBoundaryMarkers') 1635 if not hasattr(self, 'setShowHardcodedStrings'): 1636 self.setShowHardcodedStrings = qaSettings.GetValue('showHardcodedStrings') 1637 if not hasattr(self, 'setSimulateTooltip'): 1638 self.setSimulateTooltip = qaSettings.GetValue('simulateTooltip') 1639 if not hasattr(self, 'setEnableTextExpansion'): 1640 self.setEnableTextExpansion = qaSettings.GetValue('textExpansionAmount') > 0 1641 if not hasattr(self, 'setCharacterReplacementMethod'): 1642 self.setCharacterReplacementMethod = qaSettings.GetValue('characterReplacementMethod') 1643 if not hasattr(self, 'setTextExpansionAmount'): 1644 self.setTextExpansionAmount = qaSettings.GetValue('textExpansionAmount') 1645 localizationQAOptions = [('header', 'Localization QA Options'), 1646 ('checkbox', ('simulateTooltip', None, self.setSimulateTooltip), 'Simulate Tooltip (cancels other options)'), 1647 ('checkbox', ('showMessageID', None, self.setShowMessageID), 'Show MessageID'), 1648 ('checkbox', ('enableBoundaryMarkers', None, self.setEnableBoundaryMarkers), 'Show Boundary Markers'), 1649 ('checkbox', ('showHardcodedStrings', None, self.setShowHardcodedStrings), 'Show Hardcoded Strings')] 1650 if localization.IsPrimaryLanguage(localization.util.GetLanguageID()): 1651 conversionMethodOptions = [('< Select >', -1), 1652 ('No Simulation', 0), 1653 ('Simulate German', 1), 1654 ('Simulate Russian', 2), 1655 ('Simulate Japanese', 3)] 1656 if not hasattr(self, 'chosenPseudolocPreset'): 1657 self.chosenPseudolocPreset = -1 1658 localizationQAOptions += [('combo', 1659 ('pseudolocalizationPreset', None, self.chosenPseudolocPreset), 1660 'Simulation Preset', 1661 conversionMethodOptions, 1662 LABEL_WIDTH, 1663 'Simulation presets auto-configure the pseudolocalization settings to test for common localization issues.')] 1664 replacementMethodOptions = [('No Replacement', localization.settings.qaSettings.NO_REPLACEMENT), 1665 ('Diacritic Replacement', localization.settings.qaSettings.DIACRITIC_REPLACEMENT), 1666 ('Cyrillic Replacement', localization.settings.qaSettings.CYRILLIC_REPLACEMENT), 1667 ('Full-Width Replacement', localization.settings.qaSettings.FULL_WIDTH_REPLACEMENT)] 1668 localizationQAOptions += [('header', 'Localization QA: Advanced Settings'), ('combo', 1669 ('characterReplacementMethod', None, self.setCharacterReplacementMethod), 1670 'Char. Replacement', 1671 replacementMethodOptions, 1672 LABEL_WIDTH, 1673 'The character replacement method allows you to test for specific character rendering issues.'), ('checkbox', ('enableTextExpansion', None, self.setEnableTextExpansion), 'Text Expansion Enabled')] 1674 self.ParseData(localizationQAOptions, self.languagePanel) 1675 if self.setEnableTextExpansion: 1676 self.ConstructSlider(self.languagePanel, 'textExpansionAmount', None, self.setTextExpansionAmount, 'UI/SystemMenu/Language/LocalizationQAAdvanced/TextExpansion', (0.0, 0.5)) 1677 buttonGroup = ButtonGroup(parent=self.languagePanel, align=uiconst.TOTOP, padTop=8, button_alignment=AxisAlignment.START) 1678 buttonGroup.AddButton(label='Apply QA Settings', func=self.ApplyQALanguageSettings, variant=ButtonVariant.GHOST) 1679 1680 def DisplayPseudolocalizationSample(self): 1681 if session.languageID == 'EN': 1682 pseudolocalizationSample = [('header', 'Localization QA: Sample Text')] 1683 self.ParseData(pseudolocalizationSample, self.languagePanel, validateEntries=0) 1684 self.pseudolocalizedSampleTextLabel = carbonui.text.styles.TextBody(name='pseudolocSample', text=GetByLabel('UI/SystemMenu/SampleText'), parent=self.languagePanel, align=uiconst.TOTOP, padTop=2, padBottom=2, state=uiconst.UI_NORMAL) 1685 1686 def SetPseudolocalizationSettingsByPreset(self, presetValue): 1687 self.chosenPseudolocPreset = presetValue 1688 if presetValue == 0: 1689 self.setCharacterReplacementMethod = localization.settings.qaSettings.NO_REPLACEMENT 1690 self.setEnableTextExpansion = 0 1691 self.setTextExpansionAmount = 0.0 1692 elif presetValue == 1: 1693 self.setCharacterReplacementMethod = localization.settings.qaSettings.DIACRITIC_REPLACEMENT 1694 self.setEnableTextExpansion = True 1695 self.setTextExpansionAmount = 0.15 1696 self.setSimulateTooltip = False 1697 elif presetValue == 2: 1698 self.setCharacterReplacementMethod = localization.settings.qaSettings.CYRILLIC_REPLACEMENT 1699 self.setEnableTextExpansion = True 1700 self.setTextExpansionAmount = 0.05 1701 self.setSimulateTooltip = False 1702 elif presetValue == 3: 1703 self.setCharacterReplacementMethod = localization.settings.qaSettings.FULL_WIDTH_REPLACEMENT 1704 self.setEnableTextExpansion = False 1705 self.setTextExpansionAmount = 0.0 1706 self.setSimulateTooltip = False 1707 1708 def FindColorFromName(self, findColor, colors): 1709 for colorName, color in colors: 1710 if colorName == findColor: 1711 return color 1712 1713 def GetSliderHint(self, slider): 1714 value = slider.GetValue() 1715 if slider.name.startswith('wnd_'): 1716 return localization.formatters.FormatNumeric(int(value * 255)) 1717 elif slider.name == 'cameraSensitivitySlider': 1718 return self.GetCameraSensitivityHintText(value) 1719 elif slider.name in ('cameraInertiaSlider', 1720 'actionMenuExpandTime', 1721 TOOLTIP_SETTINGS_GENERIC, 1722 TOOLTIP_SETTINGS_BRACKET): 1723 return '' 1724 else: 1725 return localization.formatters.FormatNumeric(int(value * 100)) 1726 1727 def GetCameraSensitivityHintText(self, value): 1728 return '%.2f' % cameraUtil.GetCameraSensitivityMultiplier() 1729 1730 def OnSliderChanged(self, slider): 1731 idname = slider.name 1732 value = slider.GetValue() 1733 if idname.startswith('soundLevel_'): 1734 return self.GetSoundlevelSliderValue(idname, value) 1735 if idname == 'eveampGain': 1736 sm.GetService('audio').UserSetAmpVolume(value) 1737 elif idname == 'masterVolume': 1738 sm.GetService('audio').SetMasterVolume(value, persist=False) 1739 elif idname == 'uiGain': 1740 sm.GetService('audio').SetUIVolume(value, persist=False) 1741 elif idname == 'worldVolume': 1742 sm.GetService('audio').SetWorldVolume(value, persist=False) 1743 elif idname == 'evevoiceGain': 1744 sm.GetService('audio').SetVoiceVolume(value, persist=False) 1745 elif idname == 'cameraSensitivitySlider': 1746 self.OnSetCameraSensitivitySliderValue(value) 1747 elif idname == 'cameraInertiaSlider': 1748 self.OnSetCameraInertiaSliderValue(value) 1749 elif idname == 'textExpansionAmount': 1750 self.setTextExpansionAmount = value 1751 localization.settings.qaSettings.SetValue('textExpansionAmount', value) 1752 1753 def ChangeBrightness(self, *args, **kwargs): 1754 self.gammaSlider = GammaSlider() 1755 1756 def GetSoundlevelSliderValue(self, idname, value): 1757 settingName = idname.replace('soundLevel_', '') 1758 if self.isAudioInited: 1759 sm.GetService('audio').SetCustomValue(value, settingName, persist=True) 1760 1761 def OnInactiveSoundsChange(self, configName, checkbox): 1762 if configName == 'inactiveSounds_advancedSettings': 1763 settings.user.audio.Set('inactiveSounds_advancedSettings', checkbox.checked) 1764 self.__RebuildAudioPanel() 1765 return 1766 sm.GetService('audio').SetDampeningValueSetting(configName, setOn=checkbox.checked) 1767 1768 def OnLanguageCheckBoxChange(self, checkbox): 1769 if self.isElevatedUser: 1770 selectedLang = langutils.any_to_comfy_language(checkbox.GetReturnValue()) 1771 else: 1772 selectedLang = langutils.client_valid_or_default(checkbox.GetReturnValue()) 1773 setattr(self, 'setlanguageID', selectedLang.mls_language_id()) 1774 self.RefreshLanguage(allUI=False) 1775 1776 def OnCheckBoxChange(self, checkbox): 1777 if checkbox.GetSettingsPath() is None: 1778 if checkbox.GetSettingsKey() == const.autoRejectDuelSettingsKey: 1779 sm.GetService('characterSettings').Save(const.autoRejectDuelSettingsKey, str(int(checkbox.checked))) 1780 elif checkbox.GetSettingsKey() == DISABLE_EMERGENCY_WARP: 1781 sm.GetService('characterSettings').Save(DISABLE_EMERGENCY_WARP, str(int(checkbox.checked))) 1782 if checkbox.GetSettingsKey(): 1783 config = checkbox.GetSettingsKey() 1784 if config.startswith('inactiveSounds_'): 1785 return self.OnInactiveSoundsChange(config, checkbox) 1786 if config == 'offsetUIwithCamera': 1787 sm.ScatterEvent('OnUIoffsetChanged') 1788 self._CheckApplyCameraOffset() 1789 elif config == 'languageTooltip': 1790 self.setLanguageTooltip = checkbox.checked 1791 elif config == 'highlightImportant': 1792 self.setLocalizationHighlightImportant = checkbox.checked 1793 elif config == 'audioEnabled': 1794 if checkbox.checked: 1795 sm.GetService('audio').Activate() 1796 else: 1797 sm.GetService('audio').Deactivate() 1798 elif config == 'suppressTurret': 1799 sm.StartService('audio').SetTurretSuppression(checkbox.checked) 1800 elif config == 'damageMessages': 1801 idx = checkbox.parent.children.index(checkbox) + 1 1802 state = [uiconst.UI_HIDDEN, uiconst.UI_NORMAL][settings.user.ui.Get('damageMessages', 1)] 1803 for i in range(4): 1804 checkbox.parent.children[idx + i].state = state 1805 1806 elif config == 'invertCameraZoom': 1807 setting = gfxsettings.GetSettingFromSettingKey(config) 1808 gfxsettings.Set(setting, checkbox.checked, pending=False) 1809 sm.ScatterEvent('OnCameraZoomModifierChanged') 1810 elif gfxsettings.GetSettingFromSettingKey(config) is not None: 1811 setting = gfxsettings.GetSettingFromSettingKey(config) 1812 gfxsettings.Set(setting, checkbox.checked) 1813 elif config == 'enableTextExpansion': 1814 self.setEnableTextExpansion = checkbox.checked 1815 if not checkbox.checked: 1816 self.setTextExpansionAmount = 0.0 1817 self.RefreshLanguage(False) 1818 elif config == 'showMessageID': 1819 self.setShowMessageID = checkbox.checked 1820 if checkbox.checked: 1821 self.setSimulateTooltip = False 1822 self.RefreshLanguage(False) 1823 elif config == 'enableBoundaryMarkers': 1824 self.setEnableBoundaryMarkers = checkbox.checked 1825 if checkbox.checked: 1826 self.setSimulateTooltip = False 1827 self.RefreshLanguage(False) 1828 elif config == 'showHardcodedStrings': 1829 self.setShowHardcodedStrings = checkbox.checked 1830 if checkbox.checked: 1831 self.setSimulateTooltip = False 1832 self.RefreshLanguage(False) 1833 elif config == 'simulateTooltip': 1834 self.setSimulateTooltip = checkbox.checked 1835 if checkbox.checked: 1836 self.SetPseudolocalizationSettingsByPreset(0) 1837 self.setShowMessageID = False 1838 self.setEnableBoundaryMarkers = False 1839 self.setShowHardcodedStrings = False 1840 self.RefreshLanguage(False) 1841 elif config == 'soundLevel_advancedSettings': 1842 settings.user.audio.Set('soundLevel_advancedSettings', checkbox.checked) 1843 if checkbox.checked: 1844 sm.GetService('audio').EnableAdvancedSettings() 1845 else: 1846 sm.GetService('audio').DisableAdvancedSettings() 1847 self.__RebuildAudioPanel() 1848 elif config == 'overrideWithOldJukebox': 1849 sm.StartService('audio').SetOldJukeboxOverride(checkbox.checked) 1850 elif config == 'useCombatMusic': 1851 sm.StartService('audio').SetCombatMusicUsage(checkbox.checked) 1852 1853 def GetConfigName(self, suppression): 1854 configTranslation = {'AgtDelayMission': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/DelayMissionOfferDecision'), 1855 'AgtMissionOfferWarning': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AgentMissionOfferWarning'), 1856 'AgtMissionAcceptBigCargo': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AgentMissionAcceptsBigCargo'), 1857 'AgtDeclineMission': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AgentMissionDeclineWarning'), 1858 'AgtDeclineOnlyMission': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AgentDeclineOnlyMissionWarning'), 1859 'AgtDeclineImportantMission': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AgentDeclineImportantMissionWarning'), 1860 'AgtDeclineMissionSequence': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AgentDeclineMissionSequenceWarning'), 1861 'AgtQuitMission': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AgentQuitMissionWarning'), 1862 'AgtQuitImportantMission': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AgentQuitImportantMissionWarning'), 1863 'AgtQuitMissionSequence': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AgentQuitMissionSequenceWarning'), 1864 'AgtShare': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AgentShare'), 1865 'AgtNotShare': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AgentNotSharing'), 1866 'AskPartialCargoLoad': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/PartialCargoLoad'), 1867 'AskUndockInEnemySystem': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/UndockInEnemySystem'), 1868 'AidWithEnemiesEmpire2': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AidEnemiesInEmpireSpaceWarning'), 1869 'AidOutlawEmpire2': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AidOutlawInEmpireSpaceWarning'), 1870 'AidGlobalCriminalEmpire2': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AidCriminalInEmpireSpaceWarning'), 1871 'AttackInnocentEmpire2': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AttackInnocentPlayerInEmpireSpaceConfirmation'), 1872 'AttackInnocentEmpireAbort1': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AttackInnocentPlayerInEmpireSpaceConfirmation'), 1873 'AttackGoodNPC2': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AttackGoodPlayerConfirmation'), 1874 'AttackGoodNPCAbort1': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AttackGoodPlayerConfirmation'), 1875 'AttackAreaEmpire3': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AreaOfEffectModuleInEmpireSpaceConfirmation'), 1876 'AttackAreaEmpireAbort1': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AreaOfEffectModuleInEmpireSpaceConfirmation'), 1877 'AttackNonEmpire2': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AttackPlayerOwnedStuffConfirmation'), 1878 'AttackNonEmpireAbort1': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AttackPlayerOwnedStuffConfirmation'), 1879 'ConfirmOneWayItemMove': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/OneWayItemMoveConfirmation'), 1880 'ConfirmJumpToUnsafeSS': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/JumpToUnsafeSolarSystemConfirmation'), 1881 'ConfirmJettison': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/JettisonItemsConfirmation'), 1882 'AskQuitGame': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/QuitGameConfirmation'), 1883 'facAcceptEjectMaterialLoss': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/EjectBluePrintFromFactoryConformation'), 1884 'WarnDeleteFromAddressbook': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/DeleteFromAddressBookWarning'), 1885 'ConfirmDeleteFolder': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/DeleteFoldersConfirmation'), 1886 'AskCancelContinuation': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/ModifyCharacterConfirmation'), 1887 'ConfirmClearText': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/ClearTextConfirmation'), 1888 'ConfirmAbandonDrone': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/AbandonDroneConfirmation'), 1889 'QueueSaveChangesOnClose': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/TrainingQueueChanges'), 1890 'PI_Info': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/PlanetaryInteractionInfo'), 1891 'InvasionWarningUndock': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/InvasionWarningUndockConfirmation'), 1892 'CloseWindowStackPrompt': GetByLabel('UI/SystemMenu/ResetSettings/ResetSuppressMessageSettings/CloseWindowStackPrompt'), 1893 'ShipNameChangeOnAssemble': GetByLabel('UI/Ship/NameChange/ResetSuppressSetting')} 1894 if suppression[9:] in configTranslation: 1895 txt = configTranslation[suppression[9:]] 1896 else: 1897 txt = cfg.GetRawMessageTitle(suppression[9:]) 1898 if not txt: 1899 txt = suppression[9:] 1900 log.LogWarn('Missing system menu config translation', suppression[9:]) 1901 return txt 1902 1903 def ConfigBtnClick(self, suppress, *args): 1904 try: 1905 settings.user.suppress.Delete(suppress) 1906 self.isResetSettingsInited = 0 1907 self.LoadResetSettings(1) 1908 except: 1909 log.LogException() 1910 sys.exc_clear() 1911 1912 def ResetBtnClick(self, reset, *args): 1913 if reset == 'windows': 1914 self.isUserInterfaceInited = False 1915 uicore.cmd.Reset(reset) 1916 1917 @ThrottlePerSecond() 1918 def ReloadHUD(self, *args): 1919 if eveCfg.InShipInSpace() or IsControllingStructure(): 1920 sm.GetService('viewState').UpdateOverlays((uicore.layer.shipui,)) 1921 message = QuickMessage(className='Message', parent=uicore.layer.modal, name='ShipHudReloaded') 1922 message.ShowMsg(GetByLabel('UI/SystemMenu/ShipHudReloaded')) 1923 1924 def QuitBtnClick(self, *args): 1925 uicore.cmd.GetCommandAndExecute('CmdQuitGame') 1926 1927 def CloseMenu(self, *args): 1928 self.CheckColorBlindModeChanged() 1929 if self.gammaSlider and self.gammaSlider.IsOpen(): 1930 self.gammaSlider.Cancel() 1931 return 1932 try: 1933 if getattr(self, 'closing', False): 1934 return 1935 self.closing = 1 1936 if self.layerCont: 1937 self.layerCont.state = uiconst.UI_DISABLED 1938 if not getattr(self, 'inited', False): 1939 blue.pyos.synchro.Yield() 1940 uicore.layer.systemmenu.CloseView() 1941 if self and not self.destroyed: 1942 self.closing = 0 1943 return 1944 if self.layerCont: 1945 self.layerCont.state = uiconst.UI_HIDDEN 1946 finally: 1947 uicore.layer.systemmenu.CloseView() 1948 1949 def ApplyLanguageSettings(self, *args): 1950 importantNamesChanged = False 1951 bs = localization.settings.bilingualSettings 1952 if getattr(self, 'setImpNameSetting', None) is not None: 1953 bs.SetValue('localizationImportantNames', self.setImpNameSetting) 1954 importantNamesChanged = True 1955 if getattr(self, 'setLanguageTooltip', None) is not None: 1956 bs.SetValue('languageTooltip', self.setLanguageTooltip) 1957 importantNamesChanged = True 1958 if getattr(self, 'setLocalizationHighlightImportant', None) is not None: 1959 bs.SetValue('localizationHighlightImportant', self.setLocalizationHighlightImportant) 1960 importantNamesChanged = True 1961 if importantNamesChanged: 1962 bs.UpdateAndSaveSettings() 1963 languageWasChanged = False 1964 chosenLang = getattr(self, 'setlanguageID', None) 1965 if chosenLang: 1966 chosenLang = langutils.any_to_comfy_language(chosenLang) 1967 if chosenLang != self.init_language: 1968 languageWasChanged = True 1969 doReboot = False 1970 doLanguageSwap = False 1971 if languageWasChanged: 1972 ret = prompt_player_fsd_dialog('ChangeLanguageReboot', {}, uiconst.YESNO) 1973 if ret == uiconst.ID_YES: 1974 doLanguageSwap = True 1975 doReboot = True 1976 else: 1977 setattr(self, 'setlanguageID', None) 1978 self.RefreshLanguage(allUI=False) 1979 languageWasChanged = False 1980 return 1981 if doReboot and self.isElevatedUser: 1982 ret = prompt_player_fsd_dialog('CustomWarning', {'warning': 'You have elevated roles and can swap language live (in development). Some UI elements like chat channels might not be updated live. Still want to restart?', 1983 'header': 'Still want to restart?'}, uiconst.YESNO) 1984 if ret == uiconst.ID_NO: 1985 doReboot = False 1986 if doLanguageSwap: 1987 sm.GetService('gameui').SetLanguage(chosenLang, doReload=True) 1988 if doReboot: 1989 appUtils.Reboot('language change') 1990 else: 1991 localization.ClearImportantNameSetting() 1992 self.RefreshLanguage() 1993 elif importantNamesChanged: 1994 localization.ClearImportantNameSetting() 1995 self.RefreshLanguage() 1996 1997 def ApplyQALanguageSettings(self, *args): 1998 1999 def _setSetting(settingKey, controlID, defaultValue = False): 2000 localization.settings.qaSettings.SetValue(settingKey, getattr(self, controlID, defaultValue)) 2001 2002 _setSetting('showMessageID', 'setShowMessageID') 2003 _setSetting('enableBoundaryMarkers', 'setEnableBoundaryMarkers') 2004 _setSetting('showHardcodedStrings', 'setShowHardcodedStrings') 2005 _setSetting('simulateTooltip', 'setSimulateTooltip') 2006 _setSetting('characterReplacementMethod', 'setCharacterReplacementMethod', localization.settings.qaSettings.NO_REPLACEMENT) 2007 if not getattr(self, 'setEnableTextExpansion', False): 2008 localization.settings.qaSettings.SetValue('textExpansionAmount', 0) 2009 self.chosenPseudolocPreset = -1 2010 localization.settings.qaSettings.UpdateAndSaveSettings() 2011 localization.ClearImportantNameSetting() 2012 self.RefreshLanguage() 2013 2014 def GetMouseButtonOptions(self): 2015 actionbtnOps = [(GetByLabel('UI/Common/Input/Mouse/LeftMouseButton'), uiconst.MOUSELEFT), 2016 (GetByLabel('UI/Common/Input/Mouse/MiddleMouseButton'), uiconst.MOUSEMIDDLE), 2017 (GetByLabel('UI/Common/Input/Mouse/RightMouseButton'), uiconst.MOUSERIGHT), 2018 (GetByLabel('UI/Common/Input/Mouse/ExtraMouseButton1'), uiconst.MOUSEXBUTTON1), 2019 (GetByLabel('UI/Common/Input/Mouse/ExtraMouseButton2'), uiconst.MOUSEXBUTTON2)] 2020 return actionbtnOps 2021 2022 def GetSnapOptions(self): 2023 snapOps = [(GetByLabel('UI/SystemMenu/GeneralSettings/Windows/DontSnap'), 0), 2024 (formatters.FormatNumeric(3), 3), 2025 (formatters.FormatNumeric(6), 6), 2026 (formatters.FormatNumeric(12), 12), 2027 (formatters.FormatNumeric(24), 24)] 2028 return snapOps 2029 2030 def GetFontSizeOptions(self): 2031 if is_new_font_size_options_enabled(): 2032 return ((GetByLabel('UI/SystemMenu/GeneralSettings/FontSizeExtraSmall'), FontSizeOption.EXTRA_SMALL), 2033 (GetByLabel('UI/SystemMenu/GeneralSettings/FontSizeSmall'), FontSizeOption.SMALL), 2034 (GetByLabel('UI/SystemMenu/GeneralSettings/FontSizeMedium'), FontSizeOption.MEDIUM), 2035 (GetByLabel('UI/SystemMenu/GeneralSettings/FontSizeLarge'), FontSizeOption.LARGE), 2036 (GetByLabel('UI/SystemMenu/GeneralSettings/FontSizeExtraLarge'), FontSizeOption.EXTRA_LARGE)) 2037 else: 2038 return ((GetByLabel('UI/SystemMenu/GeneralSettings/FontSizeSmall'), FontSizeOption.SMALL), (GetByLabel('UI/SystemMenu/GeneralSettings/FontSizeMedium'), FontSizeOption.MEDIUM), (GetByLabel('UI/SystemMenu/GeneralSettings/FontSizeLarge'), FontSizeOption.LARGE)) 2039 2040 def GetMouseCursorSizeOptions(self): 2041 return ((GetByLabel('UI/SystemMenu/GeneralSettings/CursorSizeNormal'), CursorSize.NORMAL), (GetByLabel('UI/SystemMenu/GeneralSettings/CursorSizeLarge'), CursorSize.LARGE), (GetByLabel('UI/SystemMenu/GeneralSettings/CursorSizeExtraLarge'), CursorSize.EXTRA_LARGE)) 2042 2043 def GetTooltipSection(self, parent): 2044 SystemMenuHeader(parent=parent, text=GetByLabel('UI/SystemMenu/GeneralSettings/TooltipsHeader')) 2045 SystemMenuSlider(parent=parent, name=TOOLTIP_SETTINGS_GENERIC, config=(TOOLTIP_SETTINGS_GENERIC, ('user', 'ui'), TOOLTIP_DELAY_GENERIC), minValue=TOOLTIP_DELAY_MIN, maxValue=TOOLTIP_DELAY_MAX, label='UI/SystemMenu/GeneralSettings/Tooltips/GeneralTooltipsDelay', hint=None, labelWidth=120, minLabel=GetByLabel('UI/SystemMenu/GeneralSettings/Tooltips/NoTooltipsDelay'), maxLabel=GetByLabel('UI/SystemMenu/GeneralSettings/Tooltips/LongTooltipsDelay'), increments=None, snapToIncrements=None, callback=self.OnSliderChanged, getHintFunc=self.GetSliderHint, on_dragging=self.OnSliderChanged, state=False) 2046 2047 def GetMouseCursorSection(self, parent): 2048 SystemMenuHeader(parent=parent, text=GetByLabel('UI/SystemMenu/GeneralSettings/General/MouseCursor')) 2049 SystemMenuCombo(label=GetByLabel('UI/SystemMenu/GeneralSettings/General/CursorSize'), parent=parent, options=self.GetMouseCursorSizeOptions(), name='cursorSize', select=cursor_size_setting.get(), callback=lambda combo, header, value: cursor_size_setting.set(value), labelleft=LABEL_WIDTH, align=uiconst.TOTOP, hint=None) 2050 2051 def ConstructSpaceMouseSettings(self, parent): 2052 SystemMenuHeader(parent=parent, text=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/Header')) 2053 SystemMenuSlider(parent=parent, config=('spaceMouseSpeed', ('user', 'ui'), gfxsettings.GetDefault(gfxsettings.UI_CAMERA_SPACEMOUSE_SPEED_COEFFICIENT)), label='UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/Speed', minValue=0.0, maxValue=1.0, minLabel=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/SpeedMin'), maxLabel=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/SpeedMax'), hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/SpeedTooltip'), increments=[0.5], snapToIncrements=False, callback=self.OnSpaceMouseSpeedSliderValue) 2054 SystemMenuSlider(parent=parent, config=('spaceMouseAcceleration', ('user', 'ui'), gfxsettings.GetDefault(gfxsettings.UI_CAMERA_SPACEMOUSE_ACCELERATION_COEFFICIENT)), label='UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/Acceleration', minValue=0.0, maxValue=1.0, minLabel=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/AccelerationMin'), maxLabel=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/AccelerationMax'), hint=GetByLabel('UI/SystemMenu/DisplayAndGraphics/CameraSettings/SpaceMouse/AccelerationTooltip'), increments=[0.5], snapToIncrements=False, callback=self.OnSpaceMouseAccelerationSliderValue) 2055 2056 def OnSpaceMouseSpeedSliderValue(self, slider): 2057 gfxsettings.Set(gfxsettings.UI_CAMERA_SPACEMOUSE_SPEED_COEFFICIENT, slider.GetValue(), pending=False) 2058 sm.ScatterEvent('OnSpaceMouseSpeedCoefficientChanged') 2059 2060 def OnSpaceMouseAccelerationSliderValue(self, slider): 2061 gfxsettings.Set(gfxsettings.UI_CAMERA_SPACEMOUSE_ACCELERATION_COEFFICIENT, slider.GetValue(), pending=False) 2062 sm.ScatterEvent('OnSpaceMouseAccelerationCoefficientChanged') 2063 2064 def _ShouldShowNotificationOptions(self): 2065 return not sm.GetService('notificationUIService').AreNotificationsAlwaysEnabled() 2066 2067 def _ShouldShowNeocomNotificationOptions(self): 2068 return sm.IsServiceRunning('neocom') and sm.GetService('neocom').IsAvailable() 2069 2070 def ConstructNotificationSection(self, column): 2071 shouldShowNotificationOptions = self._ShouldShowNotificationOptions() 2072 shouldShowNeocomOptions = self._ShouldShowNeocomNotificationOptions() 2073 if not shouldShowNotificationOptions and not shouldShowNeocomOptions: 2074 return 2075 SystemMenuHeader(text=GetByLabel('UI/SystemMenu/GeneralSettings/Notifications/Header'), parent=column) 2076 if shouldShowNotificationOptions: 2077 Checkbox(text=GetByLabel('UI/SystemMenu/GeneralSettings/Notifications/NotificationsEnabled'), parent=column, checked=NotificationSettingHandler().GetNotificationWidgetEnabled(), callback=self.ToggleNotificationsEnabled) 2078 if shouldShowNeocomOptions: 2079 Checkbox(text=GetByLabel('UI/SystemMenu/GeneralSettings/Notifications/InventoryBadgingEnabled'), parent=column, checked=self.IsInventoryBadgingEnabled(), callback=self.ToggleInventoryBadgingEnabled) 2080 2081 def ToggleNotificationsEnabled(self, *args): 2082 NotificationSettingHandler().ToggleNotificationWidgetEnabled() 2083 2084 def IsInventoryBadgingEnabled(self): 2085 return IsInventoryBadgingEnabled() 2086 2087 def ToggleInventoryBadgingEnabled(self, *args): 2088 ToggleInventoryBadgingEnabledInClient() 2089 2090 def CheckColorBlindModeChanged(self): 2091 if self.colorBlindModeChanged: 2092 colorblind.on_colorblind_mode_changed() 2093 self.colorBlindModeChanged = False 2094 2095 def _ConstructWindowMarginCombo(self, column): 2096 options = [ (WindowMarginModeOption.get_name(margin_mode_option), margin_mode_option, WindowMarginModeOption.get_hint(margin_mode_option)) for margin_mode_option in sorted(WindowMarginModeOption.iter(), key=WindowMarginModeOption.get_sort_key) ] 2097 2098 def set_window_margin_mode(combo, text, value): 2099 window_margin_mode.setting.set(value) 2100 2101 carbonui.text.styles.TextBody(parent=column, align=uiconst.TOTOP, text=GetByLabel('UI/SystemMenu/GeneralSettings/Windows/WindowMarginModeTitle'), padTop=4) 2102 Combo(name='window_margin_mode', parent=column, align=uiconst.TOTOP, options=options, select=window_margin_mode.setting.get(), callback=set_window_margin_mode, hint=GetByLabel('UI/SystemMenu/GeneralSettings/Windows/WindowMarginModeHint')) 2103 2104 def AppendColorBlindnessConfiguration(self, column): 2105 cont = ContainerAutoSize(parent=column, align=uiconst.TOTOP, padding=(0, 6, 0, 6)) 2106 SystemMenuHeader(text=GetByLabel('UI/SystemMenu/GeneralSettings/ColorBlindMode'), parent=cont) 2107 options = [(GetByLabel('UI/SystemMenu/GeneralSettings/ColorBlindModeOff'), colorblind.MODE_OFF), 2108 (GetByLabel('UI/SystemMenu/GeneralSettings/ColorBlindModeDeuteranopia'), colorblind.MODE_DEUTERANOPIA), 2109 (GetByLabel('UI/SystemMenu/GeneralSettings/ColorBlindModeTritonopia'), colorblind.MODE_TRITONOPIA), 2110 (GetByLabel('UI/SystemMenu/GeneralSettings/ColorBlindModeCustom'), colorblind.MODE_CUSTOM)] 2111 self.colorBlindModeCombo = Combo(parent=cont, options=options, name='colorBlindModeSetting', select=colorblind.GetMode(), callback=self.OnColorblindCombo, align=uiconst.TOTOP, padTop=2, hint=GetByLabel('UI/SystemMenu/GeneralSettings/ColorBlindComboHint')) 2112 self.colorBlindCont = ContainerAutoSize(parent=cont, align=uiconst.TOTOP) 2113 self.colorBlindHuePicker = ColorBlindHuePicker(parent=self.colorBlindCont, align=uiconst.TOTOP, padTop=4, onHueClicked=self.OnColorBlindHueClicked) 2114 self.colorBlindHuePalette = ColorBlindHuePalette(parent=self.colorBlindCont, align=uiconst.TOTOP, height=20, padTop=10) 2115 self.CheckShowColorBlindOptions() 2116 2117 def OnColorBlindHueClicked(self, hue): 2118 if colorblind.GetMode() != colorblind.MODE_CUSTOM: 2119 currHues = self.colorBlindHuePicker.GetActiveHues() 2120 colorblind.SetCustomHues(currHues) 2121 colorblind.ToggleCustomHue(hue) 2122 mode = colorblind.MODE_CUSTOM 2123 self.colorBlindModeCombo.SetValue(mode) 2124 self.SetColorBlindMode(mode) 2125 2126 def OnColorblindCombo(self, combo, text, value): 2127 self.SetColorBlindMode(value) 2128 2129 def SetColorBlindMode(self, value): 2130 colorblind.SetMode(value) 2131 self.colorBlindModeChanged = True 2132 self.CheckShowColorBlindOptions() 2133 self.colorBlindHuePicker.UpdateHues() 2134 self.colorBlindHuePalette.Reconstruct() 2135 2136 def CheckShowColorBlindOptions(self): 2137 self.colorBlindCont.display = colorblind.GetMode() != colorblind.MODE_OFF 2138 2139 def AppendColorThemeSelection(self, column): 2140 colorTheme = ColorThemeContainer(parent=column, align=uiconst.TOTOP, padTop=8, ui_color_service=sm.GetService('uiColor'), height=400) 2141 colorTheme.on_omega_button_clicked.connect(self.CloseView) 2142 2143 def ConstructAndAppendOptionalClientUpdate(self, column): 2144 optionalUpgradeData = [('header', GetByLabel('UI/SystemMenu/GeneralSettings/ClientUpdate/Header'))] 2145 if len(optionalUpgradeData) > 1: 2146 self.ParseData(entries=optionalUpgradeData, parent=column, validateEntries=False) 2147 2148 def ConstructColumn1MenuData(self, parent): 2149 menufontsizeOps = self.GetFontSizeOptions() 2150 SystemMenuCombo(label=GetByLabel('UI/SystemMenu/GeneralSettings/General/ClientFontSize'), parent=parent, options=menufontsizeOps, name='clientFontSize', select=self.GetSettingsValue('clientFontSize', ('public', 'ui'), get_default_font_size_setting(session.languageID)), callback=self.OnComboChange, labelleft=LABEL_WIDTH, align=uiconst.TOTOP, hint=None) 2151 Checkbox(parent=parent, align=uiconst.TOTOP, text=GetByLabel('UI/SystemMenu/GeneralSettings/TextShadowOption'), setting=font_shadow_enabled_setting) 2152 if session.userid: 2153 self.GetTooltipSection(parent) 2154 if not sys.platform.startswith('darwin'): 2155 self.GetMouseCursorSection(parent) 2156 SystemMenuHeader(parent=parent, text=GetByLabel('UI/SystemMenu/GeneralSettings/TooltipsHeader')) 2157 Checkbox(text=GetByLabel('UI/SystemMenu/GeneralSettings/Windows/OnlyStackWindowsIfShiftIsPressed'), parent=parent, settingsKey='stackwndsonshift', checked=int(self.GetSettingsValue('stackwndsonshift', ('user', 'ui'), 0)), callback=self.OnCheckBoxChange, settingsPath=('user', 'ui'), padLeft=0, padBottom=4) 2158 Checkbox(text=GetByLabel('UI/SystemMenu/GeneralSettings/Windows/TryUseExistingInfoWin'), parent=parent, settingsKey='useexistinginfownd', checked=int(self.GetSettingsValue('useexistinginfownd', ('user', 'ui'), 1)), callback=self.OnCheckBoxChange, settingsPath=('user', 'ui'), padLeft=0, padBottom=4) 2159 2160 def ConstructDuelMenuData(self): 2161 menusData = [] 2162 if session.charid: 2163 menusData += [('header', GetByLabel('UI/Crimewatch/Duel/EscMenuSectionHeader')), ('checkbox', (appConst.autoRejectDuelSettingsKey, 'server_setting', 0), GetByLabel('UI/Crimewatch/Duel/AutoRejectDuelInvites'))] 2164 return menusData 2165 2166 def ConstructBoardingCinematicsMenuData(self): 2167 menusData = [] 2168 if session.charid: 2169 menusData += [('header', GetByLabel('UI/ShipProgression/EscMenuBoardingCinematicHeader')), ('checkbox', ('show_boarding_cinematic', ('user', 'ui'), 1), GetByLabel('UI/ShipProgression/ShowBoardingCinematic'))] 2170 return menusData 2171 2172 def ConstructMapSection(self, parent): 2173 if not session.userid: 2174 return 2175 SystemMenuHeader(text=GetByLabel('UI/SystemMenu/GeneralSettings/Map/Header'), parent=parent) 2176 Checkbox(text=GetByLabel('UI/SystemMenu/GeneralSettings/Map/ClassicMapToggle'), parent=parent, align=uiconst.TOTOP, setting=classic_map_enabled_setting) 2177 2178 def ConstructCrashesSection(self, parent): 2179 column = parent 2180 SystemMenuHeader(text=GetByLabel('UI/SystemMenu/GeneralSettings/Crashes/Header'), parent=column) 2181 Checkbox(text=GetByLabel('UI/SystemMenu/GeneralSettings/Crashes/UploadCrashDumpsToCCPEnabled'), parent=column, checked=blue.IsCrashReportingEnabled(), callback=self.EnableDisableCrashReporting) 2182 2183 def ConstructInflightMenuData(self): 2184 SystemMenuHeader(parent=self.gameplayPanel, text=GetByLabel('UI/SystemMenu/GeneralSettings/Inflight/Header'), padTop=0) 2185 inflightData = [('combo', 2186 ('autoTargetBack', ('user', 'ui'), 0), 2187 GetByLabel('UI/SystemMenu/GeneralSettings/Inflight/AutoTargetBack'), 2188 self._GetAutoTargetBackOptions(), 2189 LABEL_WIDTH), ('combo', 2190 ('actionmenuBtn', ('user', 'ui'), 0), 2191 GetByLabel('UI/SystemMenu/GeneralSettings/Inflight/ExpandActionMenu'), 2192 self.GetMouseButtonOptions(), 2193 LABEL_WIDTH), ('slider', 2194 ('actionMenuExpandTime', ('user', 'ui'), RADIAL_MENU_EXPAND_DELAY_DEFAULT), 2195 'UI/SystemMenu/GeneralSettings/Inflight/RadialMenuDelay', 2196 (RADIAL_MENU_EXPAND_DELAY_MIN, RADIAL_MENU_EXPAND_DELAY_MAX), 2197 120, 2198 75, 2199 GetByLabel('UI/SystemMenu/GeneralSettings/Inflight/NoBracketListDelay'), 2200 GetByLabel('UI/SystemMenu/GeneralSettings/Inflight/LongBracketListDelay'))] 2201 if session.userid: 2202 inflightData += [('slider', 2203 (TOOLTIP_SETTINGS_BRACKET, ('user', 'ui'), TOOLTIP_DELAY_BRACKET), 2204 'UI/SystemMenu/GeneralSettings/Inflight/BracketListDelay', 2205 (TOOLTIP_DELAY_MIN, TOOLTIP_DELAY_MAX), 2206 120, 2207 None, 2208 GetByLabel('UI/SystemMenu/GeneralSettings/Inflight/NoRadialMenuDelay'), 2209 GetByLabel('UI/SystemMenu/GeneralSettings/Inflight/LongRadialMenuDelay')), ('checkbox', ('bracketmenu_docked', ('user', 'ui'), False), GetByLabel('UI/SystemMenu/GeneralSettings/Inflight/CompactBracketListWhenSnapped')), ('checkbox', ('bracketmenu_floating', ('user', 'ui'), True), GetByLabel('UI/SystemMenu/GeneralSettings/Inflight/CompactBracketListWhenNotSnapped'))] 2210 if session.charid: 2211 inflightData += [('checkbox', (DISABLE_EMERGENCY_WARP, 'server_setting', 0), GetByLabel('UI/SystemMenu/GeneralSettings/Inflight/DisableEmergencyWarp'))] 2212 return inflightData 2213 2214 def _GetAutoTargetBackOptions(self): 2215 atOps = [] 2216 for i in range(13): 2217 if i == 0: 2218 atOps.append((GetByLabel('UI/SystemMenu/GeneralSettings/Inflight/ZeroTargets', targetCount=i), i)) 2219 else: 2220 atOps.append((GetByLabel('UI/SystemMenu/GeneralSettings/Inflight/Targets', targetCount=i), i)) 2221 2222 return atOps 2223 2224 def EnableDisableCrashReporting(self, checkbox): 2225 try: 2226 blue.EnableCrashReporting(checkbox.checked) 2227 except RuntimeError: 2228 pass 2229 finally: 2230 prefs.SetValue('breakpadUpload', 1 if checkbox.checked else 0)