Refactor --ascii-only argument plumbing

Query for the argument instead of patching values in from outside.
This commit is contained in:
Isaiah Odhner 2023-09-04 14:36:36 -04:00
parent ad83dee949
commit 47468d1c06
2 changed files with 5 additions and 12 deletions

View File

@ -49,7 +49,7 @@ from .graphics_primitives import (
flood_fill, flood_fill,
) )
from .menus import MenuBar, Menu, MenuItem, Separator from .menus import MenuBar, Menu, MenuItem, Separator
from .windows import Window, DialogWindow, CharacterSelectorDialogWindow, MessageBox, WindowTitleBar, get_warning_icon, get_question_icon, get_paint_icon from .windows import Window, DialogWindow, CharacterSelectorDialogWindow, MessageBox, get_warning_icon, get_question_icon, get_paint_icon
from .file_dialogs import SaveAsDialogWindow, OpenDialogWindow from .file_dialogs import SaveAsDialogWindow, OpenDialogWindow
from .edit_colors import EditColorsDialogWindow from .edit_colors import EditColorsDialogWindow
from .localization.i18n import get as _, load_language, remove_hotkey from .localization.i18n import get as _, load_language, remove_hotkey
@ -5240,13 +5240,6 @@ if args.ascii_only:
from .ascii_borders import force_ascii_borders from .ascii_borders import force_ascii_borders
force_ascii_borders() force_ascii_borders()
# Adjust icons
WindowTitleBar.MINIMIZE_ICON = "_" # was originally: "🗕"
WindowTitleBar.MAXIMIZE_ICON = "" # was originally: "🗖" # not technically ASCII; could use "^" or "[]"
WindowTitleBar.RESTORE_ICON = "" # was originally: "🗗" # not technically ASCII; could use "^" or "%" or "#"
WindowTitleBar.CLOSE_ICON = "X" # was originally: "🗙"
# `textual run --dev src.textual_paint.paint` will search for a # `textual run --dev src.textual_paint.paint` will search for a
# global variable named `app`, and fallback to # global variable named `app`, and fallback to

View File

@ -19,10 +19,10 @@ from .args import args
class WindowTitleBar(Container): class WindowTitleBar(Container):
"""A title bar widget.""" """A title bar widget."""
MINIMIZE_ICON = "🗕" MINIMIZE_ICON = "_" if args.ascii_only else "🗕"
MAXIMIZE_ICON = "🗖" MAXIMIZE_ICON = "" if args.ascii_only else "🗖" # not technically ASCII; could use "^" or "[]"
RESTORE_ICON = "🗗" RESTORE_ICON = "" if args.ascii_only else "🗗" # not technically ASCII; could use "^" or "%" or "#"
CLOSE_ICON = "🗙" CLOSE_ICON = "X" if args.ascii_only else "🗙"
title = var("") title = var("")