def draw_progress_bar(fr, progress=0.0):
    if not fr_big_enough_to_draw_on(fr,
                                    settings['bar_w_fits'],
                                    settings['bar_h_fits']):
        return
    w = fr.shape[1]
    h = fr.shape[0]

    draw_strk = lambda x, y, shift_x, shift_y, ext_x, ext_y: \
        cv2.rectangle(fr,
                      (x[0] + shift_x - ext_x, x[1] + shift_y - ext_y),
                      (y[0] + shift_x + ext_x, y[1] + shift_y + ext_y),
                      settings['bar_strk_color'],
                      settings['ln_type'])  # shift: moves, ext: extends verts
    draw_rect = lambda x, y: \
        cv2.rectangle(fr,
                      x,
                      y,
                      settings['bar_color'],
                      settings['ln_type'])

    # outer rect
    # points go r to d w/ origin at top l, v1: top l, v2: bot r
    t_v1 = (int(w * settings['bar_s_pad']), int(h * settings['bar_t_pad']))
    t_v2 = (int(w * (1 - settings['bar_s_pad'])), t_v1[1] +
            settings['ln_thick'])
    draw_strk(t_v1, t_v2, 0, -settings['strk_sz'], 1, 0)
    draw_rect(t_v1, t_v2)

    b_v1 = (t_v1[0], t_v2[1] + 2 * settings['bar_in_pad'] +
            settings['bar_thick'])
    b_v2 = (t_v2[0], b_v1[1] + settings['ln_thick'])
    draw_strk(b_v1, b_v2, 0, settings['strk_sz'], 1, 0)
    draw_rect(b_v1, b_v2)

    l_v1 = t_v1
    l_v2 = (b_v1[0] + settings['ln_thick'], b_v1[1] + settings['ln_thick'])
    draw_strk(l_v1, l_v2, -settings['strk_sz'], 0, 0, 0)
    draw_rect(l_v1, l_v2)

    r_v1 = (t_v2[0] - settings['ln_thick'], t_v1[1])
    r_v2 = b_v2
    draw_strk(r_v1, r_v2, settings['strk_sz'], 0, 0, 0)
    draw_rect(r_v1, r_v2)

    # inner progress bar
    pad = settings['ln_thick'] + settings['bar_in_pad']
    max_w = int(r_v2[0] - pad)
    min_w = int(l_v1[0] + pad)
    bar_v1 = (t_v1[0] + pad, l_v1[1] + pad)
    bar_v2 = (max(min_w, min(max_w, int(max_w * progress))), b_v2[1] - pad)

    if progress > 0:
        draw_strk(bar_v1, bar_v2, 0, 0, 1, 1)
        draw_rect(bar_v1, bar_v2)
dataset/ETHPy150Open dthpham/butterflow/butterflow/draw.py/draw_progress_bar/original