summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jfr_playoff/filemanager.py30
-rw-r--r--jfr_playoff/template.py5
-rw-r--r--playoff.css16
-rw-r--r--playoff.py1
4 files changed, 38 insertions, 14 deletions
diff --git a/jfr_playoff/filemanager.py b/jfr_playoff/filemanager.py
index 515845e..990b9f2 100644
--- a/jfr_playoff/filemanager.py
+++ b/jfr_playoff/filemanager.py
@@ -50,23 +50,29 @@ class PlayoffFileManager(object):
self.register_file(self.output_file)
return self.output_file
- def copy_scripts(self, script_path='sklady/playoff.js'):
- script_output_path = os.path.join(self.output_path, script_path)
- script_output_dir = os.path.dirname(script_output_path)
- if len(script_output_dir) > 0:
- if not os.path.exists(script_output_dir):
+ def copy_file(self, filename, path):
+ output_path = os.path.join(self.output_path, path)
+ output_dir = os.path.dirname(output_path)
+ if len(output_dir) > 0:
+ if not os.path.exists(output_dir):
PlayoffLogger.get('filemanager').info(
'output directory %s does not exist, creating',
- script_output_dir)
- os.makedirs(script_output_dir)
+ output_dir)
+ os.makedirs(output_dir)
PlayoffLogger.get('filemanager').info(
- 'copying JS to %s', script_output_path)
+ 'copying file to %s', output_path)
shutil.copy(
unicode(os.path.join(
- os.path.dirname(__main__.__file__), 'playoff.js')),
- unicode(script_output_path))
- self.register_file(script_output_path)
- return script_output_path
+ os.path.dirname(__main__.__file__), filename)),
+ unicode(output_path))
+ self.register_file(output_path)
+ return output_path
+
+ def copy_scripts(self, script_path='sklady/playoff.js'):
+ return self.copy_file('playoff.js', script_path)
+
+ def copy_styles(self, sheet_path='css/playoff.css'):
+ return self.copy_file('playoff.css', sheet_path)
def send_files(self):
if (self.goniec is not None) and self.goniec['enabled']:
diff --git a/jfr_playoff/template.py b/jfr_playoff/template.py
index c6995e3..a76ebcd 100644
--- a/jfr_playoff/template.py
+++ b/jfr_playoff/template.py
@@ -124,7 +124,7 @@ class PlayoffTemplateStrings(object):
'''
LEADERBOARD = '''
- <table border="0" cellspacing="0">
+ <table class="leaderboard" border="0" cellspacing="0">
<tr>
<td class="bdnl12" colspan="2" align="center" style="text-transform: uppercase"><b>&nbsp;{{FINAL_STANDINGS}}&nbsp;</b></td>
</tr>
@@ -178,6 +178,7 @@ class PlayoffTemplateStrings(object):
%s
<title>%s</title>
<link rel="stylesheet" type="text/css" href="css/kolorki.css" />
+ <link rel="stylesheet" type="text/css" href="css/playoff.css" />
<script type="text/javascript" src="sklady/myAjax.js"></script>
'''
@@ -189,7 +190,7 @@ class PlayoffTemplateStrings(object):
<script type="text/javascript" src="sklady/wz_tooltip.js"></script>
%s
%s
- <p>
+ <p class="swiss_links">
%s
</p>
%s
diff --git a/playoff.css b/playoff.css
new file mode 100644
index 0000000..30fd68b
--- /dev/null
+++ b/playoff.css
@@ -0,0 +1,16 @@
+tr.winner > td {
+ background: #dfd;
+}
+tr.loser > td {
+ background: #fee;
+}
+
+.team-predicted-label {
+ opacity: 0.3
+}
+
+@media print {
+ span#logo, p.swiss_links, table.leaderboard, table.caption_table, body>p.f {
+ display: none;
+ }
+}
diff --git a/playoff.py b/playoff.py
index ac84c66..4e4d197 100644
--- a/playoff.py
+++ b/playoff.py
@@ -41,6 +41,7 @@ def main():
file_manager = PlayoffFileManager(settings)
file_manager.write_content(content)
file_manager.copy_scripts()
+ file_manager.copy_styles()
file_manager.send_files()
except SystemExit:
interactive = False