]> git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Merge branch 'master' into badges
authorJan D. Behrens <zykure@web.de>
Sun, 16 Sep 2012 20:26:00 +0000 (22:26 +0200)
committerJan D. Behrens <zykure@web.de>
Sun, 16 Sep 2012 20:26:00 +0000 (22:26 +0200)
17 files changed:
.gitignore
development.ini
setup.py
xonstat/batch/badges/gen_badges.py
xonstat/crypto-keygen-standalone [new symlink]
xonstat/static/css/img/web_background_3.jpg [new file with mode: 0644]
xonstat/static/css/style.css
xonstat/static/images/icons/24x24/nb.png [new file with mode: 0644]
xonstat/static/images/icons/48x48/nb.png [new file with mode: 0644]
xonstat/static/images/icons/48x48/overall.png [new file with mode: 0644]
xonstat/static/js/bootstrap-tabs.js [new file with mode: 0644]
xonstat/templates/base.mako
xonstat/templates/nav.mako
xonstat/templates/navlinks.mako
xonstat/templates/player_info.mako
xonstat/templates/rank_index.mako
xonstat/util.py

index 8e48bc7692b8264bb196983b972be87bab001422..aa68c64a5008f1b10c4d0ce376f1a6b028a9e795 100644 (file)
@@ -1,5 +1,7 @@
-*.pyc
 *~
 *.bak
-xonstat/batch/badges/output/*.png
-xonstat/batch/badges/output/*/*.png
+*.tmp
+*.old
+*.pyc
+/xonstat/batch/badges/output/*.png
+/xonstat/batch/badges/output/*/*.png
index c3d1cf83f50a443f9ffc25209d2c372f447d1b2f..4ba4338e332186a69e0a28f7503cf4b2cc4e2bd4 100755 (executable)
@@ -6,7 +6,7 @@ debug_notfound = false
 debug_routematch = false
 debug_templates = true
 default_locale_name = en
-sqlalchemy.url = postgresql+psycopg2://xonstat:xonstat@localhost:5433/xonstatdb
+sqlalchemy.url = postgresql+psycopg2://xonstat:xonstat@localhost:5432/xonstatdb
 session.type = file
 session.data_dir = %(here)s/data/sessions/data
 session.lock_dir = %(here)s/data/sessions/lock
index ab818f2065892c348b51f5f4c33fba46debd9734..38572a23635c029674d2756496351e4627d337c8 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ import sys
 from setuptools import setup, find_packages
 
 here = os.path.abspath(os.path.dirname(__file__))
