erase() instead of clear()
This commit is contained in:
parent
7c21965500
commit
44280a8d07
9
kls
9
kls
|
@ -68,7 +68,7 @@ def draw_rows(menu: Menu):
|
||||||
|
|
||||||
|
|
||||||
def draw_menu(menu: Menu):
|
def draw_menu(menu: Menu):
|
||||||
menu.win.clear() # clear menu window
|
menu.win.erase() # clear menu window
|
||||||
draw_row(menu.win, menu.title, 1, 2, selected=True if menu == selected_menu else False) # draw title
|
draw_row(menu.win, menu.title, 1, 2, selected=True if menu == selected_menu else False) # draw title
|
||||||
draw_rows(menu) # draw menu rows
|
draw_rows(menu) # draw menu rows
|
||||||
draw_row(menu.win, f"/{menu.filter}" if menu.filter else "", curses.LINES - FOOTER_HEIGHT - 2, 2) # draw filter row
|
draw_row(menu.win, f"/{menu.filter}" if menu.filter else "", curses.LINES - FOOTER_HEIGHT - 2, 2) # draw filter row
|
||||||
|
@ -76,7 +76,7 @@ def draw_menu(menu: Menu):
|
||||||
|
|
||||||
def refresh_third_menu(namespace: str, api_resource: str):
|
def refresh_third_menu(namespace: str, api_resource: str):
|
||||||
menu = menus[2]
|
menu = menus[2]
|
||||||
menu.rows = []
|
previous_menu_rows = menu.rows
|
||||||
if api_resource and namespace:
|
if api_resource and namespace:
|
||||||
if api_resource == "all":
|
if api_resource == "all":
|
||||||
menu.rows = kubectl(f"api-resources --verbs=get --namespaced -o name | grep -v events | xargs -n 1 kubectl get --show-kind --namespace {namespace} --ignore-not-found --no-headers -o name")
|
menu.rows = kubectl(f"api-resources --verbs=get --namespaced -o name | grep -v events | xargs -n 1 kubectl get --show-kind --namespace {namespace} --ignore-not-found --no-headers -o name")
|
||||||
|
@ -85,9 +85,12 @@ def refresh_third_menu(namespace: str, api_resource: str):
|
||||||
index_before_update = menu.filtered_rows.index
|
index_before_update = menu.filtered_rows.index
|
||||||
menu.filtered_rows = CircularList([x for x in menu.rows if menu.filter in x]) # update filtered rows
|
menu.filtered_rows = CircularList([x for x in menu.rows if menu.filter in x]) # update filtered rows
|
||||||
menu.filtered_rows.index = index_before_update
|
menu.filtered_rows.index = index_before_update
|
||||||
|
else:
|
||||||
|
menu.rows = []
|
||||||
if menu.visible_row_index >= len(menu.visible_rows()):
|
if menu.visible_row_index >= len(menu.visible_rows()):
|
||||||
menu.visible_row_index = 0
|
menu.visible_row_index = 0
|
||||||
draw_menu(menu)
|
if previous_menu_rows != menu.rows:
|
||||||
|
draw_menu(menu)
|
||||||
|
|
||||||
|
|
||||||
def handle_key_bindings(key: str, namespace: str, api_resource: str, resource: str):
|
def handle_key_bindings(key: str, namespace: str, api_resource: str, resource: str):
|
||||||
|
|
Loading…
Reference in New Issue