Example #1
0
def extended_best(draw):

    draw.rectangle((0, 0, 127, 63), fill='black')

    draw.text((0, 0), u'\ue801', font=icon, fill='white')

    w, h = draw.textsize(text=s.room + ' Best TX', font=font)
    tab = (s.device.width - w) / 2
    draw.text((tab, 0), s.room + ' Best TX', font=font, fill='white')

    tmp = sorted(s.history.items(), key=lambda x: x[1])
    tmp.reverse()

    best_min = min(s.history, key=s.history.get)
    best_max = max(s.history, key=s.history.get)

    i = 16

    for j in xrange(0, 5):
        c, n = tmp[j]
        t = l.interpolation(n, s.history[best_min], s.history[best_max], 12,
                            42)
        if t == 0:
            t = 42
        n = str(n)

        draw.rectangle((0, i - 1, t, i + 7), fill='white')
        draw.line((t + 1, i, t + 1, i + 6), fill='white')
        draw.line((t + 2, i + 2, t + 2, i + 4), fill='white')
        draw.point((t + 3, i + 3), fill='white')

        draw.text((1, i), n, font=font, fill='black')
        draw.text((54, i), c, font=font, fill='white')

        i += 10
Example #2
0
def tot(draw, legacy, start, current, position):
    duration = int(current) - int(start)
    duration += (duration / 30)  # Reajust time latence
    duration_min = 0

    timer = [i for i in xrange(30, 901, 30)]

    for i in timer:
        if duration < i:
            duration_max = i
            break
        else:
            duration_min = i

    h = l.interpolation(duration, duration_min, duration_max, 0, 120)

    draw.rectangle((0, 54, 128, 43), fill='black')
    for i in xrange(3, h, 2):
        draw.rectangle((i, 54, i, 43), fill='white')

    for i in xrange(0, 128, 4):
        draw.line((i, 57, i + 1, 57), fill='white')

    # Duration min
    tmp = list(str(duration_min))
    msg = ''
    for c in tmp:
        msg += chr(s.letter[c])
    legacy.text(draw, (0, position + 2),
                msg,
                fill='white',
                font=s.SMALL_BITMAP_FONT)

    # Duration max
    tmp = list(str(duration_max))
    msg = ''
    for c in tmp:
        msg += chr(s.letter[c])
    if duration_max < 100:
        tab = 4
    else:
        tab = 0
    legacy.text(draw, (115 + tab, position + 2),
                msg,
                fill='white',
                font=s.SMALL_BITMAP_FONT)

    # duration
    tmp = list(str(duration))
    msg = ''
    for c in tmp:
        msg += chr(s.letter[c])
    if duration < 10:
        tab = 2
    else:
        tab = 0
    legacy.text(draw, (60 + tab, position + 2),
                msg,
                fill='white',
                font=s.SMALL_BITMAP_FONT)
Example #3
0
def histogram(draw, legacy, position, height=15):
    qso_hour_max = max(s.qso_hour)

    i = 5
    j = 100

    for (t, q) in enumerate(s.qso_hour):
        if q != 0:
            h = l.interpolation(q, 0, qso_hour_max, 0, height)
        else:
            h = 0

        draw.rectangle((0 + i, position, i + 2, (position - height)),
                       fill=get_color('screen', 'background'))
        if t == s.hour:
            color = get_color('histogram', 'column_current')
        else:
            color = get_color('histogram', 'column')

        draw.rectangle((0 + i, position, i + 2, (position - h)), fill=color)

        j += 5
        i += 5

    for i, j, k in [(1, 0, 0), (33, 0, 6), (63, 1, 2), (93, 1, 8),
                    (120, 2, 3)]:
        legacy.text(draw, (i, position + 2),
                    chr(j) + chr(k),
                    fill=get_color('histogram', 'legend'),
                    font=s.SMALL_BITMAP_FONT)
