Add Paint icon ANSI art to Help > About Paint

This commit is contained in:
Isaiah Odhner 2023-06-08 02:47:37 -04:00
parent b1951cb555
commit 7e30f39374
8 changed files with 48 additions and 9 deletions

View File

@ -0,0 +1,4 @@
 . \
\|/ 
 ▐ 
▌_│ 

View File

@ -0,0 +1,4 @@
 .▔▔▔▔▔◣ 
\|/  
 ▐▋  
▌▁▁▍  

View File

@ -0,0 +1,4 @@
 .▔▔▔▔▔◣ 
\|/ 🮝 
🮉 ▐▋  
🮈▁▁▍  

View File

@ -0,0 +1,4 @@
 .▔▔▔▔▔◣ 
╲┃ 🮝 
🮉 ▐▋  
🮈▁▁▍  

View File

@ -0,0 +1,4 @@
 .▔▔▔▔▔◣ 
\┃/ 🮝 
🮉 ▐▋  
🮈▁▁▍  

View File

@ -0,0 +1,4 @@
 .▔▔▔▔◣ 
\┃/ 🮝 
🮉 ▐▋  
🮈▁▁▍  

View File

@ -38,7 +38,7 @@ from pyfiglet import Figlet, FigletFont
from .menus import MenuBar, Menu, MenuItem, Separator
from .inspector import Inspector
from .windows import Window, DialogWindow, CharacterSelectorDialogWindow, MessageBox, get_warning_icon, get_question_icon
from .windows import Window, DialogWindow, CharacterSelectorDialogWindow, MessageBox, get_warning_icon, get_question_icon, get_paint_icon
from .file_dialogs import SaveAsDialogWindow, OpenDialogWindow
from .edit_colors import EditColorsDialogWindow
from .localization.i18n import get as _, load_language, remove_hotkey
@ -3412,12 +3412,7 @@ class PaintApp(App[None]):
def action_about_paint(self) -> None:
"""Show the About Paint dialog."""
self.close_windows("#about_paint_dialog")
window = DialogWindow(
id="about_paint_dialog",
title=_("About Paint"),
handle_button=lambda button: window.close(),
)
window.content.mount(Static(f"""🎨 [b]Textual Paint[/b]
message = Static(f"""🎨 [b]Textual Paint[/b]
[i]MS Paint in your terminal.[/i]
@ -3425,8 +3420,14 @@ class PaintApp(App[None]):
[b]Author:[/b] [link=https://isaiahodhner.io/]Isaiah Odhner[/link]
[b]License:[/b] [link=https://github.com/1j01/textual-paint/blob/main/LICENSE.txt]MIT[/link]
[b]Source Code:[/b] [link=https://github.com/1j01/textual-paint]github.com/1j01/textual-paint[/link]
"""))
window.content.mount(Button(_("OK"), classes="ok submit"))
""")
window = MessageBox(
id="about_paint_dialog",
title=_("About Paint"),
handle_button=lambda button: window.close(),
icon_widget=get_paint_icon(),
message=message,
)
self.mount(window)
def action_toggle_inspector(self) -> None:

View File

@ -592,6 +592,20 @@ question_icon_console_markup = question_icon_console_markup.replace("rgb(0,0,0)"
# question_icon_console_markup = question_icon_console_markup.replace("", "[u][/u]")
get_question_icon = lambda: Static(question_icon_console_markup, classes="question_icon message_box_icon")
# NOTE: I had to manually replace "\" with "\\\\" in the markup below.
# One level of escaping because this is a string literal, and another level because
# Text.markup fails to escape backslashes:
# https://github.com/Textualize/rich/issues/2993
paint_icon_console_markup = """
[rgb(128,128,128) on rgb(255,0,255)] [rgb(0,0,0) on rgb(255,255,255)][/rgb(128,128,128) on rgb(255,0,255)].[rgb(128,128,128) on rgb(255,255,255)][/rgb(0,0,0) on rgb(255,255,255)][rgb(128,128,128) on rgb(255,255,255)][/rgb(128,128,128) on rgb(255,255,255)][rgb(128,128,128) on rgb(255,255,255)][/rgb(128,128,128) on rgb(255,255,255)][rgb(128,128,128) on rgb(255,255,255)][/rgb(128,128,128) on rgb(255,255,255)][rgb(255,255,255) on rgb(255,0,255)][/rgb(128,128,128) on rgb(255,255,255)][/rgb(255,255,255) on rgb(255,0,255)]
[rgb(0,0,255) on rgb(255,0,255)]\\\\[rgb(255,0,0) on rgb(255,255,255)][/rgb(0,0,255) on rgb(255,0,255)][rgb(255,255,0) on rgb(255,255,255)][/rgb(255,0,0) on rgb(255,255,255)]/[rgb(0,0,0) on rgb(255,255,255)][/rgb(255,255,0) on rgb(255,255,255)] [rgb(0,0,0) on rgb(255,255,255)][/rgb(0,0,0) on rgb(255,255,255)] [rgb(0,0,0) on rgb(255,255,255)][/rgb(0,0,0) on rgb(255,255,255)] [rgb(128,128,128) on rgb(255,255,255)][/rgb(0,0,0) on rgb(255,255,255)]🮝[/rgb(128,128,128) on rgb(255,255,255)]
[rgb(255,255,255) on rgb(255,0,255)]🮉[rgb(0,0,0) on rgb(255,255,255)][/rgb(255,255,255) on rgb(255,0,255)] [rgb(192,192,192) on rgb(255,255,255)][/rgb(0,0,0) on rgb(255,255,255)][rgb(128,128,128) on rgb(255,255,255)][/rgb(192,192,192) on rgb(255,255,255)][rgb(0,0,0) on rgb(255,255,255)][/rgb(128,128,128) on rgb(255,255,255)] [rgb(0,0,0) on rgb(255,255,255)][/rgb(0,0,0) on rgb(255,255,255)] [rgb(0,0,0) on rgb(255,255,255)][/rgb(0,0,0) on rgb(255,255,255)] [/rgb(0,0,0) on rgb(255,255,255)]
[rgb(192,192,192) on rgb(255,0,255)]🮈[rgb(0,0,0) on rgb(255,255,255)][/rgb(192,192,192) on rgb(255,0,255)][rgb(0,0,0) on rgb(255,255,255)][/rgb(0,0,0) on rgb(255,255,255)][rgb(0,0,0) on rgb(255,255,255)][/rgb(0,0,0) on rgb(255,255,255)][rgb(0,0,0) on rgb(255,255,255)][/rgb(0,0,0) on rgb(255,255,255)] [rgb(0,0,0) on rgb(255,255,255)][/rgb(0,0,0) on rgb(255,255,255)] [rgb(0,0,0) on rgb(255,255,255)][/rgb(0,0,0) on rgb(255,255,255)] [/rgb(0,0,0) on rgb(255,255,255)]
"""
# make fuchsia transparent
paint_icon_console_markup = paint_icon_console_markup.replace(" on rgb(255,0,255)", "")
get_paint_icon = lambda: Static(paint_icon_console_markup, classes="paint_icon message_box_icon")
class MessageBox(DialogWindow):
"""A simple dialog window that displays a message, a group of buttons, and an optional icon."""