Commit eb553edc authored by Fjen Undso's avatar Fjen Undso
Browse files

nchl: center elements

parent 99352034
......@@ -16,6 +16,8 @@ from gui.container.numberbar import NumberBarContainer
def main(stdscr):
stdscr.clear()
maxy, maxx = stdscr.getmaxyx()
scr_center_x = maxx // 2
# hide cursor
curses.curs_set(0)
# init colors
......@@ -32,7 +34,9 @@ def main(stdscr):
logger.addHandler(CursesHandler(stdscr))
logger.setLevel(logging.INFO)
stdscr.addstr(0, 2, "nchl - ncurses HoneyLight control", curses.A_BOLD)
# draw title
title = "nchl - ncurses HoneyLight control"
stdscr.addstr(0, scr_center_x - len(title) // 2,title, curses.A_BOLD)
# draw colors
numbers_text = [
......@@ -45,7 +49,7 @@ def main(stdscr):
ProgressBar(
window=stdscr,
row=1,
col=4 + i * 8,
col=scr_center_x - 14 + i * 8,
width=5,
height=12,
value=255,
......@@ -55,7 +59,7 @@ def main(stdscr):
numbers = [
NumberRange(
window=stdscr,
col=4+ i * 8,
col=scr_center_x - 14 + i * 8,
row=13,
value=255,
prev_key='KEY_DOWN',
......@@ -72,7 +76,7 @@ def main(stdscr):
checkboxes_top = [
CheckBox(
window=stdscr,
col=i // 2 * 11,
col=scr_center_x - 21 + i // 2 * 11,
row=15,
toggle_key=' ',
toggle_key_unfocused=str(i),
......@@ -81,7 +85,7 @@ def main(stdscr):
checkboxes_bottom = [
CheckBox(
window=stdscr,
col=(i - 1) // 2 * 11,
col=scr_center_x - 21 + (i - 1) // 2 * 11,
row=16,
toggle_key=' ',
toggle_key_unfocused=str(i),
......@@ -93,8 +97,13 @@ def main(stdscr):
next_key='KEY_RIGHT')
# draw settings
continous = CheckBox(window=stdscr, col=6, row=18, toggle_key_unfocused='c', text='(C)ontinuous updating')
stdscr.addstr(20, 8, 'S to send, Q to quit', curses.color_pair(curses.COLOR_YELLOW))
continous = CheckBox(
window=stdscr,
col=scr_center_x - 12,
row=18,
toggle_key_unfocused='c',
text='(C)ontinuous updating')
stdscr.addstr(19, scr_center_x - 10, 'S to send, Q to quit', curses.color_pair(curses.COLOR_YELLOW))
# focusswitcher
fs_n_cb = FocusSwitcher(elements=[fs_n, fs_cb], prev_key='\t')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment