mirror of https://github.com/dirtbags/moth.git
Gussy up the scoreboard
This commit is contained in:
parent
e1a43cb9a7
commit
0a07f40ff4
|
@ -18,10 +18,9 @@ fn = 'scores.hist'
|
||||||
scoresfile = open(fn, 'w')
|
scoresfile = open(fn, 'w')
|
||||||
i = 2
|
i = 2
|
||||||
for team in teams:
|
for team in teams:
|
||||||
plotparts.append('"%s" using 1:%d with lines linetype rgb "#%s"' % (fn, i, teamcolors[team]))
|
plotparts.append('"%s" using 1:%d with lines linewidth 2 linetype rgb "#%s"' % (fn, i, teamcolors[team]))
|
||||||
scores[team] = 0
|
scores[team] = 0
|
||||||
i += 1
|
i += 1
|
||||||
print(plotparts)
|
|
||||||
|
|
||||||
def write_scores(t):
|
def write_scores(t):
|
||||||
scoresfile.write('%d' % t)
|
scoresfile.write('%d' % t)
|
||||||
|
@ -51,7 +50,7 @@ gp.write('set border 3\n')
|
||||||
gp.write('set xtics nomirror\n')
|
gp.write('set xtics nomirror\n')
|
||||||
gp.write('set ytics nomirror\n')
|
gp.write('set ytics nomirror\n')
|
||||||
gp.write('set nokey\n')
|
gp.write('set nokey\n')
|
||||||
gp.write('set terminal png transparent x000000 xffffff\n')
|
gp.write('set terminal png transparent size 640,200 x000000 xffffff\n')
|
||||||
gp.write('set output "histogram.png"\n')
|
gp.write('set output "histogram.png"\n')
|
||||||
gp.write('plot %s\n' % ','.join(plotparts))
|
gp.write('plot %s\n' % ','.join(plotparts))
|
||||||
gp.flush()
|
gp.flush()
|
||||||
|
|
|
@ -3,19 +3,16 @@
|
||||||
import cgitb; cgitb.enable()
|
import cgitb; cgitb.enable()
|
||||||
import points
|
import points
|
||||||
|
|
||||||
print('Content-type: text/html')
|
|
||||||
print()
|
|
||||||
|
|
||||||
|
|
||||||
s = points.Storage('scores.dat')
|
s = points.Storage('scores.dat')
|
||||||
|
|
||||||
rows = 20
|
|
||||||
|
|
||||||
teams = s.teams()
|
teams = s.teams()
|
||||||
categories = [(cat, s.cat_points(cat)) for cat in s.categories()]
|
categories = [(cat, s.cat_points(cat)) for cat in s.categories()]
|
||||||
teamcolors = points.colors(teams)
|
teamcolors = points.colors(teams)
|
||||||
|
|
||||||
print('''<?xml version="1.0" encoding="UTF-8"?>
|
print('Content-type: text/html')
|
||||||
|
print()
|
||||||
|
|
||||||
|
print('''<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
@ -44,6 +41,10 @@ for cat, total in categories:
|
||||||
print('</tr>')
|
print('</tr>')
|
||||||
print('''</table>
|
print('''</table>
|
||||||
|
|
||||||
<img src="histogram.png" />
|
<img src="histogram.png" alt=""/>
|
||||||
</body>
|
</body>
|
||||||
</html>''')
|
</html>''')
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: python
|
||||||
|
# End:
|
||||||
|
|
Loading…
Reference in New Issue