-README = open(os.path.join(here, 'README.txt')).read()
+README = open(os.path.join(here, 'README.md')).read()
 CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
 
 requires = [
index 1d3acf1a02c1ac49ba69a73f69129a420560aa0d..44d73aec3da4f1ea2a16690cf9e965c954777b33 100644 (file)
@@ -7,6 +7,7 @@ import sqlalchemy.sql.functions as func
 from sqlalchemy import distinct
 from pyramid.paster import bootstrap
 from xonstat.models import *
+from xonstat.util import datetime_seconds
 
 from skin import Skin
 from playerdata import PlayerData
@@ -113,7 +114,6 @@ for arg in sys.argv[1:]:
 if len(skins) == 0:
     skins = [ skin_classic, skin_minimal ]
 
-
 # environment setup
 env = bootstrap('../../../development.ini')
 req = env['request']
@@ -147,8 +147,7 @@ playerdata = PlayerData()
 if len(players) > 0:
     stop = datetime.now()
     td = stop-start
-    total_seconds = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
-    print "Query took %.2f seconds" % (total_seconds)
+    print "Query took %.2f seconds" % (datetime_seconds(td))
 
     print "Creating badges for %d players ..." % len(players)
     start = datetime.now()
@@ -160,20 +159,18 @@ if len(players) > 0:
         playerdata.get_data(player_id)
         sstop = datetime.now()
         td = sstop-sstart
-        total_seconds = float(td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
-        data_time += total_seconds
+        data_time += datetime_seconds(td)
 
         sstart = datetime.now()
         for sk in skins:
             sk.render_image(playerdata, "output/%s/%d.png" % (str(sk), player_id[0]))
         sstop = datetime.now()
         td = sstop-sstart
-        total_seconds = float(td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
-        render_time += total_seconds
+        render_time += datetime_seconds(td)
 
     stop = datetime.now()
     td = stop-start
-    total_seconds = float(td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
+    total_seconds = datetime_seconds(td)
     print "Creating the badges took %.1f seconds (%.3f s per player)" % (total_seconds, total_seconds/float(len(players)))
     print "Total time for rendering images: %.3f s" % render_time
     print "Total time for getting data: %.3f s" % data_time
diff --git a/xonstat/crypto-keygen-standalone b/xonstat/crypto-keygen-standalone
new file mode 120000 (symlink)
index 0000000..32f91eb
--- /dev/null
@@ -0,0 +1 @@
+/usr/local/games/Xonotic/misc/infrastructure/keygen/crypto-keygen-standalone
\ No newline at end of file
diff --git a/xonstat/static/css/img/web_background_3.jpg b/xonstat/static/css/img/web_background_3.jpg
new file mode 100644 (file)
index 0000000..a73edb0
Binary files /dev/null and b/xonstat/static/css/img/web_background_3.jpg differ
index d87b5bf5b43d0309645839d5bb4b0462706dde4f..a24f6a004c2475fe661a6306886a15a4617fd5c7 100755 (executable)
@@ -106,9 +106,12 @@ textarea {
   vertical-align: top;
 }
 body {
+  background: url('img/web_background_3.jpg') no-repeat center center fixed;
   background-color: #000000;
-  background:#000 url('img/web_background_2.jpg') 0 0 no-repeat;
-  background-size: 100%;
+  -webkit-background-size: cover; /*for webKit*/
+  -moz-background-size: cover; /*Mozilla*/
+  -o-background-size: cover; /*opera*/
+  background-size: cover; /*generic*/
   color: #d0d0d0;
   font-family: "XoloniumNormal", "Helvetica Neue", Helvetica, Arial, sans-serif;
   font-size: 11px;
@@ -3388,6 +3391,12 @@ a.thumbnail:hover {
 .invisible {
   visibility: hidden;
 }
+
+/* Custom Stuff */
+table {
+  background: rgb(0, 0, 0); /* IE Fallback */
+  background: none repeat scroll 0 0 rgba(0, 0, 0, 0.7);
+}
 #statline {
   font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
   font-size: 12px;
@@ -3396,15 +3405,14 @@ a.thumbnail:hover {
 }
 #xonborder {
   background: rgb(0, 0, 0); /* IE Fallback */
-  background: none repeat scroll 0 0 rgba(0, 0, 0, 0.4);
-  border-radius: 6px 6px 6px 6px;
+  background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5);
+  border-radius: 15px 15px 15px 15px;
   margin-bottom: 30px;
   padding: 20px;
 }
 #title {
     color: #0088CC;
     font-size: 30px;
-    font-style: italic;
     margin-bottom: 25px;
     position: relative;
     text-align: center;
diff --git a/xonstat/static/images/icons/24x24/nb.png b/xonstat/static/images/icons/24x24/nb.png
new file mode 100644 (file)
index 0000000..e663d35
Binary files /dev/null and b/xonstat/static/images/icons/24x24/nb.png differ
diff --git a/xonstat/static/images/icons/48x48/nb.png b/xonstat/static/images/icons/48x48/nb.png
new file mode 100644 (file)
index 0000000..5ebe4df
Binary files /dev/null and b/xonstat/static/images/icons/48x48/nb.png differ
diff --git a/xonstat/static/images/icons/48x48/overall.png b/xonstat/static/images/icons/48x48/overall.png
new file mode 100644 (file)
index 0000000..5a2b5e9
Binary files /dev/null and b/xonstat/static/images/icons/48x48/overall.png differ
diff --git a/xonstat/static/js/bootstrap-tabs.js b/xonstat/static/js/bootstrap-tabs.js
new file mode 100644 (file)
index 0000000..a3c7ee1
--- /dev/null
@@ -0,0 +1,80 @@
+/* ========================================================
+ * bootstrap-tabs.js v1.4.0
+ * http://twitter.github.com/bootstrap/javascript.html#tabs
+ * ========================================================
+ * Copyright 2011 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ======================================================== */
+
+
+!function( $ ){
+
+  "use strict"
+
+  function activate ( element, container ) {
+    container
+      .find('> .active')
+      .removeClass('active')
+      .find('> .dropdown-menu > .active')
+      .removeClass('active')
+
+    element.addClass('active')
+
+    if ( element.parent('.dropdown-menu') ) {
+      element.closest('li.dropdown').addClass('active')
+    }
+  }
+
+  function tab( e ) {
+    var $this = $(this)
+      , $ul = $this.closest('ul:not(.dropdown-menu)')
+      , href = $this.attr('href')
+      , previous
+      , $href
+
+    if ( /^#\w+/.test(href) ) {
+      e.preventDefault()
+
+      if ( $this.parent('li').hasClass('active') ) {
+        return
+      }
+
+      previous = $ul.find('.active a').last()[0]
+      $href = $(href)
+
+      activate($this.parent('li'), $ul)
+      activate($href, $href.parent())
+
+      $this.trigger({
+        type: 'change'
+      , relatedTarget: previous
+      })
+    }
+  }
+
+
+ /* TABS/PILLS PLUGIN DEFINITION
+  * ============================ */
+
+  $.fn.tabs = $.fn.pills = function ( selector ) {
+    return this.each(function () {
+      $(this).delegate(selector || '.tabs li > a, .pills > li > a', 'click', tab)
+    })
+  }
+
+  $(document).ready(function () {
+    $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a')
+  })
+
+}( window.jQuery || window.ender );
index 3d6af2dc01da957f4c0e2e10f4465ea2ca49bd4a..c935dc6563011b5f250928319c479f69c3ceb735 100644 (file)
       <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
     <![endif]-->
 
-    <style type="text/css">
-      body {
-        padding-top: 60px;
-        padding-bottom: 40px;
-      }
-    </style>
-
     <%block name="css">
     <!-- <link href="/static/css/style.min.css" rel="stylesheet"> -->
     <link href="/static/css/style.css" rel="stylesheet">
     <link type="images/vnd.microsoft.icon" rel="shortcut icon" href="/static/favicon.ico">
     </%block>
+    
+    <script src="/static/js/jquery-1.7.1.min.js"></script>
   </head>
 
   <body>
@@ -37,7 +32,7 @@
 
       <div class="row">
         <div class="span12" id="xonborder">
-          <div id="title"><%block name="title"></%block>&nbsp;</div>
+          <div id="title"><%block name="title"></%block></div>
             ${self.body()}
         </div> <!-- /xonborder -->
       </div> <!-- /main row -->
index 57eab80b025cdfd9f7da1abdae7f2490fab98661..568ddae8efbde724c0bb75d629ce5e85788b2f33 100644 (file)
@@ -1,5 +1,5 @@
 <%def name="nav(active)">
-    <div class="navbar navbar-fixed-top">
+    <div class="navbar navbar-top">
       <div class="navbar-inner">
         <div class="container">
           <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
index 5c1fa4fae06a36f1a8f2d54667bc3f6b5ce2229d..4f9aa837e18db3ced656bab62b08d11d29ed8e8e 100644 (file)
@@ -6,6 +6,10 @@ if 'search_query' in kwargs.keys():
     kwargs['_query'] = dict(kwargs['_query'].items() + kwargs['search_query'].items())
 %>
 
+% if not last:
+    <% last = 1 %>
+% endif
+
 % if not (curr == last and curr == 1):
     % if curr != 1:
             <% kwargs['_query']['page'] = curr-1 %>
index 3149228e486c7b5c168efd5d4f43486818ba715f..4b9485838f39bb985e5e6f6748ebe49f58e07ee5 100644 (file)
@@ -77,9 +77,11 @@ ${nav.nav('players')}
           }
 
           var previousPoint = null;
+          var previousLabel = null;
           $('#acc-graph').bind("plothover", function (event, pos, item) {
               if (item) {
-                  if (previousPoint != item.dataIndex) {
+                if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
+                    previousLabel = item.series.label;
                     previousPoint = item.dataIndex;
 
                     $("#tooltip").remove();
@@ -92,13 +94,15 @@ ${nav.nav('players')}
               else {
                   $("#tooltip").remove();
                   previousPoint = null;
+                  previousLabel = null;
               }
           });
 
           $('#dmg-graph').bind("plothover", function (event, pos, item) {
               if (item) {
-                  if (previousPoint != item.dataIndex) {
+                if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
                     previousPoint = item.dataIndex;
+                    previousLabel = item.series.label;
 
                     $("#tooltip").remove();
                     var x = item.datapoint[0].toFixed(2),
@@ -110,6 +114,7 @@ ${nav.nav('players')}
               else {
                   $("#tooltip").remove();
                   previousPoint = null;
+                  previousLabel = null;
               }
           });
 
index 47a2d065630b82e789ab08dcc05beb5b84c9649c..2a72a9483044d7a2629a14b277e9527807e69e36 100644 (file)
@@ -2,25 +2,21 @@
 <%namespace file="navlinks.mako" import="navlinks" />
 
 <%block name="title">
-Rank Index - ${parent.title()}
-</%block>
-
-% if not ranks:
-<h2>Sorry, no ranks yet. Get some buddies together and start playing!</h2>
-
-% else:
-<h2>
 % if game_type_cd == 'dm':
-Deathmatch 
+Deathmatch Rank Index
 % elif game_type_cd == 'duel':
-Duel 
+Duel Rank Index
 % elif game_type_cd == 'tdm':
-Team Deathmatch 
+Team Deathmatch Rank Index
 % elif game_type_cd == 'ctf':
-Capture The Flag 
+Capture The Flag Rank Index
 % endif
+</%block>
 
-Rank Index</h2>
+% if not ranks:
+<h2>Sorry, no ranks yet. Get some buddies together and start playing!</h2>
+
+% else:
 <table id="rank-index-table" border="1">
   <tr>
     <th>Rank</th>
index f9aa1d5c07f96135f47cfdc71d2972bb3b693ec1..7c2692d45d51651605b2e78ba9ff98929fd7fd50 100644 (file)
@@ -151,3 +151,7 @@ def pretty_date(time=False):
         return "almost 2 years ago"
     else:
         return "about {0} years ago".format(int(round(dim/525600.0)))
+
+def datetime_seconds(td):
+    return float(td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
+