Compare commits

..

10 Commits

Author SHA1 Message Date
pdxlocations
cf4137347f refactor 2025-07-26 21:18:30 -07:00
pdxlocations
12f81f6af6 tweaks 2025-07-26 20:12:50 -07:00
pdxlocations
684d298fac check for selected_config 2025-07-26 20:01:59 -07:00
pdxlocations
4179a3f8d0 redraw input 2025-07-26 16:39:24 -07:00
pdxlocations
7a61808f47 fix positions 2025-07-26 00:55:41 -07:00
pdxlocations
a8680ac0ed changes 2025-07-26 00:31:49 -07:00
pdxlocations
818575939a automatic types 2025-07-25 19:02:22 -07:00
pdxlocations
acaad849b0 add rules 2025-07-25 18:40:37 -07:00
pdxlocations
0b25dda4af validation framework 2025-07-25 18:32:37 -07:00
pdxlocations
18329f0128 init 2025-07-25 00:18:51 -07:00
3 changed files with 1 additions and 11 deletions

View File

@@ -1,6 +1,5 @@
import curses
import logging
import time
import traceback
from typing import Union
@@ -321,15 +320,10 @@ def handle_enter(input_text: str) -> str:
return input_text
elif len(input_text) > 0:
# TODO: This is a hack to prevent sending messages too quickly. Let's get errors from the node.
now = time.monotonic()
if now - ui_state.last_sent_time < 2.5:
contact.ui.dialog.dialog("Slow down", "Please wait 2 seconds between messages.")
return input_text
# Enter key pressed, send user input as message
send_message(input_text, channel=ui_state.selected_channel)
draw_messages_window(True)
ui_state.last_sent_time = now
# Clear entry window and reset input text
entry_win.erase()
return ""
@@ -341,7 +335,6 @@ def handle_ctrl_t(stdscr: curses.window) -> None:
send_traceroute()
curses.curs_set(0) # Hide cursor
contact.ui.dialog.dialog(
stdscr,
f"Traceroute Sent To: {get_name_from_database(ui_state.node_list[ui_state.selected_node])}",
"Results will appear in messages window.\nNote: Traceroute is limited to once every 30 seconds.",
)

View File

@@ -3,9 +3,7 @@ from contact.ui.colors import get_color
def dialog(title: str, message: str) -> None:
"""Display a dialog with a title and message."""
curses.update_lines_cols()
height, width = curses.LINES, curses.COLS
# Calculate dialog dimensions

View File

@@ -24,7 +24,6 @@ class ChatUIState:
selected_message: int = 0
selected_node: int = 0
current_window: int = 0
last_sent_time: float = 0.0
selected_index: int = 0
start_index: List[int] = field(default_factory=lambda: [0, 0, 0])