Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Commit

Permalink
Fix bugs with the video slider.
Browse files Browse the repository at this point in the history
The slider now retains the resolution when the state of the "windowed"
checkbox is changed as long as the previously selected resolution is
compatible with the selected window state.
  • Loading branch information
Hoikas committed Sep 22, 2011
1 parent c8766bf commit 934adb6
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Python/xOptionsMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,7 @@ def OnGUINotify(self,id,control,event):
control.setValue(int(curVal))

elif tagID == kVideoWindowedCheckTag:
videoField = ptGUIControlKnob(GraphicsSettingsDlg.dialog.getControlFromTag(kVideoResSliderTag))
if not control.isChecked():
ptGUIControlKnob(GraphicsSettingsDlg.dialog.getControlFromTag(kVideoResSliderTag)).enable()
respDisableItems.run(self.key, state="enableRes")
Expand All @@ -1269,11 +1270,13 @@ def OnGUINotify(self,id,control,event):
respDisableItems.run(self.key, state="disableGamma")
ptGUIControlKnob(GraphicsSettingsDlg.dialog.getControlFromTag(kGSDisplayGammaSlider)).disable()
ptGUIControlTextBox(GraphicsSettingsDlg.dialog.getControlFromTag(kGSDispGamaText)).setForeColor(ptColor(0.839, 0.785, 0.695, 1))

vidResList = self.GetVideoResList()
vidRes = ptGUIControlTextBox(GraphicsSettingsDlg.dialog.getControlFromTag(kVideoResTextTag))
if not vidRes.getString() in vidResList:
if not self.GetVidResField() in vidResList:
vidRes.setString("800x600 [4:3]")
videoField = ptGUIControlKnob(GraphicsSettingsDlg.dialog.getControlFromTag(kVideoResSliderTag))
videoField.setValue(0.0)

numRes = len(vidResList)
if numRes == 1:
videoField.setValue(0)
Expand All @@ -1285,7 +1288,7 @@ def OnGUINotify(self,id,control,event):
else:
for res in range(numRes):
if vidRes.getString() == vidResList[res]:
videoField.setValue( float(res) / (numRes - 1))
videoField.setValue( float(res) / float(numRes))
break

elif tagID == kVideoAntiAliasingSliderTag or tagID == kVideoFilteringSliderTag:
Expand Down Expand Up @@ -1624,6 +1627,11 @@ def InitVideoControlsGUI(self):
else:
gammaField.setValue( float(GammaVal) )

def GetVidResField(self):
videoResField = ptGUIControlTextBox(GraphicsSettingsDlg.dialog.getControlFromTag(kVideoResTextTag))
value = videoResField.getString().split(' ')
return value[0]

def SetVidResField(self, value):
videoResField = ptGUIControlTextBox(GraphicsSettingsDlg.dialog.getControlFromTag(kVideoResTextTag))
for i in kVideoResolutions.keys():
Expand Down

0 comments on commit 934adb6

Please sign in to comment.