diff --git a/main.py b/main.py index 1420245..3dd53a7 100644 --- a/main.py +++ b/main.py @@ -19,7 +19,9 @@ import contextlib from utilities.arg_parser import setup_parser from utilities.interfaces import initialize_interface from message_handlers.rx_handler import on_receive -from ui.curses_ui import main_ui, draw_splash +from ui.curses_ui import main_ui +from ui.colors import setup_colors +from ui.splash import draw_splash from input_handlers import get_list_input from utilities.utils import get_channels, get_node_list, get_nodeNum from settings import set_region @@ -48,6 +50,8 @@ def main(stdscr): output_capture = io.StringIO() try: with contextlib.redirect_stdout(output_capture), contextlib.redirect_stderr(output_capture): + + setup_colors() draw_splash(stdscr) parser = setup_parser() args = parser.parse_args() diff --git a/ui/curses_ui.py b/ui/curses_ui.py index 7388b9d..d54117e 100644 --- a/ui/curses_ui.py +++ b/ui/curses_ui.py @@ -304,31 +304,6 @@ def main_ui(stdscr): else: input_text += chr(char) -def draw_splash(stdscr): - setup_colors() - curses.curs_set(0) - - stdscr.clear() - stdscr.bkgd(get_color("background")) - - height, width = stdscr.getmaxyx() - message_1 = "/ Λ" - message_2 = "/ / \\" - message_3 = "P W R D" - message_4 = "connecting..." - - start_x = width // 2 - len(message_1) // 2 - start_x2 = width // 2 - len(message_4) // 2 - start_y = height // 2 - 1 - stdscr.addstr(start_y, start_x, message_1, get_color("splash_logo", bold=True)) - stdscr.addstr(start_y+1, start_x-1, message_2, get_color("splash_logo", bold=True)) - stdscr.addstr(start_y+2, start_x-2, message_3, get_color("splash_logo", bold=True)) - stdscr.addstr(start_y+4, start_x2, message_4, get_color("splash_text")) - - stdscr.attrset(get_color("window_frame")) - stdscr.box() - stdscr.refresh() - curses.napms(500) def draw_channel_list(): diff --git a/ui/splash.py b/ui/splash.py new file mode 100644 index 0000000..08fe2e5 --- /dev/null +++ b/ui/splash.py @@ -0,0 +1,27 @@ +import curses +from ui.colors import get_color + +def draw_splash(stdscr): + curses.curs_set(0) + + stdscr.clear() + stdscr.bkgd(get_color("background")) + + height, width = stdscr.getmaxyx() + message_1 = "/ Λ" + message_2 = "/ / \\" + message_3 = "P W R D" + message_4 = "connecting..." + + start_x = width // 2 - len(message_1) // 2 + start_x2 = width // 2 - len(message_4) // 2 + start_y = height // 2 - 1 + stdscr.addstr(start_y, start_x, message_1, get_color("splash_logo", bold=True)) + stdscr.addstr(start_y+1, start_x-1, message_2, get_color("splash_logo", bold=True)) + stdscr.addstr(start_y+2, start_x-2, message_3, get_color("splash_logo", bold=True)) + stdscr.addstr(start_y+4, start_x2, message_4, get_color("splash_text")) + + stdscr.attrset(get_color("window_frame")) + stdscr.box() + stdscr.refresh() + curses.napms(500) \ No newline at end of file