def build_sound(self): table = GlassTablePlus(); table.setFrame(0); table.horizontalJustification = glass.Graphics.LEFT; MasterVolume = glass.GlassSlider(); MasterVolume.linkCvar( "sound_mastervolume" ); MasterVolume.setScaleEnd(1.0); MasterVolume.setScaleStart(0); table.addRow("Master Volume", MasterVolume); MusicVolume = glass.GlassSlider(); MusicVolume.linkCvar( "sound_musicvolume" ); MusicVolume.setScaleEnd(1.0); MusicVolume.setScaleStart(0); table.addRow("Music Volume", MusicVolume); SoundVolume = glass.GlassSlider(); SoundVolume.linkCvar( "sound_sfxVolume" ); SoundVolume.setScaleEnd(1.0); SoundVolume.setScaleStart(0); TestSoundButton = glass.GlassButton("Test"); TestSoundButton.setClickAction("Sound_PlaySound('/sound/human/player/male/good_game_1.ogg');"); table.addRow("Sound Effect Volume", SoundVolume,TestSoundButton); #TODO play this sound when the slider loses focus, ie when the car is released softwareMode = glass.GlassCheckbox(); softwareMode.linkCvar("sound_softwareMode"); table.addRow("Software Mode", softwareMode); mixrate = glass.GlassDropMenu(); mixrate.linkCvar("sound_mixrate"); mixrate.addOption("22050", "22050") mixrate.addOption("44100", "44100") mixrate.addOption("48000", "48000") table.addRow("Sampling Rate", mixrate); channels = glass.GlassSpinner(); channels.linkCvar("sound_numChannels"); channels.setStep(32); channels.setWidth(50); table.addRow("Sound Channels", channels); VoIPVolume = glass.GlassSlider(); VoIPVolume.linkCvar( "sound_voipvolume" ); VoIPVolume.setScaleEnd(1.0); VoIPVolume.setScaleStart(0); table.addRow("Voice Volume", VoIPVolume); table.adjustSizeTo(); tableHolder = glass.GlassScrollArea(table); tableHolder.setSize(table.getWidth(), table.getHeight()); return tableHolder;
def __init__(self): glass.GlassWindow.__init__(self, 'Graphics Panel') self.first = True self.setBackgroundColor(glass.Color(0, 0, 0, 128)) self.setTitleVisible(0) self.setSizePct(0.55, 0.8) self.setVisible(False) # config self.table = GlassTablePlus() self.table.setFrame(0) self.table.setCellPadding(2) self.table.horizontalJustification = glass.Graphics.LEFT self.table.addRow("^gConfig", "") self.table.addRow() blockLeap = glass.GlassCheckbox() blockLeap.linkCvar("cl_blockLeapSwitch") self.table.addRow("Block / Leap Switch", blockLeap) showFPS = glass.GlassDropMenu() showFPS.linkCvar("cl_showfps") showFPS.addOption("Off", "0") showFPS.addOption("Instant", "1") showFPS.addOption("Average", "2") showFPS.addOption("Both", "3") self.table.addRow("Show FPS", showFPS) showServerFPS = glass.GlassCheckbox() showServerFPS.linkCvar("cl_showfpsserver") self.table.addRow("Show Server FPS", showServerFPS) showPing = glass.GlassDropMenu() showPing.linkCvar("gui_showping") showPing.addOption("Off", "0") showPing.addOption("Instant", "1") showPing.addOption("Average", "2") self.table.addRow("Show Ping", showPing) showTeamStatus = glass.GlassCheckbox() showTeamStatus.linkCvar("gui_showteamstatus") self.table.addRow("Show Team Status", showTeamStatus) thirdPerson = glass.GlassCheckbox() thirdPerson.linkCvar("cl_alwaysThirdPerson") self.table.addRow("Force Third Person", thirdPerson) cameraView = glass.GlassDropMenu() cameraView.linkCvar("cl_cameraPosLerp") cameraView.addOption("Smoothed", "6") cameraView.addOption("Snappy", "9999") self.table.addRow("Camera Snap", cameraView) cameraSmoothing = glass.GlassDropMenu() cameraSmoothing.linkCvar("cl_cameraAngleLerp") cameraSmoothing.addOption("Snap", "9999") cameraSmoothing.addOption("Quick", "50") cameraSmoothing.addOption("Smooth", "35") cameraSmoothing.addOption("Very Smooth", "15") cameraSmoothing.addOption("Demo Spectate", "5") self.table.addRow("Camera Smoothing", cameraSmoothing) # Graphics self.table.addRow() self.table.addRow("^gGraphics", "") self.table.addRow() gamma = glass.GlassSlider() gamma.linkCvar("vid_gamma") gamma.setScaleEnd(2.5) gamma.setScaleStart(0.5) self.table.addRow("Brightness", gamma) showArmor = glass.GlassCheckbox() showArmor.linkCvar("cl_showLevelArmor") self.table.addRow("Show Armor", showArmor) showImpacts = glass.GlassCheckbox() showImpacts.linkCvar("cl_collisionDecals") self.table.addRow("Show Impact Effects", showImpacts) showBlood = glass.GlassCheckbox() showBlood.linkCvar("cl_bloodSplatter") self.table.addRow("Show Blood Splatter", showBlood) grassFalloff = glass.GlassDropMenu() grassFalloff.linkCvar("gfx_foliageFalloff") grassFalloff.addOption("Off", "0") grassFalloff.addOption("Near", "100") grassFalloff.addOption("Far", "700") grassFalloff.addOption("Very Far", "1500") self.table.addRow("Grass Falloff", grassFalloff) showClouds = glass.GlassCheckbox() showClouds.linkCvar("gfx_clouds") self.table.addRow("Show Clouds", showClouds) showShadows = glass.GlassDropMenu() showShadows.linkCvar("gfx_shadow") showShadows.addOption("Off", "0") showShadows.addOption("Fast", "1") showShadows.addOption("Nice", "3") self.table.addRow("Shadows", showShadows) useShaders = glass.GlassDropMenu() useShaders.linkCvar("gfx_GLSLQuality") useShaders.addOption("^900Off", "0") useShaders.addOption("Low", "1") useShaders.addOption("High", "3") self.table.addRow("Shaders", useShaders) forceSoft = glass.GlassCheckbox() forceSoft.linkCvar("gfx_forceSoftware") self.table.addRow("Force CPU Animation", forceSoft) postProcMaster = glass.GlassCheckbox() postProcMaster.linkCvar("gfx_postProcessing") #TODO: disable the other post proc checkboxes if this is disabled self.table.addRow("Post-Processing", postProcMaster) postBloom = glass.GlassCheckbox() postBloom.linkCvar("gfx_postBloom") self.table.addRow(" Bloom Filter", postBloom) postMotion = glass.GlassCheckbox() postMotion.linkCvar("gfx_postMotion") self.table.addRow(" Motion Blur", postMotion) showGlow = glass.GlassCheckbox() showGlow.linkCvar("gfx_glowFilter") self.table.addRow(" Glow Filter", showGlow) postWater = glass.GlassCheckbox() postWater.linkCvar("gfx_postWater") self.table.addRow(" Water Effects", postWater) postSSAO = glass.GlassCheckbox() postSSAO.linkCvar("gfx_postSSAO") self.table.addRow(" Ambient Occlusion", postSSAO) # Sound self.table.addRow() self.table.addRow("^gSound", "") self.table.addRow() MasterVolume = glass.GlassSlider() MasterVolume.linkCvar("sound_mastervolume") MasterVolume.setScaleEnd(1.0) MasterVolume.setScaleStart(0) self.table.addRow("Master Volume", MasterVolume) MusicVolume = glass.GlassSlider() MusicVolume.linkCvar("sound_musicvolume") MusicVolume.setScaleEnd(1.0) MusicVolume.setScaleStart(0) self.table.addRow("Music Volume", MusicVolume) SoundVolume = glass.GlassSlider() SoundVolume.linkCvar("sound_sfxVolume") SoundVolume.setScaleEnd(1.0) SoundVolume.setScaleStart(0) VoIPVolume = glass.GlassSlider() VoIPVolume.linkCvar("sound_voipvolume") VoIPVolume.setScaleEnd(1.0) VoIPVolume.setScaleStart(0) self.table.addRow("Voice Volume", VoIPVolume) internalHeight = self.getChildrenArea().height self.scrollArea = glass.GlassScrollArea(self.table) self.add(self.scrollArea) self.scrollArea.setScrollPolicy(glass.GlassScrollArea.SHOW_NEVER, glass.GlassScrollArea.SHOW_ALWAYS) bar = self.scrollArea.getScrollbarWidth() self.scrollArea.setWidth( min(self.getWidth() + bar, self.getWidth() - 8)) self.scrollArea.setHeight(min(internalHeight + bar, internalHeight - 4))
def build_graphics(self): table = GlassTablePlus(); table.setFrame(0); table.horizontalJustification = glass.Graphics.LEFT; videoResolution = glass.GlassDropMenu(); videoResolution.linkCvar("vid_mode"); videoResolution.addSelectionListener(reshandler); i=1; mode = cvar_get("vid_mode"+str(i)); while len(mode) > 0: videoResolution.addOption(mode, mode); i += 1; mode = cvar_get("vid_mode"+str(i)); table.addRow( "Video Resolution" , videoResolution ); fullscreen = glass.GlassCheckbox(); fullscreen.linkCvar("vid_fullscreen"); fullscreen.addSelectionListener(reshandler); table.addRow( "Full Screen", fullscreen ); fov = glass.GlassDropMenu(); fov.linkCvar("cl_fov"); fov.addOption("4:3", "90"); fov.addOption("16:9", "110"); fov.addOption("16:10", "100"); table.addRow( "Frame", fov); gamma = glass.GlassSlider(); gamma.linkCvar( "vid_gamma" ); gamma.setScaleEnd(2.5); gamma.setScaleStart(0.5); table.addRow( "Brightness" , gamma ); showArmor = glass.GlassCheckbox(); showArmor.linkCvar( "cl_showLevelArmor"); table.addRow( "Show Armor" , showArmor ); showImpacts = glass.GlassCheckbox(); showImpacts.linkCvar("cl_collisionDecals"); table.addRow( "Show Impact Effects", showImpacts); showBlood = glass.GlassCheckbox(); showBlood.linkCvar("cl_bloodSplatter"); table.addRow( "Show Blood Splatter", showBlood ); antiAliasing = glass.GlassDropMenu(); antiAliasing.linkCvar("vid_multisample"); antiAliasing.addOption("None", "0"); antiAliasing.addOption("2x", "2"); antiAliasing.addOption("4x", "4"); antiAliasing.addSelectionListener(reshandler); table.addRow( "Anti-Aliasing", antiAliasing ); showClouds = glass.GlassCheckbox(); showClouds.linkCvar("gfx_clouds"); table.addRow( "Show Clouds", showClouds ); useShaders = glass.GlassDropMenu(); useShaders.linkCvar("gfx_GLSLQuality"); useShaders.addOption("^900Off", "0"); useShaders.addOption("Low", "1"); useShaders.addOption("High", "3"); table.addRow( "Shaders", useShaders); forceSoft = glass.GlassCheckbox(); forceSoft.linkCvar("gfx_forceSoftware"); table.addRow( "Force CPU Animation", forceSoft ); showGrass = glass.GlassCheckbox(); showGrass.linkCvar("gfx_grass"); table.addRow( "Show Grass", showGrass ); grassFalloff = glass.GlassDropMenu(); grassFalloff.linkCvar("gfx_grassRange") grassFalloff.addOption("Near","500"); grassFalloff.addOption("Far","1500"); grassFalloff.addOption("Very Far","3500"); table.addRow( "Grass Falloff", grassFalloff ); showShadows = glass.GlassDropMenu(); showShadows.linkCvar("gfx_shadow"); showShadows.addOption("Off", "0"); showShadows.addOption("Fast", "1"); showShadows.addOption("Nice", "3"); table.addRow( "Shadows", showShadows); postProcMaster = glass.GlassCheckbox(); postProcMaster.linkCvar("gfx_postProcessing"); #TODO: disable the other post proc checkboxes if this is disabled table.addRow( "Post-Processing", postProcMaster); postBloom = glass.GlassCheckbox(); postBloom.linkCvar("gfx_postBloom"); table.addRow( " Bloom Filter", postBloom); postMotion = glass.GlassCheckbox(); postMotion.linkCvar("gfx_postMotion"); table.addRow( " Motion Blur", postMotion); showGlow = glass.GlassCheckbox(); showGlow.linkCvar("gfx_glowFilter"); table.addRow( " Glow Filter", showGlow ); postWater = glass.GlassCheckbox(); postWater.linkCvar("gfx_postWater"); table.addRow( " Water Effects", postWater); postSSAO = glass.GlassCheckbox(); postSSAO.linkCvar("gfx_postSSAO"); table.addRow( " Ambient Occlusion", postSSAO); table.adjustSizeTo(); tableHolder = glass.GlassScrollArea(table); tableHolder.setSize(table.getWidth(), table.getHeight()); return tableHolder;
def build_config(self): table = GlassTablePlus(); table.setFrame(0); table.horizontalJustification = glass.Graphics.LEFT; self.nickname = glass.GlassTextField( cvar_get("name") ); self.nickname.setSize(150, 25); table.addRow( "Nickname", self.nickname ); blockLeap = glass.GlassCheckbox(); blockLeap.linkCvar("cl_blockLeapSwitch"); table.addRow("Block / Leap Switch", blockLeap); chatFilter = glass.GlassCheckbox(); chatFilter.linkCvar("cl_filter_filter"); table.addRow( "Chat Filter", chatFilter ); chatTimestamp = glass.GlassDropMenu(); chatTimestamp.linkCvar("gui_chatTimestamp"); chatTimestamp.addOption("Off","0"); chatTimestamp.addOption("Game Time","1"); chatTimestamp.addOption("Local Time","2"); table.addRow("Chat Timestamp", chatTimestamp); showFPS = glass.GlassDropMenu(); showFPS.linkCvar("cl_showfps"); showFPS.addOption("Off","0"); showFPS.addOption("Instant","1"); showFPS.addOption("Average","2"); showFPS.addOption("Both","3"); table.addRow("Show FPS", showFPS); showServerFPS = glass.GlassCheckbox(); showServerFPS.linkCvar("cl_showfpsserver"); table.addRow("Show Server FPS",showServerFPS); showPing = glass.GlassCheckbox(); showPing.linkCvar("cl_showping"); table.addRow("Show Ping", showPing); showTeamStatus = glass.GlassCheckbox(); showTeamStatus.linkCvar("gui_showteamstatus"); table.addRow("Show Team Status",showTeamStatus); autoRecordDemos = glass.GlassCheckbox(); autoRecordDemos.linkCvar("cl_autoRecordDemo"); table.addRow("Auto-Record Demos",autoRecordDemos); showSquadMates = glass.GlassCheckbox(); showSquadMates.linkCvar("cl_show_squad"); table.addRow("Show Squad Mates",showSquadMates); #not sure if this is the right var #there's also cl_show_squad_comm cameraView = glass.GlassDropMenu(); cameraView.linkCvar("cl_cameraPosLerp"); cameraView.addOption("Smoothed","6"); cameraView.addOption("Snappy","9999"); table.addRow("Camera Snap",cameraView); cameraSmoothing = glass.GlassDropMenu(); cameraSmoothing.linkCvar("cl_cameraAngleLerp"); cameraSmoothing.addOption("Snap","9999"); cameraSmoothing.addOption("Quick","50"); cameraSmoothing.addOption("Smooth","35"); cameraSmoothing.addOption("Very Smooth","15"); cameraSmoothing.addOption("Demo Spectate","5"); #based on two things: XR GUI and that I like 15 myself :P #with that said, people like to tweak this var a lot, perhaps it ought to be a slider table.addRow("Camera Smoothing",cameraSmoothing); minimapAlpha = glass.GlassSlider(); minimapAlpha.linkCvar("cl_minimap_brightness"); table.addRow("Minimap Alpha", minimapAlpha); #TODO toggle third person camera when using a ranged weapon? #Crosshair colors here? #Commander Tweaks for the Options tableHolder = glass.GlassScrollArea(table); tableHolder.setSize(table.getWidth(), table.getHeight()); return tableHolder;