Beispiel #1
0
def partial_result(p, query, result, synonyms, definition, relations, images):
    with p(html.table({'style':'margin:20px;width:100%;'})):
        with p(html.tr()):
            with p(html.td({'valign':'top', 'width':'50%'})):
                p(partial_result_data(query, result, synonyms, definition, relations))
                p(html.nobreaks(' '))
            with p(html.td({'valign':'top', 'width':'50%'})):
                p(template_image_table(images))
                p(html.nobreaks(' '))
Beispiel #2
0
def helper_count_box(p, count, max_count):
    if count > 0:
        if max_count > 1:
            num_boxes = round((math.log(count) / math.log(max_count)) * 4)
        else:
            num_boxes = 4
    else:
        num_boxes = 0
    if num_boxes > 0:
        style = 'height:6px;width:6px;border:1px solid white;background-color:blue;position:absolute;'
        with p(html.div({'style':'display:inline;position:absolute;'})):
            if num_boxes >= 4:
                p(html.div(' ', {'style':'top:1px;left:6px;' + style}))
            if num_boxes >= 3:
                p(html.div(' ', {'style':'top:1px;left:-1px;' + style}))
            if num_boxes >= 2:
                p(html.div(' ', {'style':'top:8px;left:6px;' + style}))
            if num_boxes >= 1:
                p(html.div(' ', {'style':'top:8px;left:-1px;' + style}))
        p(html.nobreaks('   '))