211 def create(self):
212 """
213 Create the widget
214 """
215 import ipywidgets as widgets
216
217 if self.statistics is None:
218 return widgets.HTML("")
219
220 html = widgets.HTML()
221 html.value = """<table style="border-collapse: collapsed; border: 1px solid black;">
222 <thead><tr style="background: #AAA; font-weight: bold">"""
223
224 for column in self.statistics.columns:
225 if column.three_column_format:
226 html.value += self.table_column_3_html.format(content=column.display_name)
227 else:
228 html.value += self.table_column_html.format(content=column.display_name)
229 html.value += "</tr></thead><tbody>"
230
231 for n, module in enumerate(self.statistics.modules):
232 if n % 2 == 1:
233 html.value += """<tr style="background: #EEE;">"""
234 else:
235 html.value += """<tr>"""
236
237 for column in self.statistics.columns:
238 if column.three_column_format:
239 html.value += self.table_cell_3_html.format(content=module[column.name])
240 else:
241 html.value += self.table_cell_html.format(content=module[column.name])
242
243 html.value += "</tr>"
244
245
246
247 html.value += "</tbody></table>"
248 html.margin = "10px"
249 return html
250
251