Rework TUI: single-threaded curses, scrollback buffer, server menu

- All curses drawing on the main thread; stdin polled together with the
  ZMQ sockets, Ctrl-C only sets a flag
- Output kept in a 2000-line buffer and redrawn from it, so resizes keep
  the history; PgUp/PgDn and mouse wheel scroll it
- Messages without trailing newline continue the current line (status
  table columns arrive as separate messages)
- Too-small terminal shows a warning instead of exiting
- Start without arguments shows a server selection menu
- Colors on the terminal default background; version 0.9.0
This commit is contained in:
pfl
2026-09-16 17:01:51 +02:00
parent 0613d380a4
commit db123993c0
7 changed files with 658 additions and 621 deletions
+4 -1
View File
@@ -5,7 +5,7 @@ Configuration and constants for QLPyCon
import re
VERSION = "0.8.1"
VERSION = "0.9.0"
# Pattern matching
COLOR_CODE_PATTERN = re.compile(r'\^\d') # Quake color codes (^0-^9)
@@ -21,10 +21,13 @@ RESPAWN_DELAY = 3.0 # Seconds before players respawn after death
STATS_CONNECTION_DELAY = 0.5 # Initial stats connection delay
# UI dimensions
MIN_ROWS = 20
MIN_COLS = 80
INFO_WINDOW_HEIGHT = 12
INFO_WINDOW_Y = 2
OUTPUT_WINDOW_Y = 14
INPUT_WINDOW_HEIGHT = 2
OUTPUT_SCROLLBACK_LINES = 2000 # Output lines kept for PgUp/PgDn and redraw after resize
# Event deduplication
MAX_RECENT_EVENTS = 10
-4
View File
@@ -89,10 +89,6 @@ class RconConnection:
self.socket.send(command)
logger.info(f'Sent command: {command}')
def poll(self, timeout):
"""Poll for messages"""
return self.socket.poll(timeout)
def recv_message(self):
"""Receive a message (non-blocking)"""
try:
+1
View File
@@ -173,6 +173,7 @@ def create_example_config():
config_content = """# qlpycon.conf
# Edit this file as needed.
#
# Pick from a menu: qlpycon
# Connect by server name: qlpycon ffa
# Connect directly: qlpycon --host tcp://1.2.3.4:28960 --password secret
# List servers: qlpycon --list
+580 -582
View File
File diff suppressed because it is too large Load Diff