diff --git a/default_conf.py b/default_conf.py index 3812624..d9b445e 100644 --- a/default_conf.py +++ b/default_conf.py @@ -31,5 +31,5 @@ multimedia_files = ['png', 'jpg', 'jpeg', 'gif', 'ico', 'css', 'js'] resources_path = ['resources'] -icon_path = ['%s/%s' % (os.path.basename(resources_path[0]), 'icon')] +icon_path = '%s/%s' % (os.path.basename(resources_path[0]), 'icon') css_path = ['%s/%s/%s' % (os.path.basename(resources_path[0]), 'css', 'iwla.css')] diff --git a/display.py b/display.py index 0ffd61d..5e8dbd4 100644 --- a/display.py +++ b/display.py @@ -3,7 +3,8 @@ import codecs class DisplayHTMLRaw(object): - def __init__(self, html=u''): + def __init__(self, iwla, html=u''): + self.iwla = iwla self.html = html def setRawHTML(self, html): @@ -21,8 +22,8 @@ class DisplayHTMLRaw(object): class DisplayHTMLBlock(DisplayHTMLRaw): - def __init__(self, title=''): - super(DisplayHTMLBlock, self).__init__(html='') + def __init__(self, iwla, title=''): + super(DisplayHTMLBlock, self).__init__(iwla, html='') self.title = title self.cssclass = u'iwla_block' self.title_cssclass = u'iwla_block_title' @@ -54,8 +55,8 @@ class DisplayHTMLBlock(DisplayHTMLRaw): class DisplayHTMLBlockTable(DisplayHTMLBlock): - def __init__(self, title, cols): - super(DisplayHTMLBlockTable, self).__init__(title=title) + def __init__(self, iwla, title, cols): + super(DisplayHTMLBlockTable, self).__init__(iwla=iwla, title=title) self.cols = listToStr(cols) self.rows = [] self.cols_cssclasses = [u''] * len(cols) @@ -153,14 +154,12 @@ class DisplayHTMLBlockTable(DisplayHTMLBlock): class DisplayHTMLBlockTableWithGraph(DisplayHTMLBlockTable): - def __init__(self, title, cols, short_titles=None, nb_valid_rows=0, graph_cols=None): - super(DisplayHTMLBlockTableWithGraph, self).__init__(title=title, cols=cols) + def __init__(self, iwla, title, cols, short_titles=None, nb_valid_rows=0, graph_cols=None): + super(DisplayHTMLBlockTableWithGraph, self).__init__(iwla=iwla, title=title, cols=cols) self.short_titles = short_titles or [] self.short_titles = listToStr(self.short_titles) self.nb_valid_rows = nb_valid_rows - # TOFIX - self.icon_path = u'/resources/icon' - # self.icon_path = self.iwla.getConfValue('icon_path', '/') + self.icon_path = self.iwla.getConfValue('icon_path', '/') self.raw_rows = [] self.maxes = [0] * len(cols) self.table_graph_css = u'iwla_graph_table' @@ -195,7 +194,7 @@ class DisplayHTMLBlockTableWithGraph(DisplayHTMLBlockTable): elif style.startswith(u'iwla_visit'): icon = u'vv.png' else: return '' - return u'%s/%s' % (self.icon_path, icon) + return u'/%s/%s' % (self.icon_path, icon) def _buildHTML(self): self._computeMax() @@ -236,7 +235,8 @@ class DisplayHTMLBlockTableWithGraph(DisplayHTMLBlockTable): class DisplayHTMLPage(object): - def __init__(self, title, filename, css_path): + def __init__(self, iwla, title, filename, css_path): + self.iwla = iwla self.title = unicode(title) self.filename = filename self.blocks = [] @@ -273,6 +273,8 @@ class DisplayHTMLPage(object): f.write(u'') for block in self.blocks: block.build(f) + f.write(u'