Beispiel #1
0
def render(state, line):
    maxy, maxx = g.stdscr.getmaxyx()

    labels = None
    if 'column_labels' in state:
        labels = state['column_labels']
    if labels:
        for i in range(0, len(labels)):
            s = labels[i].rjust(g.settings['defaults']['splitscolumnwidth'],
                                " ")
            index = util.rightallignindex(
                len(s), maxx - i * g.settings['defaults']['splitscolumnwidth'],
                maxx // 2)
            g.stdscr.addstr(line, index, s)
        line += 1

    if 'splits' in state:
        for split in state['splits']:
            s = split['name']
            if split['is_current_split']:
                s = "-> " + s
            g.stdscr.addstr(line, util.leftallignindex(), s)

            if state['display_two_rows']:
                line += 1

            columns = []
            columncolors = []
            for c in split['columns']:
                s = c['value']
                if s and not s.isspace():
                    columns.append(s)
                    columncolors.append(c['semantic_color'])

            n = len(columns)
            for i in range(0, n):
                if i < n - 1:
                    s = columns[i].rjust(
                        g.settings['defaults']['splitscolumnwidth'], " ")
                else:
                    s = " " + columns[i]
                index = util.rightallignindex(
                    len(s),
                    maxx - i * g.settings['defaults']['splitscolumnwidth'],
                    maxx // 2)
                g.stdscr.attron(timing.get_color(columncolors[i]))
                g.stdscr.addstr(line, index, s)
                g.stdscr.attroff(timing.get_color(columncolors[i]))

            line += 1

    return line
Beispiel #2
0
def render(state, line):
    maxy, maxx = g.stdscr.getmaxyx()

    if 'line1' in state and state['line1']:
        g.stdscr.addstr(
            line,
            util.centerallignindex(len(state['line1']), maxx) if
            state['is_centered'] else util.leftallignindex(), state['line1'])
        line += 1
    if 'line2' in state and state['line2']:
        g.stdscr.addstr(
            line,
            util.centerallignindex(len(state['line2']), maxx) if
            state['is_centered'] else util.leftallignindex(), state['line2'])
        line += 1

    sattempts = ""
    if state['finished_runs'] and state['attempts']:
        sattempts = str(state['finished_runs']) + "/" + str(state['attempts'])
    else:
        if state['finished_runs']:
            sattempts = str(state['finished_runs'])
        if state['attempts']:
            sattempts = str(state['attempts'])
    g.stdscr.addstr(1, util.rightallignindex(len(sattempts), maxx), sattempts)

    return line
Beispiel #3
0
def render(state, line):
    maxy, maxx = g.stdscr.getmaxyx()

    if 'text' in state and 'comparison' in state:
        g.stdscr.addstr(line, util.leftallignindex(), state['text'])

        if state['display_two_rows']:
            line += 1

        g.stdscr.addstr(line,
                        util.rightallignindex(len(state['comparison']), maxx),
                        state['comparison'])
        line += 1

    return line
Beispiel #4
0
def render(state, line):
    maxy, maxx = g.stdscr.getmaxyx()

    if 'text' in state and 'time' in state:
        g.stdscr.addstr(line, util.leftallignindex(), state['text'])

        if state['display_two_rows']:
            line += 1

        g.stdscr.attron(timing.get_color(state['semantic_color']))
        g.stdscr.addstr(line, util.rightallignindex(len(state['time']), maxx),
                        state['time'])
        g.stdscr.attroff(timing.get_color(state['semantic_color']))
        line += 1

    return line
Beispiel #5
0
def render(state, line):
    maxy, maxx = g.stdscr.getmaxyx()

    if 'time' not in state:
        return line

    stimer = state['time'] + (state['fraction'] if 'fraction' in state else "")
    if state['height'] > g.settings['defaults']['heighttranslatefactor']:
        stimer = build_timer_str(stimer)
    else:
        stimer = " \n" + stimer + " \n "
    g.stdscr.attron(timing.get_color(state['semantic_color']))
    for p in stimer.split('\n'):
        g.stdscr.addstr(line, util.rightallignindex(len(p), maxx), p)
        line += 1
    g.stdscr.attroff(timing.get_color(state['semantic_color']))

    return line
Beispiel #6
0
def render(state, line):
    if 'text' not in state:
        return line

    maxy, maxx = g.stdscr.getmaxyx()
    text = state['text']

    if 'Center' in text:
        g.stdscr.addstr(line, util.centerallignindex(len(text['Center']),
                                                     maxx), text['Center'])
        line += 1

    if 'Split' in text:
        g.stdscr.addstr(line, util.leftallignindex(), text['Split'][0])

        if state['display_two_rows']:
            line += 1

        g.stdscr.addstr(line, util.rightallignindex(len(text['Split'][1]),
                                                    maxx), text['Split'][1])
        line += 1

    return line