iwla

iwla Commit Details

Date:2014-12-01 21:45:26 (6 years 8 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:2846394dad766a59505e922868ba0c774b7ba53f
Parents: 5d6362105b0b520fba1f792a3066d563bd127bb7
Message:Introduce _buildHTML() and DisplayHTMLBlockTableWithGraph class in display.py

Changes:
Mdisplay.py (3 diffs)

File differences

display.py
88
99
1010
11
12
13
1114
1215
13
16
1417
15
18
19
1620
1721
1822
......
3842
3943
4044
41
45
4246
4347
4448
4549
4650
4751
48
52
4953
5054
5155
......
113117
114118
115119
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
140154
141155
142156
def setRawHTML(self, html):
self.html = html
def _buildHTML(self):
pass
def _build(self, f, html):
if html: f.write(html)
def build(self, f):
self._build(self.html)
self._buildHTML()
self._build(f, self.html)
class DisplayHTMLBlock(DisplayHTMLRaw):
def setValueCSSClass(self, cssclass):
self.value_cssclass = cssclass
def build(self, f):
def _buildHTML(self):
html = '<div class="%s">' % (self.cssclass)
if self.title:
html += '<div class="%s">%s</div>' % (self.title_cssclass, self.title)
html += '<div class="%s">%s</div>' % (self.value_cssclass, self.html)
html += '</div>'
self._build(f, html)
self.html = html
class DisplayHTMLBlockTable(DisplayHTMLBlock):
self.cols_cssclasses = values
def build(self, f):
if not self.html:
html = '<table>'
if self.cols:
html += '<tr>'
for i in range (0, len(self.cols)):
title = self.cols[i]
style = self.getColCSSClass(i)
if style: style = ' class="%s"' % (style)
html += '<th%s>%s</th>' % (style, title)
html += '</tr>'
for i in range(0, len(self.rows)):
row = self.rows[i]
html += '<tr>'
for j in range(0, len(row)):
v = row[j]
style = self.getCellCSSClass(i, j)
if style: style = ' class="%s"' % (style)
html += '<td%s>%s</td>' % (style, v)
html += '</tr>'
html += '</table>'
self.html = html
super(DisplayHTMLBlockTable, self).build(f)
def _buildHTML(self):
html = '<table>'
if self.cols:
html += '<tr>'
for i in range (0, len(self.cols)):
title = self.cols[i]
style = self.getColCSSClass(i)
if style: style = ' class="%s"' % (style)
html += '<th%s>%s</th>' % (style, title)
html += '</tr>'
for i in range(0, len(self.rows)):
row = self.rows[i]
html += '<tr>'
for j in range(0, len(row)):
v = row[j]
style = self.getCellCSSClass(i, j)
if style: style = ' class="%s"' % (style)
html += '<td%s>%s</td>' % (style, v)
html += '</tr>'
html += '</table>'
self.html = html
super(DisplayHTMLBlockTable, self)._buildHTML()
class DisplayHTMLBlockTableWithGraph(DisplayHTMLBlockTable):
def __init__(self, title, cols, short_title, nb_valid_rows=0):
super(DisplayHTMLBlockTableWithGraph, self).__init__(title=title, cols=cols)
self.short_title = short_title
self.nb_valid_rows = nb_valid_rows
def setNbValidRows(self, nb_valid_rows):
self.nb_valid_rows = nb_valid_rows
class DisplayHTMLPage(object):

Archive Download the corresponding diff file

Branches

Tags