Add weekend coloration
This commit is contained in:
parent
7d45b45e8a
commit
273bcd3526
11
display.py
11
display.py
|
@ -57,13 +57,13 @@ class DisplayHTMLBlockTable(DisplayHTMLBlock):
|
||||||
super(DisplayHTMLBlockTable, self).__init__(title=title)
|
super(DisplayHTMLBlockTable, self).__init__(title=title)
|
||||||
self.cols = cols
|
self.cols = cols
|
||||||
self.rows = []
|
self.rows = []
|
||||||
self.cols_cssclasses = ['' for e in cols]
|
self.cols_cssclasses = [''] * len(cols)
|
||||||
self.rows_cssclasses = []
|
self.rows_cssclasses = []
|
||||||
self.table_css = 'iwla_table'
|
self.table_css = 'iwla_table'
|
||||||
|
|
||||||
def appendRow(self, row):
|
def appendRow(self, row):
|
||||||
self.rows.append(listToStr(row))
|
self.rows.append(listToStr(row))
|
||||||
self.rows_cssclasses.append(['' for e in row])
|
self.rows_cssclasses.append([''] * len(row))
|
||||||
|
|
||||||
def getCellValue(self, row, col):
|
def getCellValue(self, row, col):
|
||||||
if row < 0 or col < 0 or\
|
if row < 0 or col < 0 or\
|
||||||
|
@ -103,8 +103,7 @@ class DisplayHTMLBlockTable(DisplayHTMLBlock):
|
||||||
if row < 0 or row >= len(self.rows):
|
if row < 0 or row >= len(self.rows):
|
||||||
raise ValueError('Invalid indice %d' % (row))
|
raise ValueError('Invalid indice %d' % (row))
|
||||||
|
|
||||||
for i in range(0, self.rows_cssclasses[row]):
|
self.rows_cssclasses[row] = [value] * len(self.rows_cssclasses[row])
|
||||||
self.rows_cssclasses[row][i] = value
|
|
||||||
|
|
||||||
def setColCSSClass(self, col, value):
|
def setColCSSClass(self, col, value):
|
||||||
if col < 0 or col >= len(self.cols):
|
if col < 0 or col >= len(self.cols):
|
||||||
|
@ -155,7 +154,7 @@ class DisplayHTMLBlockTableWithGraph(DisplayHTMLBlockTable):
|
||||||
self.icon_path = 'resources/icon'
|
self.icon_path = 'resources/icon'
|
||||||
# self.icon_path = self.iwla.getConfValue('icon_path', '/')
|
# self.icon_path = self.iwla.getConfValue('icon_path', '/')
|
||||||
self.raw_rows = []
|
self.raw_rows = []
|
||||||
self.maxes = [0 for c in cols]
|
self.maxes = [0] * len(cols)
|
||||||
self.table_graph_css = 'iwla_graph_table'
|
self.table_graph_css = 'iwla_graph_table'
|
||||||
|
|
||||||
def appendRow(self, row):
|
def appendRow(self, row):
|
||||||
|
@ -213,7 +212,7 @@ class DisplayHTMLBlockTableWithGraph(DisplayHTMLBlockTable):
|
||||||
html += '</tr>'
|
html += '</tr>'
|
||||||
html += '<tr>'
|
html += '<tr>'
|
||||||
for i in range(0, len(self.short_titles)):
|
for i in range(0, len(self.short_titles)):
|
||||||
style = self.getCellCSSClass(0, j)
|
style = self.getCellCSSClass(i, 0)
|
||||||
if style: style = ' class="%s"' % (style)
|
if style: style = ' class="%s"' % (style)
|
||||||
html += '<td%s>%s</td>' % (style, self.short_titles[i])
|
html += '<td%s>%s</td>' % (style, self.short_titles[i])
|
||||||
html += '</tr>'
|
html += '</tr>'
|
||||||
|
|
4
iwla.py
4
iwla.py
|
@ -7,6 +7,7 @@ import pickle
|
||||||
import gzip
|
import gzip
|
||||||
import importlib
|
import importlib
|
||||||
from calendar import monthrange
|
from calendar import monthrange
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
import default_conf as conf
|
import default_conf as conf
|
||||||
import conf as _
|
import conf as _
|
||||||
|
@ -260,6 +261,9 @@ class IWLA(object):
|
||||||
days.setCellValue(i, 4, bytesToStr(row[4]))
|
days.setCellValue(i, 4, bytesToStr(row[4]))
|
||||||
days.setCellValue(i, 5, bytesToStr(row[5]))
|
days.setCellValue(i, 5, bytesToStr(row[5]))
|
||||||
days.appendShortTitle(cur_day)
|
days.appendShortTitle(cur_day)
|
||||||
|
week_day = date(cur_time.tm_year, cur_time.tm_mon, i+1).weekday()
|
||||||
|
if week_day == 5 or week_day == 6:
|
||||||
|
days.setRowCSSClass(i, 'iwla_weekend')
|
||||||
|
|
||||||
stats = self.current_analysis['month_stats']
|
stats = self.current_analysis['month_stats']
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ td:first-child
|
||||||
.iwla_hit { background : #66DDEE; }
|
.iwla_hit { background : #66DDEE; }
|
||||||
.iwla_bandwidth { background : #2EA495; }
|
.iwla_bandwidth { background : #2EA495; }
|
||||||
.iwla_search { background : #F4F090; }
|
.iwla_search { background : #F4F090; }
|
||||||
|
.iwla_weekend { background : #ECECEC; }
|
||||||
|
|
||||||
.iwla_graph_table
|
.iwla_graph_table
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user