textual-paint/README.md

441 lines
23 KiB
Markdown
Raw Normal View History

2023-04-10 23:51:39 +03:00
2023-04-15 04:30:34 +03:00
Textual Paint
2023-04-10 23:51:39 +03:00
=============
2023-04-15 04:30:34 +03:00
MS Paint in your terminal.
2023-04-10 23:51:39 +03:00
2023-04-15 04:30:34 +03:00
This is a TUI (Text User Interface) image editor, inspired by MS Paint, built with [Textual](https://textual.textualize.io/).
2023-04-10 23:51:39 +03:00
![MS Paint like interface](https://raw.githubusercontent.com/1j01/textual-paint/v0.1.0/screenshot.svg)
Add textual screenshot to readme This took a lot of trial and error to get this working. - First I had to figure out how to copy the terminal output as HTML. I had to configure keybindings for Select All and Copy As HTML in the Ubuntu terminal. - GitHub doesn't support line-height in markdown, so I came up with using an SVG with <foreignObject> to contain the screenshot HTML. - GitHub doesn't support inline SVG, so I had to use <img>, that's fine. An external file is cleaner anyways. - I spent a long time trying to fix the seams between rows of text. `line-height: <font-size>` is not `line-height: 1`! I think I tried `line-height: 1` first, but it wasn't working for some reason so I tried a bajillion things, having mentally discounted it, before circling back to it and trying it again and it actually worked. - I spent a long time futzing about with SVG viewports and units. - The text was staggered due to some of the Unicode characters, so I developed a script to fix that up. I managed to achieve a nice development cycle for this, but only near the end of developing it. Most of the time while working on it I was copying and pasting the updated code into the console after hitting up up enter to re-run grapheme-splitter's JS. The next commit will apply this script. - All in all, getting this screenshot working took basically all day! Compare that to my first day of progress on this project, having never used the Textual framework before, and also having not used Python for a while. In summary, coding is a land of contrasts. - VS Code's markdown rendering isn't working with the ch/lh units.
2023-04-14 09:21:27 +03:00
2023-04-13 17:06:39 +03:00
## Features
2023-04-18 10:43:45 +03:00
- [x] Open and save images
- [x] Fancy file dialogs
2023-05-01 19:31:21 +03:00
- [x] Drag and drop files to open
2023-04-18 10:43:45 +03:00
- [x] Warnings when overwriting an existing file, or closing with unsaved changes
2023-07-24 23:15:11 +03:00
- [x] Auto-saves a temporary `.ans~` backup file alongside the file you're editing, for crash recovery
- [x] Edits ANSI art and raster images and more. See [File Formats](#file-formats)
2023-07-24 23:15:11 +03:00
- [x] All tools from MS Paint: Free-Form Select, Select, Eraser/Color Eraser, Fill With Color, Pick Color, Magnifier, Pencil, Brush, Airbrush, Text, Line, Curve, Rectangle, Polygon, Ellipse, and Rounded Rectangle
2023-04-13 17:06:39 +03:00
- [x] Color palette
- [x] Efficient screen updates and undo/redo history, by tracking regions affected by each action
2023-07-24 23:15:11 +03:00
- [x] You should be able to use this over SSH
2023-04-14 03:28:58 +03:00
- [x] Brush previews
2023-04-24 23:46:32 +03:00
- [x] Status bar
2023-07-24 23:15:11 +03:00
- [x] Menu bar
2023-04-24 23:46:32 +03:00
- [x] Keyboard shortcuts
2023-07-24 23:15:11 +03:00
- [x] Nearly every command from MS Paint is supported, including fun ones like:
- [x] Flip/Rotate
- [x] Stretch/Skew
- [x] Edit Colors
- [x] Set As Wallpaper (Tiled/Centered)
- [x] Localization into 26 languages: Arabic, Czech, Danish, German, Greek, English, Spanish, Finnish, French, Hebrew, Hungarian, Italian, Japanese, Korean, Dutch, Norwegian, Polish, Portuguese, Brazilian Portuguese, Russian, Slovak, Slovenian, Swedish, Turkish, Chinese, Simplified Chinese
2023-07-11 06:02:04 +03:00
- [x] Dark mode
- [x] Zooming works with text, despite running in the terminal :)
2023-04-10 23:51:39 +03:00
2023-04-17 02:25:02 +03:00
## Usage
2023-07-21 22:56:33 +03:00
Python 3.10 or later is required. See [Compatibility](#compatibility) for details on terminals supported.
### Installation
2023-04-17 02:25:02 +03:00
Use `pipx` to install globally, without installing dependencies globally:
```bash
pip install --upgrade pipx # or in Arch Linux, sudo pacman -S python-pipx
pipx install textual-paint
```
Alternatively, you can install using `pip`:
2023-04-17 02:25:02 +03:00
```bash
pip install textual-paint
```
### Running
```bash
textual-paint
2023-07-21 22:56:33 +03:00
```
2023-04-17 02:25:02 +03:00
### Command Line Options
```
2023-07-21 22:56:33 +03:00
$ textual-paint --help
usage: textual-paint [options] [filename]
2023-04-17 02:25:02 +03:00
Paint in the terminal.
positional arguments:
2023-05-06 02:56:36 +03:00
filename Path to a file to open. File will be created if it
doesn't exist.
2023-04-17 02:25:02 +03:00
options:
-h, --help show this help message and exit
2023-04-30 00:50:03 +03:00
--version show program's version number and exit
--theme {light,dark} Theme to use, either "light" or "dark"
2023-04-18 10:43:45 +03:00
--language {ar,cs,da,de,el,en,es,fi,fr,he,hu,it,ja,ko,nl,no,pl,pt,pt-br,ru,sk,sl,sv,tr,zh,zh-simplified}
Language to use
2023-07-16 06:05:41 +03:00
--ascii-only-icons Use only ASCII characters for tool icons, no emoji or
other Unicode symbols
2023-08-30 21:54:19 +03:00
--ascii-only Use only ASCII characters for the entire UI, for use in
older terminals. Implies --ascii-only-icons
2023-05-06 03:40:09 +03:00
--backup-folder FOLDER
Folder to save backups to. By default a backup is saved
alongside the edited file.
2023-09-06 00:57:03 +03:00
development options:
--inspect-layout Enables DOM inspector (F12) and middle click highlight
--clear-screen Clear the screen before starting, to avoid seeing
outdated errors
--restart-on-changes Restart the app when the source code is changed
2023-04-17 02:25:02 +03:00
```
### Keyboard Shortcuts
- <kbd>Ctrl</kbd>+<kbd>D</kbd>: Toggle Dark Mode
- <kbd>Ctrl</kbd>+<kbd>Q</kbd>: Quit
- <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd>: Save As **IF SHIFT IS DETECTED** — ⚠️ it might trigger Save instead, and overwrite the open file!
- <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd>: Redo **IF SHIFT IS DETECTED** — ⚠️ it might trigger Undo instead.
2023-04-17 02:25:02 +03:00
The rest match MS Paint's keyboard shortcuts:
- <kbd>Ctrl</kbd>+<kbd>S</kbd>: Save
- <kbd>Ctrl</kbd>+<kbd>O</kbd>: Open
- <kbd>Ctrl</kbd>+<kbd>N</kbd>: New
- <kbd>Ctrl</kbd>+<kbd>T</kbd>: Toggle Tools Box
- <kbd>Ctrl</kbd>+<kbd>W</kbd>: Toggle Colors Box
- <kbd>Ctrl</kbd>+<kbd>Z</kbd>: Undo
- <kbd>Ctrl</kbd>+<kbd>Y</kbd>: Redo
- <kbd>F4</kbd>: Redo
2023-04-23 08:09:19 +03:00
- <kbd>Ctrl</kbd>+<kbd>A</kbd>: Select All
2023-05-10 08:34:46 +03:00
- <kbd>Delete</kbd>: Clear Selection
- <kbd>Ctrl</kbd>+<kbd>C</kbd>: Copy
- <kbd>Ctrl</kbd>+<kbd>V</kbd>: Paste
- <kbd>Ctrl</kbd>+<kbd>X</kbd>: Cut
- <kbd>Ctrl</kbd>+<kbd>E</kbd>: Image Attributes
- <kbd>Ctrl</kbd>+<kbd>PageUp</kbd>: Large Size
- <kbd>Ctrl</kbd>+<kbd>PageDown</kbd>: Normal Size
2023-04-17 02:25:02 +03:00
### File Formats
2023-09-06 03:11:32 +03:00
<!-- PyPI doesn't generate linkable headings -->
<a id="file-formats"></a>
Many file formats are supported, including ANSI art, raster images, SVG and HTML.
To choose a file format when saving, type its file extension. For example, to save a PNG, add `.png` to the end of the filename. The default is `.ans`.
| Format | Notes |
| --- | --- |
| **ANSI** (.ans) | Note that while it handles many more ANSI control codes when loading than those that it uses to save files, you may have limited success loading other ANSI files that you find on the web, or create with other tools. ANSI files can vary a lot and even encode animations! |
| **mIRC codes** (.irc, .mirc) | invented file extensions, and not to be confused with .mrc mIRC script files |
| **Plain Text** (.txt) | |
| **SVG** (.svg) | can open SVGs saved by Textual Paint, which embed ANSI data; can also open some other SVGs that consist of a grid of rectangles and text elements. For fun, as a challenge, I made it quite flexible; it can handle uneven grids of unsorted rectangles. But that's only used as a fallback, because it's not perfect. |
| **HTML** (.htm, html) | write-only (opening not supported) |
| **PNG** (.png) | opens first frame of an APNG file |
| **Bitmap** (.bmp) | |
| **GIF** (.gif) | opens first frame |
| **TIFF** (.tiff) | opens first frame |
| **WebP** (.webp) | opens first frame |
| **JPEG** (.jpg, .jpeg) | saving disabled because it's lossy (it would destroy your pixel art) |
| **Windows Icon** (.ico) | opens largest size in the file |
| **Mac OS Icon** (.icns) | opens largest size in the file; saving disabled because it requires specific sizes |
| **Windows Cursor** (.cur) | opens largest size in the file; saving not supported by Pillow (and it would need a defined hot spot) |
See [Pillow's documentation](https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html) for more supported formats.
Note that metadata is not preserved when opening and saving image files. This is however common for many image editors.
2023-04-25 19:49:00 +03:00
### Tips
2023-04-25 06:43:38 +03:00
You can draw with a character by clicking the selected color display area in the palette and then typing the character,
2023-04-29 23:52:03 +03:00
or by double clicking the same area to pick a character from a list.
2023-04-25 06:43:38 +03:00
You can set the text color by right clicking or holding <kbd>Ctrl</kbd> while clicking a color in the palette.
Also, if you double right click or hold <kbd>Ctrl</kbd> while double clicking on a color to open the Edit Colors dialog,
if will edit the text color when you click OK.
You can swap the foreground and background colors by right clicking or holding <kbd>Ctrl</kbd> while clicking the current colors area.
2023-09-06 03:11:32 +03:00
This is a great convenience, especially when using the Color Eraser tool, or when using custom colors that may be hard to distinguish.
2023-04-25 06:43:38 +03:00
You can display a saved ANSI file in the terminal with `cat`:
```bash
cat samples/ship.ans
2023-04-25 06:43:38 +03:00
```
2023-09-07 00:45:51 +03:00
To browse the sample art, run:
2023-05-16 22:19:23 +03:00
```bash
python -m src.textual_paint.gallery
2023-05-16 22:19:23 +03:00
```
To preview ANSI art files in file managers like Nautilus, Thunar, Nemo, or Caja, you can install the [ansi-art-thumbnailer](https://github.com/1j01/ansi-art-thumbnailer) program I made to go along with this project.
2023-05-16 22:19:23 +03:00
2023-04-24 23:46:32 +03:00
## Known Issues
2023-07-21 22:56:33 +03:00
- Undo/Redo doesn't work inside the Text tool's textbox. <kbd>Ctrl</kbd>+<kbd>Z</kbd> will delete the textbox. (Also note that the Text tool works differently from MS Paint; it will overwrite characters and the cursor can move freely, which makes it better for ASCII art, but worse for prose.)
2023-04-30 00:11:47 +03:00
- The selection box border appears inside instead of outside (and lacks dashes). For the text box, I hid the border because it was too visually confusing, but it should also have an outer border.
2023-07-21 22:56:33 +03:00
- Pressing both mouse buttons stops the current tool, but doesn't undo the current action. Also Pick Color can't be cancelled (with <kbd>Esc</kbd> or by pressing both mouse buttons), since it samples the color continuously.
- Due to limitations of the terminal, shortcuts using <kbd>Shift</kbd> or <kbd>Alt</kbd> might not work. Menus are not keyboard navigable, because I can't detect <kbd>Alt</kbd>+<kbd>F</kbd>, etc.
2023-05-04 23:01:10 +03:00
- The canvas flickers when zooming in with the Magnifier tool.
2023-04-24 23:46:32 +03:00
- Some languages don't display correctly.
- Large files can make the program very slow, as can magnifying the canvas. There is a 500 KB limit when opening files to prevent it from freezing.
2023-07-21 22:56:33 +03:00
- The status bar description can be left blank when selecting a menu item. (I think the `Leave` event can come after closing, once the mouse moves.)
2023-04-30 00:18:41 +03:00
- Menu items like Copy/Cut/Paste are not grayed out when inapplicable. Only unimplemented items are grayed out.
2024-11-04 22:46:19 +03:00
- Clicking Save As menu item scrolls down menu instead of activating it if there's not enough space to show the whole menu. (It seems to be scrolling the menu item to the top when it becomes focused during the click.)
- Worse, clicking Open can scroll down so that Save is under the mouse and trigger Save instead!
2024-11-04 22:46:19 +03:00
- Extraneous undo states may be created in some cases. In particular, I noticed when undoing/redoing with free-typing mode, the last state had no cursor but was otherwise identical.
2023-05-15 05:14:59 +03:00
- ANSI files (.ans) are treated as UTF-8 when saving and loading, rather than CP437 or Windows-1252 or any other encodings. Unicode is nice and modern terminals support it, but it's not the standard for ANSI files. There isn't really a standard for ANSI files.
- ANSI files are loaded with a white background. This may make sense as a default for text files, but ANSI files either draw a background or assume a black background, being designed for terminals.
2023-07-21 22:56:33 +03:00
- Hitting Enter in View Bitmap mode may trigger a menu item while exiting the mode. Menu items ought to be disabled when hidden, and View Bitmap should also prevent the key event from taking other actions if possible.
2024-11-04 22:46:19 +03:00
- Document recovery dialog is shown unnecessarily if the backup file is identical.
2023-07-11 06:02:04 +03:00
- Airbrush is continuous in space instead of time. It should keep spraying while the mouse stays still.
2023-07-21 22:56:33 +03:00
- Error messages may not show up when opening a file fails. I'm not sure how to reproduce this, so if you run into this, do let me know.
2024-11-04 22:46:19 +03:00
- Closing dialogs focuses the character input which is undesirable as it prevents typing in the canvas or copying the selection with <kbd>Ctrl</kbd>+<kbd>C</kbd> etc. (You can use <kbd>Esc</kbd> to reset focus.)
2023-07-12 22:41:43 +03:00
- Edit Colors dialog
- Focus ring shows even while grid is not focused
- Can show two cells as selected, instead of one across both grids
- Custom colors order X/Y is different from MS Paint
- Pressing enter in color grid should select color and close
- Selection ring is hard to see in dark mode
- Focus ring is invisible on a black color cell
- When dragging on the color field or luminosity slider, the cursor can be seen to jump back to earlier places where the mouse was, before settling at the current position. (This may only be visible when the program is running slowly, such while debugging. I haven't observed this on the canvas, so maybe it has something to do with the dialog being on a separate layer.)
- When opening the Edit Colors dialog, it may immediately close, if the mouse lines up with the "OK" or "Cancel" buttons. (This doesn't seem to currently happen, but I haven't knowingly fixed it. A git bisect turned up a bogus commit, possibly due to reproducing the behavior being unreliable. It also seems like it might depend on the specific layout of the dialog, which changed during development, and maybe even the terminal size.)
2023-04-25 21:10:59 +03:00
2023-07-17 22:19:23 +03:00
## Compatibility
2023-09-06 03:11:32 +03:00
<!-- PyPI doesn't generate linkable headings -->
<a id="compatibility"></a>
2023-07-17 22:19:23 +03:00
Python 3.10 or later is required.
### Linux
2023-09-01 06:09:28 +03:00
Tested on Ubuntu 22, with GNOME Terminal, Kitty, XTerm, and VS Code's integrated terminal.
2023-07-17 22:19:23 +03:00
GNOME Terminal works best, with crisp triangles used for icons in dialogs, emoji support, and true color support.
2023-09-01 06:09:28 +03:00
Kitty works fine, supporting true color and emoji.
XTerm supports true color, but not emoji. Run with `COLORTERM=truecolor textual-paint --ascii-only` for XTerm compatibility.
2023-09-01 06:09:28 +03:00
2023-07-17 22:19:23 +03:00
### macOS
Tested on OSX 10.14 (Mojave), with iTerm2, and VS Code's integrated terminal.
2023-07-21 01:52:42 +03:00
In VS Code, Free-Form Select shows as tofu (a missing character symbol).
2023-07-17 22:19:23 +03:00
2023-07-21 01:52:42 +03:00
The default Terminal has missing characters, causing misalignment of everything to the right of them, plus borders are not rendered nicely, giving it a sort of *frayed fabric* look, and it's limited to 256 colors.
2023-07-17 22:19:23 +03:00
### Windows
Textual Paint works with the new [Windows Terminal](https://learn.microsoft.com/windows/terminal/install).
2023-07-17 22:19:23 +03:00
#### Pasting in Windows Terminal
[<kbd>Ctrl</kbd>+<kbd>V</kbd> does not work](https://github.com/microsoft/terminal/issues/11267) to paste by default, but **Edit > Paste** does work.
You can unbind <kbd>Ctrl</kbd>+<kbd>V</kbd> to fix this:
- Open Windows Terminal's Settings (<kbd>Ctrl</kbd>+<kbd>,</kbd>)
- Click "Open JSON file"
- Disable the paste binding by adding `//` to the beginning of the lines:
```json
// {
// "command": "paste",
// "keys": "ctrl+v"
// },
```
- Save the file, and the behavior should update immediately.
Alternatively, you can use the Actions tab of the Settings UI to remove the binding for <kbd>Ctrl</kbd>+<kbd>V</kbd>.
If you're wondering why *removing* the Paste binding fixes it, it's because Textual Paint needs to receive the literal <kbd>Ctrl</kbd>+<kbd>V</kbd> key presses in order to trigger its own Paste command.
#### Powershell Problems
Running in Powershell, you may run into a bug where the powershell prompt becomes active at the same time as the TUI.
Moving the mouse will redraw parts of the TUI, and it becomes hard to click on things, but still possible.
Commands can be entered, and the output will be interwoven with the TUI, including if you run a second instance of the program, in which case the two instances will vie for the screen.
If this happens, I would recommend first messing around with it, since it's a fun glitch, then opening a new tab in Windows Terminal with the **Command Prompt profile**, available in the new tab dropdown menu.
#### Windows Console
2023-07-21 22:56:33 +03:00
Textual Paint will **not** work properly with the old Windows console (`conhost.exe`), which lacks emoji/Unicode support and true color support.
This program is commonly thought of as the "Command Prompt", but the Command Prompt (`cmd.exe`) is actually a *shell* (like `bash`) that can run in either the old console or the new Windows Terminal, which are both *terminal emulators*.
2023-07-17 22:19:23 +03:00
2023-09-01 06:09:28 +03:00
You can run with `--ascii-only` to limit the characters used in the UI to ASCII, but colors will still be limited and similar colors will appear confusingly identical.
2023-07-17 22:19:23 +03:00
### VS Code
Note that VS Code's integrated terminal tries to fix the contrast of text, including in the canvas, which is entirely inappropriate for an ANSI art editor, as it obscures the colors, and can indeed *harm* the contrast of the resulting document, by tricking you into thinking there's more contrast than there actually is.
To disable this, you can add this to your settings.json:
```json
"terminal.integrated.minimumContrastRatio": 1
```
2023-07-21 22:04:24 +03:00
If this doesn't work, try increasing it to 1.1.
2023-07-17 22:19:23 +03:00
2023-04-24 23:46:32 +03:00
2023-04-10 23:51:39 +03:00
## Development
2023-09-06 03:11:32 +03:00
First, create a virtual environment, and activate it:
2023-06-08 10:12:58 +03:00
```bash
python -m venv .venv
2023-07-21 22:56:33 +03:00
# The activate script is in different places on different systems:
# Linux/macOS/WSL:
2023-06-08 10:12:58 +03:00
source .venv/bin/activate
# Windows (cmd.exe or PowerShell):
2023-07-21 22:56:33 +03:00
.venv\Scripts\activate
# Git Bash on Windows:
source .venv/Scripts/activate
2023-06-08 10:12:58 +03:00
```
Install Textual and other dependencies:
2023-04-10 23:51:39 +03:00
```bash
pip install -r requirements.txt
2023-04-10 23:51:39 +03:00
```
Run the app via Textual's CLI for live-reloading CSS support, and enable other development features:
2023-04-10 23:51:39 +03:00
```bash
textual run --dev "src.textual_paint.paint --clear-screen --inspect-layout --restart-on-changes"
2023-04-10 23:51:39 +03:00
```
2023-04-17 02:23:00 +03:00
Or run more basically:
2023-04-10 23:51:39 +03:00
```bash
python -m src.textual_paint.paint
2023-04-10 23:51:39 +03:00
```
2023-06-08 10:12:58 +03:00
Or install the CLI globally\*:
```bash
pip install --editable .
```
Then run:
```bash
textual-paint
```
2023-06-08 10:12:58 +03:00
\*If you use a virtual environment, it will only install within that environment.
`--clear-screen` is useful for development, because it's sometimes jarring or perplexing to see error messages that have actually been fixed, when exiting the program.
2023-04-17 02:23:00 +03:00
`--inspect-layout` enables a DOM inspector accessible with F12, which I built. It also lets you apply a rainbow highlight and labels to all ancestors under the mouse with middle click, but this is mostly obsolete/redundant with the DOM inspector now. The labels affect the layout, so you can also hold Ctrl to only colorize, and you can remember how the colors correspond to the labels, to build a mental model of the layout.
2023-04-19 19:00:34 +03:00
2023-07-21 22:56:33 +03:00
`--restart-on-changes` automatically restarts the program when any Python files change. This works by the program restarting itself directly. (Programs like `modd` or `nodemon` that run your program in a subprocess don't work well with a TUI's escape sequences.)
2023-04-19 19:00:34 +03:00
2023-04-17 02:23:00 +03:00
There are also launch tasks configured for VS Code, so you can run the program from the Run and Debug panel.
Note that it runs slower in VS Code's debugger.
To see logs, run [`textual console`](https://textual.textualize.io/guide/devtools/#console) and then run the program via `textual run --dev`.
This also makes it run slower.
2023-04-17 02:23:00 +03:00
Often it's useful to exclude events with `textual console -x EVENT`.
2023-06-28 06:34:46 +03:00
### Troubleshooting
> `Unable to import 'app' from module 'src.textual_paint.paint'`
- Make sure to activate the virtual environment, if you're using one.
- Make sure to run the program from the root directory of the repository.
> `ModuleNotFoundError: No module named 'src'`
- Make sure to run the program from the root directory of the repository.
### Quality Assurance
2023-05-01 21:47:30 +03:00
```bash
# Spell checking
# I use the VS Code extension "Code Spell Checker", and its associated CLI:
cspell-cli lint .
# Type checking
# I use the "Python" and "Pylance" VS Code extensions, and the Pyright CLI:
pyright
# I'm targeting zero errors at this version of Pyright:
PYRIGHT_PYTHON_FORCE_VERSION=1.1.345 pyright
# I also tried mypy and fixed some errors it reported, but I'm not targeting zero errors with mypy.
mypy src --no-namespace-packages --check-untyped-defs
# Visual Regression Testing (and a few other tests)
# I use pytest-textual-snapshot, which is a pytest plugin for comparing SVG screenshots of Textual apps over time.
pytest
# To accept differences, update the baseline with:
pytest --snapshot-update
2023-09-13 03:45:37 +03:00
# I also made a test recorder, which can generate test code, which is great for creating tests that interact with the canvas.
# Run with:
python tests/pilot_recorder.py
# Then interact with the app, and press Ctrl+C to stop recording.
# You can also hit Ctrl+R to replay what you have,
# or Ctrl+Z to remove the last step and replay the rest.
2023-05-01 21:47:30 +03:00
```
2023-09-17 04:42:29 +03:00
### Publishing
- Run QA steps above
2024-01-12 01:15:45 +03:00
- Update version numbers in `setup.cfg` and `src/textual_paint/__init__.py` to a pre-release version (e.g. `0.3.0-pre.1`)
2023-09-17 04:42:29 +03:00
- Add version header to `CHANGELOG.md` below "Unreleased", and update version links at bottom
- Commit (e.g. `git commit -m "Prepare v0.3.0"`)
- Build package: `python -m build --sdist --wheel`
- Upload to TestPyPI: (updating version numbers) `python -m twine upload --repository testpypi dist/textual_paint-0.3.0rc1-py3-none-any.whl dist/textual_paint-0.3.0rc1.tar.gz`
- Test installing from TestPyPI with: (outside the venv, updating the version number) `pipx uninstall textual-paint; pipx install textual-paint==0.3.0rc1 --pip-args "--index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple textual-paint"`
- If all is good, update version numbers to remove `-pre.N` suffixes
- Amend commit (`git commit --amend --no-edit`)
- Rebuild: `python -m build --sdist --wheel`
- Upload to PyPI: `python -m twine upload dist/textual_paint-0.3.0-py3-none-any.whl dist/textual_paint-0.3.0.tar.gz`
- Push `main` branch (`git push origin main`)
- Tag and push tag (e.g. `git tag v0.3.0 && git push origin v0.3.0`)
2023-04-10 23:51:39 +03:00
## License
2023-09-06 03:11:32 +03:00
[MIT](https://github.com/1j01/textual-paint/blob/main/LICENSE.txt)
## News
2023-04-10 23:51:39 +03:00
2023-09-06 03:11:32 +03:00
For a history of changes to the project, see the [changelog](https://github.com/1j01/textual-paint/blob/main/CHANGELOG.md).
2023-04-10 23:51:39 +03:00
## Unicode Symbols and Emojis for Paint Tools
2023-04-15 04:30:34 +03:00
The first thing I did in this project was to collect possible characters to represent all the tool icons in MS Paint, to gauge how good of a recreation it would be possible to achieve, starting from looks.
As it turns out, I didn't run into any significant roadblocks, so I ended up recreating MS Paint. [Again.](https://jspaint.app)
2023-04-13 16:15:22 +03:00
These are the symbols I've found so far:
- Free-Form Select: ✂️📐🆓🕸✨☆⚝⛤⛥⛦⛧⚛🫥🇫/🇸◌⁛⁘ ⢼⠮ 📿➰➿𓍼യ🪢𓍯 𔗫 𓍲 𓍱 ౿ Ꮼ Ꮘ
- Select: ✂️⬚▧🔲 ⣏⣹ ⛶
- Eraser/Color Eraser: 🧼🧽🧹🚫👋🗑️▰▱
- Fill With Color: 🌊💦💧🩸🌈🎉🎊🪣🫗🚰⛽🍯 ꗃ﹆ ⬙﹅ 🪣﹅
- Pick Color: 🎨🌈💉💅💧🩸🎈📌📍🪛🪠🥍🩼🌡💄🎯𖡡⤤𝀃🝯⊸⚲𓋼🗡𓍊🍶🧪🍼🌂👁️‍🗨️🧿🍷⤵❣⚗ ⤆Ϸ ⟽þ ⇐ c⟾ /̥͚̥̥͚͚̊̊
2023-04-10 23:51:39 +03:00
- Magnifier: 🔍🔎👀🔬🔭🧐🕵️‍♂️🕵️‍♀️
- Pencil: ✏️✎✍️🖎🖊️🖋️✒️🖆📝🖍️🪶🪈🥖🥕▪
- Brush: 🖌👨‍🎨🧑‍🎨💅🧹🪮🪥🪒🪠ⵄ⑃ሐ⋔⋲ ▭⋹ 𝈸⋹ ⊏⋹ ⸦⋹ ⊂⋹ ▬▤
- Airbrush: ⛫💨дᖜ💨╔💨🧴🥤🧃🧯🧨🍾🥫💈🫠🌬️🗯☄💭༄༺☁️🌪️🌫🌀🚿 ⪧𖤘 ᗒᗣ дᖜᗕ
- Text: 📝📄📃📜A🅰🆎🔤🔠𝐴
- Line: 📏📉📈\⟍𝈏╲⧹\
2023-04-13 16:15:22 +03:00
- Curve: ↪️🪝🌙〰️◡◠~∼≈∽∿〜〰﹋﹏≈≋~⁓
- Rectangle: ▭▬▮▯➖🟥🟧🟨🟩🟦🟪🟫⬛⬜🔲🔳⏹️◼️◻️◾◽▪️▫️
- Polygon: ▙𝗟𝙇﹄』𓊋⬣⬟🔶🔷🔸🔹🔺🔻△▲☖⛉♦️🛑📐🪁✴️
- Ellipse: ⬭⭕🔴🟠🟡🟢🔵🟣🟤⚫⚪🔘🫧🕳️🥚💫💊🛞
- Rounded Rectangle: ▢⬜⬛𓋰⌨️⏺️💳📺🧫
2023-04-10 23:51:39 +03:00
2023-04-13 16:15:22 +03:00
The default symbols used may not be the best on your particular system, so I may add some kind of configuration for this in the future.
### Cursor
A crosshair cursor could use one of `+✜✛⊹✚╋╬⁘⁛𖥔⌖⯐`, but it might be better to show the pixel under the cursor, i.e. character cell, surrounded by dashes, like this:
2023-04-13 16:15:22 +03:00
```
╺█╸
```
2023-04-10 23:51:39 +03:00
## See Also
2023-04-11 01:31:41 +03:00
- [JavE](http://jave.de/), an advanced Java-based ASCII art editor
- [Playscii](http://vectorpoem.com/playscii/), a beautiful ASCII/ANSI art editor. This is also written in Python and MIT licensed, so I might take some code from it, for converting images to ANSI, for example. Who knows, maybe I could even try to support its file format.
2023-04-11 01:44:24 +03:00
- [cmdpxl](https://github.com/knosmos/cmdpxl), a pixel art editor for the terminal using the keyboard
- [pypixelart](https://github.com/douglascdev/pypixelart), a pixel art editor using vim-like keybindings, inspired by cmdpxl but not terminal-based