diff --git a/display.py b/display.py index 646d049..ab9e582 100644 --- a/display.py +++ b/display.py @@ -57,13 +57,13 @@ class DisplayHTMLBlockTable(DisplayHTMLBlock): super(DisplayHTMLBlockTable, self).__init__(title=title) self.cols = cols self.rows = [] - self.cols_cssclasses = ['' for e in cols] + self.cols_cssclasses = [''] * len(cols) self.rows_cssclasses = [] self.table_css = 'iwla_table' def appendRow(self, 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): if row < 0 or col < 0 or\ @@ -103,8 +103,7 @@ class DisplayHTMLBlockTable(DisplayHTMLBlock): if row < 0 or row >= len(self.rows): raise ValueError('Invalid indice %d' % (row)) - for i in range(0, self.rows_cssclasses[row]): - self.rows_cssclasses[row][i] = value + self.rows_cssclasses[row] = [value] * len(self.rows_cssclasses[row]) def setColCSSClass(self, col, value): if col < 0 or col >= len(self.cols): @@ -155,7 +154,7 @@ class DisplayHTMLBlockTableWithGraph(DisplayHTMLBlockTable): self.icon_path = 'resources/icon' # self.icon_path = self.iwla.getConfValue('icon_path', '/') self.raw_rows = [] - self.maxes = [0 for c in cols] + self.maxes = [0] * len(cols) self.table_graph_css = 'iwla_graph_table' def appendRow(self, row): @@ -213,7 +212,7 @@ class DisplayHTMLBlockTableWithGraph(DisplayHTMLBlockTable): html += '' html += '' 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) html += '%s' % (style, self.short_titles[i]) html += '' diff --git a/iwla.py b/iwla.py index 6192312..16b3b08 100755 --- a/iwla.py +++ b/iwla.py @@ -7,6 +7,7 @@ import pickle import gzip import importlib from calendar import monthrange +from datetime import date import default_conf as conf import conf as _ @@ -260,6 +261,9 @@ class IWLA(object): days.setCellValue(i, 4, bytesToStr(row[4])) days.setCellValue(i, 5, bytesToStr(row[5])) 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'] diff --git a/resources/css/iwla.css b/resources/css/iwla.css index a694c21..a1be30c 100644 --- a/resources/css/iwla.css +++ b/resources/css/iwla.css @@ -61,6 +61,7 @@ td:first-child .iwla_hit { background : #66DDEE; } .iwla_bandwidth { background : #2EA495; } .iwla_search { background : #F4F090; } +.iwla_weekend { background : #ECECEC; } .iwla_graph_table {