mirror of
https://github.com/1j01/textual-paint.git
synced 2024-09-11 15:56:03 +03:00
ASCIItize more UI in --ascii-only mode
This commit is contained in:
parent
47468d1c06
commit
ed40ed70c2
@ -16,6 +16,7 @@ from textual.containers import Container
|
||||
|
||||
from .localization.i18n import get as _
|
||||
from .windows import DialogWindow
|
||||
from .args import args
|
||||
|
||||
|
||||
# https://github.com/kouzhudong/win2k/blob/ce6323f76d5cd7d136b74427dad8f94ee4c389d2/trunk/private/shell/win16/comdlg/color.c#L38-L43
|
||||
@ -191,7 +192,7 @@ class LuminosityRamp(Widget):
|
||||
|
||||
def render_line(self, y: int) -> Strip:
|
||||
"""Render a line of the widget."""
|
||||
marker = "◀" # ◀ (bigger/clearer) or 🢐 (closer shape but smaller)
|
||||
marker = "<" if args.ascii_only else "◀" # ◀ (bigger/clearer) or 🢐 (closer shape but smaller)
|
||||
# lum = y / self.size.height # bottom isn't quite white
|
||||
lum = 1 - y / (self.size.height - 1)
|
||||
color = Color.from_hsl(self.hue, self.saturation, lum)
|
||||
@ -248,7 +249,7 @@ class ColorField(Widget):
|
||||
def render_line(self, y: int) -> Strip:
|
||||
"""Render a line of the widget."""
|
||||
segments: list[Segment] = []
|
||||
crosshair = "✜" # Options: ┼+✜✛⊹✚╋╬⁘⁛⌖⯐ or
|
||||
crosshair = "+" if args.ascii_only else "✜" # Options: ┼+✜✛⊹✚╋╬⁘⁛⌖⯐ or
|
||||
# ╻
|
||||
# ╺ ╸
|
||||
# ╹
|
||||
|
@ -10,6 +10,7 @@ from textual.dom import NoScreen
|
||||
from rich.text import Text
|
||||
|
||||
from .localization.i18n import markup_hotkey, get_hotkey, get_direction
|
||||
from .args import args
|
||||
|
||||
def to_snake_case(name: str) -> str:
|
||||
name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
|
||||
@ -169,8 +170,9 @@ class Menu(Container):
|
||||
# and has to be idempotent.
|
||||
# Basically I should rewrite this whole thing.
|
||||
# I'd like to try using the built-in ListView widget for menus.
|
||||
if not item.label.plain.endswith("▶"):
|
||||
item.label = item.label.markup + "\t ▶"
|
||||
arrow = ">" if args.ascii_only else "▶"
|
||||
if not item.label.plain.endswith(arrow):
|
||||
item.label = item.label.markup + "\t " + arrow
|
||||
# Split on tab character and align the shortcuts
|
||||
for item in self.items:
|
||||
if isinstance(item, MenuItem):
|
||||
@ -245,7 +247,7 @@ class MenuItem(Button):
|
||||
self.post_message(Menu.StatusInfo(None))
|
||||
|
||||
|
||||
mid_line = "─" * 100
|
||||
mid_line = ("-" if args.ascii_only else "─") * 100
|
||||
class Separator(Static):
|
||||
"""A menu separator widget."""
|
||||
|
||||
|
@ -1959,11 +1959,11 @@ class Canvas(Widget):
|
||||
# Plus this lets the grid be more subtle, visually taking up less than a cell.
|
||||
fg = "#c0c0c0" if (x + y) % 2 == 0 else "#808080"
|
||||
if x % self.magnification == 0 and y % self.magnification == 0:
|
||||
ch = "▛" # "┼" # (🭽 may render as wide)
|
||||
ch = "+" if args.ascii_only else "▛" # "┼" # (🭽 may render as wide)
|
||||
elif x % self.magnification == 0:
|
||||
ch = "▌" # "┆" # (▏, not 🭰)
|
||||
ch = "|" if args.ascii_only else "▌" # "┆" # (▏, not 🭰)
|
||||
elif y % self.magnification == 0:
|
||||
ch = "▀" # "┄" # (▔, not 🭶)
|
||||
ch = "-" if args.ascii_only else "▀" # "┄" # (▔, not 🭶)
|
||||
style = Style(color=fg, bgcolor=bg)
|
||||
assert style.color is not None
|
||||
assert style.bgcolor is not None
|
||||
|
Loading…
Reference in New Issue
Block a user