more almost working changes

This commit is contained in:
pdxlocations
2025-04-20 20:59:10 -07:00
parent b7a275f725
commit bfb7ed0278
2 changed files with 20 additions and 13 deletions
+7 -2
View File
@@ -12,7 +12,7 @@ from contact.utilities.db_handler import get_name_from_database, update_node_inf
from contact.utilities.input_handlers import get_list_input
import contact.ui.default_config as config
import contact.ui.dialog
from contact.ui.nav_utils import move_main_highlight
from contact.ui.nav_utils import move_main_highlight, draw_main_arrows
from contact.utilities.singleton import ui_state, interface_state
@@ -86,6 +86,7 @@ def handle_resize(stdscr: curses.window, firstrun: bool) -> None:
draw_channel_list()
draw_messages_window(True)
draw_node_list()
except:
# Resize events can come faster than we can re-draw, which can cause a curses error.
# In this case we'll see another curses.KEY_RESIZE in our key handler and draw again later.
@@ -460,6 +461,8 @@ def draw_channel_list() -> None:
)
channel_win.box()
channel_win.attrset((get_color("window_frame")))
draw_main_arrows(channel_win, len(ui_state.channel_list), ui_state.start_index, ui_state.current_window)
channel_win.refresh()
refresh_pad(0)
@@ -547,6 +550,8 @@ def draw_node_list() -> None:
)
nodes_win.box()
nodes_win.attrset(get_color("window_frame"))
draw_main_arrows(nodes_win, len(ui_state.node_list), ui_state.start_index, ui_state.current_window)
nodes_win.refresh()
refresh_pad(2)
@@ -864,7 +869,7 @@ def refresh_pad(window: int) -> None:
box.getbegyx()[0] + 1,
box.getbegyx()[1] + 1,
box.getbegyx()[0] + lines,
box.getbegyx()[1] + box.getmaxyx()[1] - 2,
box.getbegyx()[1] + box.getmaxyx()[1] - 3,
)
+13 -11
View File
@@ -370,24 +370,26 @@ def move_main_highlight(
menu_win.getbegyx()[0] + 1,
menu_win.getbegyx()[1] + 1,
menu_win.getbegyx()[0] + visible_height,
menu_win.getbegyx()[1] + menu_win.getmaxyx()[1] - 2,
menu_win.getbegyx()[1] + menu_win.getmaxyx()[1] - 3,
)
draw_main_arrows(menu_win, visible_height, max_index, ui_state.start_index, ui_state.current_window)
draw_main_arrows(menu_win, max_index, ui_state.start_index, ui_state.current_window)
menu_win.refresh()
def draw_main_arrows(
win: object, visible_height: int, max_index: int, start_index: List[int], current_window: int
) -> None:
def draw_main_arrows(win: object, max_index: int, start_index: List[int], current_window: int) -> None:
if visible_height < max_index:
height, width = win.getmaxyx()
usable_height = height - 2
usable_width = width - 2
if height < max_index:
if start_index[current_window] > 0:
win.addstr(1, 1, "", get_color("settings_default"))
win.addstr(1, usable_width, "", get_color("settings_default"))
else:
win.addstr(1, 1, " ", get_color("settings_default"))
win.addstr(1, usable_width, " ", get_color("settings_default"))
if max_index - start_index[current_window] >= visible_height + 1:
win.addstr(visible_height, 1, "", get_color("settings_default"))
if max_index - start_index[current_window] >= usable_height + 1:
win.addstr(usable_height, usable_width, "", get_color("settings_default"))
else:
win.addstr(visible_height, 1, " ", get_color("settings_default"))
win.addstr(usable_height, usable_width, " ", get_color("settings_default"))