Compare commits

..

1 Commits

Author SHA1 Message Date
pdxlocations
ba713366bc bump version 2026-02-11 21:58:20 -08:00
4 changed files with 11 additions and 41 deletions

View File

@@ -18,7 +18,7 @@ from contact.ui.nav_utils import move_main_highlight, draw_main_arrows, get_msg_
from contact.utilities.singleton import ui_state, interface_state, menu_state
MIN_COL = 2 # keep hidden panes at least border-safe for curses
MIN_COL = 1 # "effectively zero" without breaking curses
root_win = None
@@ -48,18 +48,14 @@ def compute_widths(total_w: int, focus: int):
# tiny terminals: allocate something, anything
return max(1, total_w), 0, 0
hidden_w = MIN_COL
if focus == 0:
return total_w - 2 * hidden_w, hidden_w, hidden_w
return total_w - 2 * MIN_COL, MIN_COL, MIN_COL
if focus == 1:
return hidden_w, total_w - 2 * hidden_w, hidden_w
return hidden_w, hidden_w, total_w - 2 * hidden_w
return MIN_COL, total_w - 2 * MIN_COL, MIN_COL
return MIN_COL, MIN_COL, total_w - 2 * MIN_COL
def paint_frame(win, selected: bool) -> None:
h, w = win.getmaxyx()
if h < 2 or w < 2:
return
win.attrset(get_color("window_frame_selected") if selected else get_color("window_frame"))
win.box()
win.attrset(get_color("window_frame"))
@@ -145,22 +141,9 @@ def handle_resize(stdscr: curses.window, firstrun: bool) -> None:
packetlog_win.resize(pkt_h, messages_width)
packetlog_win.mvwin(height - pkt_h - entry_height, channel_width)
# Draw only currently relevant borders in single-pane mode.
if ui_state.single_pane_mode:
target_wins = [entry_win]
if ui_state.current_window == 0:
target_wins.append(channel_win)
elif ui_state.current_window == 1:
target_wins.append(messages_win)
else:
target_wins.append(nodes_win)
else:
target_wins = [channel_win, entry_win, nodes_win, messages_win]
for win in target_wins:
h, w = win.getmaxyx()
if h >= 2 and w >= 2:
win.box()
# Draw window borders
for win in [channel_win, entry_win, nodes_win, messages_win]:
win.box()
win.refresh()
entry_win.keypad(True)

View File

@@ -126,16 +126,12 @@ def display_menu() -> tuple[object, object]:
if full_key.startswith("config.network.ipv4_config.") and option in {"ip", "gateway", "subnet", "dns"}:
if isinstance(current_value, int):
try:
current_value = str(
ipaddress.IPv4Address(int(current_value).to_bytes(4, "little", signed=False))
)
current_value = str(ipaddress.IPv4Address(current_value))
except ipaddress.AddressValueError:
pass
elif isinstance(current_value, str) and current_value.isdigit():
try:
current_value = str(
ipaddress.IPv4Address(int(current_value).to_bytes(4, "little", signed=False))
)
current_value = str(ipaddress.IPv4Address(int(current_value)))
except ipaddress.AddressValueError:
pass

View File

@@ -435,16 +435,10 @@ def draw_main_arrows(win: object, max_index: int, window: int, **kwargs) -> None
usable_height = height - 2
usable_width = width - 2
if usable_height <= 0 or usable_width <= 0:
return
if window == 1 and ui_state.display_log:
if log_height := kwargs.get("log_height"):
usable_height -= log_height - 1
if usable_height <= 0:
return
if usable_height < max_index:
if ui_state.start_index[window] > 0:
win.addstr(1, usable_width, "", get_color("settings_default"))

View File

@@ -462,10 +462,7 @@ from contact.utilities.singleton import menu_state # Ensure this is imported
def get_fixed32_input(current_value: int) -> int:
original_value = current_value
try:
ip_string = str(ipaddress.IPv4Address(int(current_value).to_bytes(4, "little", signed=False)))
except Exception:
ip_string = str(ipaddress.IPv4Address(current_value))
ip_string = str(ipaddress.IPv4Address(current_value))
height = 10
width = get_dialog_width()
start_y = max(0, (curses.LINES - height) // 2)
@@ -527,7 +524,7 @@ def get_fixed32_input(current_value: int) -> int:
if len(octets) == 4 and all(octet.isdigit() and 0 <= int(octet) <= 255 for octet in octets):
curses.noecho()
curses.curs_set(0)
return int.from_bytes(ipaddress.IPv4Address(user_input).packed, "little", signed=False)
return int(ipaddress.ip_address(user_input))
else:
fixed32_win.addstr(
7,