Example #4
0
def extended_best(draw, limit=5):
    if s.device.height == 128:
        draw.rectangle((0, 1, s.device.height - 1, 13),
                       fill=get_color('header', 'background'))

    legacy.text(draw, (0, 1),
                chr(0) + chr(1),
                fill=get_color('header', 'foreground'),
                font=s.SMALL_BITMAP_STAT)
    legacy.text(draw, (0, 9),
                chr(2) + chr(3),
                fill=get_color('header', 'foreground'),
                font=s.SMALL_BITMAP_STAT)

    title(draw, 'Top links')

    best_min = min(s.best_time)
    best_max = max(s.best_time)

    if s.device.height == 128:
        i = 17
    else:
        i = 16

    for j in range(0, limit):
        c = s.best[j]
        n = int(s.best_time[j])

        if n == 0:
            break

        t = l.interpolation(n, best_min, best_max, 28, 42)
        if t == 0:
            t = 42

        label(draw, i, t, get_color('label', 'background'),
              get_color('label', 'foreground'), l.convert_second_to_time(n), c,
              54)
        if s.device.height == 128:
            i += 11
        else:
            i += 10
Example #5
0
def histogram(draw, legacy, position):

    qso_hour_max = max(s.qso_hour)

    i = 5

    for q in s.qso_hour:
        if q != 0:
            h = l.interpolation(q, 1, qso_hour_max, 1, 15)
        else:
            h = 0

        draw.rectangle((0 + i, position, i + 2, (position - 15)), fill='black')
        draw.rectangle((0 + i, position, i + 2, (position - h)), fill='white')
        i += 5

    legacy.text(draw, (1, position + 2),
                chr(0) + chr(0),
                fill='white',
                font=s.SMALL_BITMAP_FONT)
    legacy.text(draw, (33, position + 2),
                chr(0) + chr(6),
                fill='white',
                font=s.SMALL_BITMAP_FONT)
    legacy.text(draw, (63, position + 2),
                chr(1) + chr(2),
                fill='white',
                font=s.SMALL_BITMAP_FONT)
    legacy.text(draw, (93, position + 2),
                chr(1) + chr(8),
                fill='white',
                font=s.SMALL_BITMAP_FONT)
    legacy.text(draw, (120, position + 2),
                chr(2) + chr(3),
                fill='white',
                font=s.SMALL_BITMAP_FONT)
Example #6
0
def tot(draw, legacy, duration, position):
    #duration += (duration / 60)     # Reajust time latence
    if s.device.height < 128:
        j = 54
        k = 11

        duration_min = 0

        timer = [i for i in range(60, 360, 60)]

        for i in timer:
            if duration < i:
                duration_max = i
                break
            else:
                duration_min = i

        h = l.interpolation(duration, duration_min, duration_max, 0, 120)

        draw.rectangle((0, j, 128, j - k),
                       fill=get_color('screen', 'background'))
        for i in range(3, h, 2):
            draw.rectangle((i, j, i, j - k),
                           fill=get_color('screen', 'foreground'))

        for i in range(0, 128, 4):
            draw.line((i, position, i + 1, position),
                      fill=get_color('screen', 'foreground'))

        # Duration min
        tmp = list(str(duration_min))
        msg = ''
        for c in tmp:
            msg += chr(s.letter[c])
        legacy.text(draw, (0, position + 2),
                    msg,
                    fill=get_color('screen', 'foreground'),
                    font=s.SMALL_BITMAP_FONT)

        # Duration max
        tmp = list(str(duration_max))
        msg = ''
        for c in tmp:
            msg += chr(s.letter[c])
        if duration_max < 100:
            tab = 4
        else:
            tab = 0
        legacy.text(draw, (115 + tab, position + 2),
                    msg,
                    fill=get_color('screen', 'foreground'),
                    font=s.SMALL_BITMAP_FONT)

        # duration
        tmp = list(str(duration))
        msg = ''
        for c in tmp:
            msg += chr(s.letter[c])
        if duration < 10:
            tab = 2
        else:
            tab = 0

        legacy.text(draw, (60 + tab, position + 2),
                    msg,
                    fill=get_color('screen', 'foreground'),
                    font=s.SMALL_BITMAP_FONT)
    else:
        tmp = l.convert_second_to_time(duration)
        w, h = draw.textsize(text=tmp, font=font_tot)
        tab = (s.device.width - w) / 2
        draw.text((tab, 57),
                  tmp,
                  font=font_tot,
                  fill=get_color('screen', 'foreground'))