summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ausbutler/interface.py22
-rw-r--r--template/frame.html17
2 files changed, 38 insertions, 1 deletions
diff --git a/ausbutler/interface.py b/ausbutler/interface.py
index 4605f73..30c2f70 100644
--- a/ausbutler/interface.py
+++ b/ausbutler/interface.py
@@ -1,10 +1,11 @@
import re
+from os import path
from jinja2 import Environment, FileSystemLoader
from .butler import cutoff, get_opponents, get_room, normalize
from .db import get_session
from .model import AusButler, Butler
-from .tour_config import Translations
+from .tour_config import Translations, Constants
class Interface(object):
@@ -74,3 +75,22 @@ class Interface(object):
butler.corrected_score = normalize(
butler, self.config['opponent_factor'])
self.session.commit()
+
+ def generate_frames(self):
+ template = self.template.get_template('frame.html')
+ for round_no in range(1, Constants.rnd + 1):
+ for segment_no in range(1, Constants.segmentsperround + 1):
+ first_board = 1 + (segment_no - 1) * Constants.boardspersegment
+ filename = '%snormbutler%d-%d.htm' % (
+ Constants.shortname,
+ round_no, segment_no
+ )
+ file(path.join(Constants.path, filename), 'w').write(
+ template.render({
+ 'prefix': Constants.shortname,
+ 'round_no': round_no,
+ 'segment_no': segment_no,
+ 'first_board': first_board
+ })
+ )
+
diff --git a/template/frame.html b/template/frame.html
new file mode 100644
index 0000000..e1b7398
--- /dev/null
+++ b/template/frame.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
+<html>
+ <head>
+ <meta http-equiv="Pragma" content="no-cache">
+ <meta http-equiv="Cache-Control" content="no-cache">
+ <meta name="robots" content="noarchive">
+ <meta http-equiv="expires" content="0">
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta name="Generator" content="jfr-aus-butler">
+ <title>{{"PAGE_TITLE"|translate}}: {{"BUTLER"|translate}}, {{"ROUND"|translate}}{{round_no}}, {{"SEGMENT"|translate}}{{segment_no}}</title>
+ <link rel="stylesheet" type="text/css" href="css/kolorki.css">
+ </head>
+ <frameset cols="*,325" framespacing="0" border="0" frameborder="0">
+ <frame noresize name="polew" src="{{prefix}}normbutler{{round_no}}-{{segment_no}}.html">
+ <frame noresize name="popra" src="{{prefix}}{{round_no}}b-{{first_board}}.html">
+ </frameset>
+</html>