Rearrange code

This commit is contained in:
Digital Studium 2024-04-14 17:40:13 +03:00
parent 27bcefd34f
commit bea2d1ba54
1 changed files with 5 additions and 11 deletions

16
kls
View File

@ -10,9 +10,7 @@ curses.noecho() # не выводим символы вверху
SELECTED_WITHOUT_SEARCH, SELECTED_WITH_SEARCH, NOT_SELECTED_WITHOUT_SEARCH, NOT_SELECTED_WITH_SEARCH = 1, 2, 3, 4 # состояния меню SELECTED_WITHOUT_SEARCH, SELECTED_WITH_SEARCH, NOT_SELECTED_WITHOUT_SEARCH, NOT_SELECTED_WITH_SEARCH = 1, 2, 3, 4 # состояния меню
STATE = "running" # состояние программы STATE = "running" # состояние программы
HELP_WIN = curses.newwin(3, curses.COLS, curses.LINES - 3, 0) # окно помощи
help_win = curses.newwin(3, curses.COLS, curses.LINES - 3, 0) # окно помощи
class Menu: class Menu:
def __init__(self, name, rows, begin_x, width, state): def __init__(self, name, rows, begin_x, width, state):
@ -84,13 +82,6 @@ def draw_search_box(menu):
menu.win.refresh() # обновляем окно menu.win.refresh() # обновляем окно
def draw_help():
help = "q: exit, /: enter search mode, Esc: exit search mode, F1: get yaml, F2: describe, F3: edit, F4: pod logs"
help_win.addstr(1, 2, help)
help_win.box() # рисуем рамку
help_win.refresh() # обновляем окно
def draw_menu(menu): def draw_menu(menu):
menu.win.clear() # очищаем окно меню menu.win.clear() # очищаем окно меню
draw_header(menu) # рисуем заголовок draw_header(menu) # рисуем заголовок
@ -101,7 +92,10 @@ def draw_menu(menu):
def draw_windows(): def draw_windows():
for menu in menus: for menu in menus:
draw_menu(menu) draw_menu(menu)
draw_help() help_text = "q: exit, /: enter search mode, Esc: exit search mode, F1: get yaml, F2: describe, F3: edit, F4: pod logs"
HELP_WIN.addstr(1, 2, help_text)
HELP_WIN.box() # рисуем рамку
HELP_WIN.refresh() # обновляем окно
def run_command(key_pressed): def run_command(key_pressed):