| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <rml>
- <head>
- <title>Options</title>
- <link type="text/template" href="window.rml" />
- <style>
- body
- {
- width: 350px;
- height: 350px;
-
- margin: auto;
- }
- div#title_bar div#icon
- {
- icon-image-s: 230px 281px;
- icon-image-t: 152px 191px;
- display: none;
- }
- form div
- {
- width: 200px;
- margin: auto;
- }
- </style>
- <script>
- import cPickle
- def LoadOptions(document):
- try:
- f = open('options.dat', 'rt')
- options = cPickle.loads("".join(f.readlines()))
-
- document.GetElementById(options['graphics']).checked = True
- document.GetElementById('reverb').checked = options['reverb']
- document.GetElementById('3d').checked = options['3d']
-
- except IOError:
- pass
-
- def SaveOptions(event, document):
- try:
- if event.parameters['button'] == 'cancel':
- return
-
- options = {}
- options['graphics'] = event.parameters['graphics']
- options['reverb'] = 'reverb' in event.parameters
- options['3d'] = '3d' in event.parameters
-
- f = open('options.dat', 'wt')
- f.write(cPickle.dumps(options))
- f.close()
- except IOError:
- pass
-
- def DisplayBadGraphics(document, display):
- if display:
- document.GetElementById('bad_warning').style.display = 'block'
- else:
- document.GetElementById('bad_warning').style.display = 'none'
- </script>
- </head>
- <body template="pywindow" onload="OnWindowLoad(self); LoadOptions(document)">
- <form onsubmit="SaveOptions(event, document); LoadMenu('main_menu')">
- <div>
- <p>
- Graphics:<br />
- <input id="good" type="radio" name="graphics" value="good"/> Good<br />
- <input id="ok" type="radio" name="graphics" value="ok" checked="true"/> OK<br />
- <input id="bad" type="radio" name="graphics" value="bad" onchange="DisplayBadGraphics(document, self.checked)" /> Bad<br />
- </p>
- <p id="bad_warning" style="display: none;">Are you sure about this? Bad graphics are just plain <em>bad.</em></p>
- <p>
- Audio:<br />
- <input id="reverb" type="checkbox" name="reverb" value="true" checked="true" /> Reverb<br />
- <input id="3d" type="checkbox" name="3d" value="true" /> 3D Spatialisation
- </p>
- </div>
- <input type="submit" name="button" value="accept">Accept</input>
- <input type="submit" name="button" value="cancel">Cancel</input>
- </form>
- </body>
- </rml>
|