Prelim: Draw progress bar

This commit is contained in:
Rory Fewell
2025-07-03 00:10:32 +01:00
parent 1b26f55991
commit 0b88f2ba0f
2 changed files with 22 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ COLOR_PAIR_NORMAL_TEXT = 1
COLOR_PAIR_BRIGHT_TEXT = 2
COLOR_PAIR_HIGHLIGHT_OPTION = 3
COLOR_PAIR_INSTRUCTIONS = 4
COLOR_PAIR_PROGRESS = 5
# Coords for the working area
#
@@ -43,6 +44,11 @@ def wsetup_screen_init(stdscr):
curses.COLOR_BLACK,
curses.COLOR_WHITE
)
curses.init_pair(
COLOR_PAIR_PROGRESS,
curses.COLOR_YELLOW,
curses.COLOR_BLUE
)
try:
curses.init_pair(
@@ -134,6 +140,14 @@ def wsetup_screen_write_direct(stdscr, y, x, text, attr):
def wsetup_screen_write_simple(stdscr, y, x, text, attr):
wsetup_screen_write_direct(stdscr, WSETUP_MAIN_Y + y, WSETUP_MAIN_X + x, text, attr)
def wsetup_screen_draw_bar(stdscr, y, x, width):
for i in range(width):
stdscr.addch(
y, x + i,
curses.ACS_BLOCK,
curses.color_pair(COLOR_PAIR_PROGRESS)
)
def wsetup_screen_draw_box(stdscr, y, x, height, width):
# Top left corner
#

View File

@@ -309,11 +309,17 @@ def wsetup_step_install_base(stdscr):
wsetup_screen_write_simple(
stdscr,
box_y + 1,
wsetup_screen_get_scaled_x(stdscr, 40) - 2,
box_y + 2,
wsetup_screen_get_scaled_x(stdscr, 40) - 3,
progress,
curses.color_pair(COLOR_PAIR_NORMAL_TEXT)
)
wsetup_screen_draw_bar(
stdscr,
progbox_y + 1,
progbox_x + 1,
progbox_w - 2
)
stdscr.refresh()