1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
|
<html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>Settings - The Bub's Brothers</title></head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#000099" alink="#FF0000">
%(
def nameval(type, name, value=None, default=None, mangling=1, options=options):
if mangling:
name = mode.unique_id() + '_' + name
s = getattr(options, name) or default
checked = s == value
if type == 'option':
return 'option %svalue="%s"' % (checked and 'selected ' or '', value)
elif type == 'select':
return 'select name="%s"' % name
elif type == 'text':
return 'input type=text name="%s" value="%s"' % (
name, htmlquote(s))
else:
return 'input type=%s %sname="%s" value="%s"' % (
type, checked and 'checked ' or '', name, value)
def begingroup(text, fgcolor, bgcolor, lightbgcolor, img, nbitems):
global groupinfo
print '<tr>'
print '<td width="20%"',
print 'rowspan="%d" bgcolor="%s" align="center">' % (nbitems or 1, bgcolor)
print '<font size=+1 color="%s"><strong>%s</strong></font>' % (fgcolor, text)
print '</td>'
groupinfo = [lightbgcolor, bgcolor, fgcolor, 0, 0, img]
if not nbitems:
begingroupitem()
endgroupitem()
def begingroupitem(highlight=0):
if groupinfo[4]:
print '<tr>'
groupinfo[4] += 1
groupinfo[3] = highlight
print '<td width="80%%" bgcolor="%s">' % groupinfo[highlight]
print '<table width="100%" border=0><tr>'
def endgroupitem():
print '<td width=40 align="right" valign="top">'
if groupinfo[3]:
print '<img src="%s">' % groupinfo[-1]
print '</td></tr></table>'
print '</td></tr>'
def endgroup():
pass
def beginmode():
highlight = mode in currentmodes
begingroupitem(highlight)
print '<td width=36 align="right" valign="center">'
err = mode.imperror()
if highlight:
url = None
err = err or "selected"
print '<img alt="selected" src="checked.png">'
elif err:
url = None
print '<img alt="%s" src="disabled.png">' % err
else:
url = "options.html?%s=%s&savetime=%s" % (mode.prefix, mode.name,
time.time())
err = "select"
print '<a href="%s"><img alt="select" src="unchecked.png"></a>' % url
print '</td>'
print '<td width="20%" valign="center">'
if url: print '<a href="%s">' % url,
print htmlquote(err),
if url: print '</a>',
print '</td>'
print '<td width="80%"><font size=+1><strong>',
print htmlquote(mode.name),
print '</strong></font>'
if mode.url:
print ' - <a href="%s"><i>web site</i></a>' % mode.url
print '<br>'
print htmlquote(mode.descr)
return highlight
def beginmodeoptions():
print '<br>'
print '<table border=0><tr><td>'
def endmodeoptions():
print '</td><td align="center" valign="bottom">'
print '<input type=submit value=" Save ">'
print '</td></tr></table>'
def endmode():
print '</td>'
endgroupitem()
def modeitems(modelist):
global mode
for mode in modelist:
if beginmode():
txt = mode.htmloptionstext(nameval)
if txt:
beginmodeoptions()
print txt
endmodeoptions()
endmode()
)s
<center><table CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH="95%%">
<tr>
<td width="6%%" bgcolor="#000000"> </td>
<td bgcolor="#000000"> </td>
<td width="6%%" bgcolor="#000000"> </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td bgcolor="#000000"> </td>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td bgcolor="#E0E0D0"> </td>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td bgcolor="#D0D0D0"> </td>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td bgcolor="#C0C0C0" align="center"><font size=+3><strong>Settings</strong></font></td>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td bgcolor="#D0D0D0"> </td>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td bgcolor="#E0E0D0"> </td>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td bgcolor="#E0E0D0" align="right">
<a href="http://bub-n-bros.sourceforge.net/help.html">Technical documentation</a> -
<a href="index.html?time=%(time.time())s">Back to the main page</a>
</td>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td bgcolor="#E0E0D0"> </td>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td bgcolor="#E0E0D0">
<form name="options" action="options.html" method="get">
<input type=hidden name="savetime" value="%(time.time())s">
<table border=0 cellspacing=4>
%(
graphicmodes = self.graphicmodeslist()
currentmodes = self.localmodes()
begingroup('Display driver', '#800000', '#FFC000', '#C0C0C0',
'lbeb.png', len(graphicmodes))
modeitems(graphicmodes)
endgroup()
)s
<tr><td> </td><td> </td></tr>
%(
soundmodes = self.soundmodeslist()
java = graphicmodes[0] in currentmodes
begingroup('Sound driver', '#800000', '#FFFF00', '#C0C0C0',
'lbiob.png', java and 1 or len(soundmodes))
if java:
begingroupitem(1)
print '<td><font size=-1>Java Applet always does sounds, but',
print 'background music is not implemented</font></td>'
endgroupitem()
else:
modeitems(soundmodes)
endgroup()
)s
<tr><td> </td><td> </td></tr>
%(
begingroup('Network options', '#004000', '#80FF00', None, 'lbib.png', 1)
begingroupitem(1)
)s
<td>
<table border=0><tr>
<td>
<p>Network ports are automatically assigned, but you can optionally choose fixed
ones and let them in through your firewall. <font size=-1>Clients using the
"Internet games" meta-server can usually connect even through firewalls.
Moreover servers can re-route UDP traffic to clients behind firewalls over TCP.
%(
if java:
print "These settings don't apply to the Java applet."
)s </font></p>
<p>TCP game server port: <%(nameval("text", "port_LISTEN", default="", mangling=0))s><br>
HTTP server port: <%(nameval("text", "port_HTTP", default="", mangling=0))s></p>
<p>Client incoming UDP port (or <code>host:port</code> if redirected): <%(nameval("text", "port_CLIENT", default="", mangling=0))s><br>
<%(nameval("radio", "datachannel", "ucp", mangling=0))s>always UDP</input>
<%(nameval("radio", "datachannel", "tcp", mangling=0))s>no UDP, only TCP</input>
<%(nameval("radio", "datachannel", "auto", default="auto", mangling=0))s>Auto-detect</input><br>
Client incoming TCP port (metaserver-directed back-connections): <%(nameval("text", "port_BACK", default="", mangling=0))s></p>
</td>
<td width=12></td>
<td align="center" valign="bottom">
<a href="http://bub-n-bros.sourceforge.net/help.html#port">Help!</a><br><br>
<input type=submit value=" Save ">
</td>
</tr></table>
</td>
%(
endgroupitem()
endgroup()
)s
</table>
</form>
</td>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td bgcolor="#E0E0D0"> </td>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td bgcolor="#E0E0D0" align="right">
<form name="reset" action="options.html" method="get">
<input type=hidden name="time" value="%(time.time())s">
<input type=submit name="reset" value=" Restore all defaults ">
</form>
</td>
<td bgcolor="#000000"> </td>
</tr>
<tr>
<td bgcolor="#000000"> </td>
<td bgcolor="#000000"> </td>
<td bgcolor="#000000"> </td>
</tr>
</table></center>
</body>
</html>
|