Hardware fixes: issue version, installer Cyrillic, console TUIs (0.9.2)
build / build (push) Canceled after 0s
build / build (push) Canceled after 0s
- /etc/issue shows the Das OS version instead of the kernel's; the server installer carries it into the installed system. - das-server-installer: setfont -C /dev/tty0 before the language menu (sudo runs it in its own pty, so the Cyrillic was drawn as Latin), and floppy drives are no longer offered as install targets. - ncdu on the desktop image and in das-server 0.4.0. - das-shell 0.2.0: each prompt line sets its own color; the dbanner start screen buttons are no longer covered by the key bar; on the Linux console (TERM=linux) dprompt and dbanner draw solid borders and swap the glyphs that no console font has (▊▎▔▁ and others) for ones it has. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,9 +15,39 @@ from textual.widgets import Button, Input, Label, Select
|
||||
|
||||
from . import colors
|
||||
from .i18n import t
|
||||
from .prompt import CONSOLE_GLYPHS as PROMPT_CONSOLE_GLYPHS
|
||||
|
||||
NONE = "-" # Select has no None value
|
||||
|
||||
# The Linux console's fonts hold at most 512 glyphs (cyr-sun16, Terminus: none has
|
||||
# the eighth blocks ▊▎▔▁ Textual draws buttons, inputs and lists with), so the
|
||||
# missing ones come out as squares. There we draw with what the fonts do have.
|
||||
CONSOLE = os.environ.get("TERM") == "linux"
|
||||
CONSOLE_BORDERS = ("tall", "wide", "panel", "tab", "hkey", "vkey", "round", "heavy", "dashed", "inner", "outer")
|
||||
CONSOLE_GLYPHS = str.maketrans({
|
||||
**PROMPT_CONSOLE_GLYPHS,
|
||||
"▁": "▄", "▂": "▄", "▃": "▄", "▅": "▄", "▆": "▄", "▇": "█", "▔": "▀", "▉": "█",
|
||||
"▊": "▌", "▋": "▌", "▍": "▌", "▎": "▌", "▏": "▌", "▕": "▐",
|
||||
"━": "─", "╸": "─", "╺": "─", "┃": "│", "┏": "┌", "┓": "┐", "┗": "└", "┛": "┘",
|
||||
"╭": "┌", "╮": "┐", "╰": "└", "╯": "┘", "╱": "/", "╲": "\\",
|
||||
"—": "-", "…": ".", "×": "x", "✕": "x", "✓": "v", "☑": "x", "○": "o", "⭘": "o", "◢": "▀",
|
||||
})
|
||||
|
||||
|
||||
def console_mode():
|
||||
"""On the Linux console: swaps the borders and glyphs its fonts lack. Call
|
||||
before the app starts."""
|
||||
if not CONSOLE:
|
||||
return
|
||||
from textual import _border
|
||||
from textual.drivers.linux_driver import LinuxDriver
|
||||
for kind in CONSOLE_BORDERS:
|
||||
_border.BORDER_CHARS[kind] = _border.BORDER_CHARS["solid"]
|
||||
_border.BORDER_LOCATIONS[kind] = _border.BORDER_LOCATIONS["solid"]
|
||||
_border.get_box.cache_clear()
|
||||
write = LinuxDriver.write
|
||||
LinuxDriver.write = lambda self, data: write(self, data.translate(CONSOLE_GLYPHS))
|
||||
|
||||
|
||||
def color_options(allow_none=True):
|
||||
names = {
|
||||
|
||||
Reference in New Issue
Block a user