mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-01 10:22:08 +00:00
fix(oci): keep the name the page width of an application is read by
The width of the description keeps the name the script tests give it; the width of the window has its own.
This commit is contained in:
@@ -27,7 +27,7 @@ from .installer import (
|
||||
run_remote_install,
|
||||
run_remote_rclone_mount,
|
||||
)
|
||||
from .ui import APP_TITLE, DETAIL_WIDTH, UserCancelled, interactive_ui
|
||||
from .ui import APP_TITLE, DETAIL_WINDOW_WIDTH, UserCancelled, interactive_ui
|
||||
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
||||
@@ -116,7 +116,7 @@ def _yes_no(value: Any) -> str:
|
||||
# ---------------------------------------------------------------- summaries
|
||||
|
||||
# The description fits the page of the application, inside its borders.
|
||||
DETAIL_TEXT_WIDTH = DETAIL_WIDTH - 6
|
||||
DETAIL_WIDTH = DETAIL_WINDOW_WIDTH - 6
|
||||
SERVICE_KINDS = (("postgres", "PostgreSQL"), ("valkey", "Valkey"), ("redis", "Redis"), ("mariadb", "MariaDB"),
|
||||
("mysql", "MySQL"), ("mongo", "MongoDB"), ("meilisearch", "Meilisearch"))
|
||||
|
||||
@@ -161,7 +161,7 @@ def _app_detail_text(catalog: Catalog, item: dict[str, Any], template: dict[str,
|
||||
# drifting, and it goes through translate() like every other string.
|
||||
description = translate(source_text(ui.get("tagline")) or source_text(ui.get("description")))
|
||||
if description:
|
||||
wrapped = textwrap.wrap(description, DETAIL_TEXT_WIDTH)
|
||||
wrapped = textwrap.wrap(description, DETAIL_WIDTH)
|
||||
if len(wrapped) > 8:
|
||||
wrapped = wrapped[:8]
|
||||
wrapped[-1] = wrapped[-1].rstrip(" .,;") + "…"
|
||||
|
||||
@@ -191,7 +191,7 @@ class TerminalUI:
|
||||
# final summary and the page of an application, which show tables, are wider.
|
||||
MENU_WIDTH = 72
|
||||
SUMMARY_WIDTH = 78
|
||||
DETAIL_WIDTH = 90
|
||||
DETAIL_WINDOW_WIDTH = 90
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -302,7 +302,7 @@ class DialogUI:
|
||||
"""A tall menu under a block of information. When the information does
|
||||
not fit on screen it is shown first in a scrollable box."""
|
||||
terminal = shutil.get_terminal_size((100, 30))
|
||||
width = min(terminal.columns - 4, DETAIL_WIDTH)
|
||||
width = min(terminal.columns - 4, DETAIL_WINDOW_WIDTH)
|
||||
text_lines = sum(max(1, len(textwrap.wrap(line, width - 6) or [""])) for line in text.splitlines() or [""])
|
||||
available = terminal.lines - 2
|
||||
needed = text_lines + len(options) + 9
|
||||
|
||||
Reference in New Issue
Block a user