- DRY: Make decode_based_on_file_extension use format_from_extension.
- If you try to load .html, .htm, .svg, (or ._rich_console_markup) file,
show an error instead of loading as text. The text would be much
larger than a document you saved in this format, and it wouldn't give
you what you expect, unless you're wanting to load an arbitrary text
file for viewing, and for some reason choose this program to do it.
Within the span of like a day I forgot that FIGlet fonts can be
proportional and came back to this code and was confused why charWidth
needs to be a dictionary. Well it doesn't NEED to be, it could be
implemented differently, for instance by fixing the height first,
it wouldn't need to calculate a number of spaces for the blank lines —
but how it's implemented, the width fixup could be disabled, and the
height fixup would still work. So even though the code would be a little
simpler, I'm not sure it would be better that way.
I created the workspace in order to be able to quickly search within
the textual library as easily as my own code, but now that I'm using
a virtual environment, I can search within all my dependencies easily,
and they're lower priority, being in a subfolder, which is what I want.
It was annoying when typing "README" and the top result being
"richreadme.md" from textual. So this is a much improved situation!
This is a first draft (or first 13 versions) of an ANSI art rendition of
MS Paint's transparent/opaque option selector used for the Select and
Text tools.
A somewhat silly smattering of notes:
- Emoji representation: 🛢️🔴🧊 or 🛢️🔴🟩
- More symbols considered (and some used):
⛀⛁⛃🛢️⬬
▰𝄰ᐟ⸍⸝🧊
╭╮🔴⏺◖◗
╰╯
- The red circle seems really unreliable so I don't think I can use it.
- Overlapping the red circle/sphere object is hard to represent!
- I managed to get something fairly legible in Ubuntu's terminal,
not so much in VS Code. VS Code is harder; I might've modified some
settings, I don't know, but it doesn't handle semigraphics as well,
at least not on my computer. But...
- At least if you've used MS Paint before, you can recognize the general
color/shape profile of the icons, if not parse out what the icons are
meant to represent if you'd never looked closely at them before.
- I'm not sure if v12 or v13 is better. I moved the right border to the
right a bit by making it Braille, but should the corners extend
further right then (with two dots), or mirror the left border by using
a single dot Braille character?
- UnicodeDecodeError was caught in a more general error handler;
now it's allowed to reach the more specific handler.
- UnidentifiedImageError and FormatReadNotSupported were missing return;
now it's not caught there so it doesn't need to, as the exception will
interrupt the control flow.
They usually correspond very closely, like .png -> PNG, but are
are more distinct for some formats, like .jp2 -> JPEG2000.
- Handle formats like JPEG2000 that differ in name from the extension.
- Bring my own file ext handling in line with PIL: use dotted lowercase.
- Raise an exception when a file format is detected but not supporting
for reading or for writing, depending on the attempted operation.
I used this regexp to search for multi-line docstrings: """.*(?<!""")\n
Here's a regexp to search for class docstrings: class .*\n\s*"""
in case that's useful later.