Commit Graph

1253 Commits

Author SHA1 Message Date
Isaiah Odhner
e814dd6637 Add ASCII art warning icon to confirmation dialog 2023-04-15 01:59:16 -04:00
Isaiah Odhner
b5e0ec8438 Confirm overwriting files
A Textual layout bug is unfortunately making the Yes button HUGE,
and the No button INVISIBLE, until you mouse over the dialog, which is
pretty funny...
"<file> already exists. Do you want to replace it? [Yes]"
2023-04-15 01:49:08 -04:00
Isaiah Odhner
a5b217b3cd Add directory tree to Save As dialog 2023-04-15 01:25:58 -04:00
Isaiah Odhner
c2e86d5eae Implement Save As dialog 2023-04-15 00:57:43 -04:00
Isaiah Odhner
241cdfb64e Rename layer 2023-04-14 23:24:51 -04:00
Isaiah Odhner
66d2f79e0c Tweak readme 2023-04-14 21:32:02 -04:00
Isaiah Odhner
89e8c18dc4 Apply SVG fix-up script (contained in the SVG) 2023-04-14 19:15:45 -04:00
Isaiah Odhner
ba646f7cdb 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 19:15:45 -04:00
Isaiah Odhner
3cf76d9486 Ignore __pycache__ for spell checking 2023-04-14 18:54:36 -04:00
Isaiah Odhner
20e2f1a52d Fix brush preview artifacts when undoing/redoing 2023-04-14 02:21:12 -04:00
Isaiah Odhner
98d04f55f6 Add File > New support 2023-04-14 01:51:27 -04:00
Isaiah Odhner
0697784d56 Enable toggling tools/colors boxes from the View menu 2023-04-14 01:46:07 -04:00
Isaiah Odhner
16d3b84015 Set up argparse and make --ascii-only-icons an option 2023-04-14 01:15:42 -04:00
Isaiah Odhner
a857845281 Add ascii-only icons mode 2023-04-14 01:10:09 -04:00
Isaiah Odhner
fda94c31f8 Implement brush previews 2023-04-13 23:07:46 -04:00
Isaiah Odhner
44fe270463 Note some alternate selection tool icons using Braille
These are pretty good candidates, paired together.
For the Free-Form Select icon (⢼⠮), I'm specifically imitating the
asymmetrical star shape from MS Paint.
2023-04-13 23:07:46 -04:00
Isaiah Odhner
5f5807ad3a Fix inconsistent indentation 2023-04-13 21:05:45 -04:00
Isaiah Odhner
baaf0ee8e9 Pick color while dragging 2023-04-13 19:02:44 -04:00
Isaiah Odhner
611e7f10c9 Implement Pick Color tool 2023-04-13 18:54:51 -04:00
Isaiah Odhner
b805d9a488 Implement eraser and airbrush tools 2023-04-13 18:48:24 -04:00
Isaiah Odhner
ad5508eb64 Prevent scrolling things
Ideally it would be nice if you could access everything, but it's not
part of the design of MS Paint, and I don't want to design for it here.
In MS Paint, there's a minimum window size.
2023-04-13 18:34:40 -04:00
Isaiah Odhner
8b955b0e43 Prevent bolding of tool icon glyphs 2023-04-13 18:18:27 -04:00
Isaiah Odhner
ef41cb53e7 Add features section to readme 2023-04-13 10:06:39 -04:00
Isaiah Odhner
155df6a998 Collect more symbols 2023-04-13 10:02:31 -04:00
Isaiah Odhner
3652b2bd8e Add flood fill support
* Implemented the Fill With Color tool using the algorithm described as
  "combined-scan-and-fill span filler" on Wikipedia.
* I added handling for the affected region being None, which turned
out more complicated than I would like...
  Some cases may be able to be simplified or removed.
* Also, I moved event.stop() to the top so I don't need to call it in
multiple places when there are multiple return points.
2023-04-13 02:48:32 -04:00
Isaiah Odhner
3dbbbc1c5f Refactor away assumption that tools will affect the document at the cursor
You could imagine having a brush with momentum, that swings around the
mouse without always reaching it. But it's just generally clearer to
not have an inadequate initial region that's then extended.
2023-04-13 01:21:33 -04:00
Isaiah Odhner
de47a62833 Implement line, rectangle, and rounded rectangle tools 2023-04-13 00:52:44 -04:00
Isaiah Odhner
50c3278264 Use tool names from MS Paint, consistently 2023-04-13 00:35:49 -04:00
Isaiah Odhner
303d6942f4 Switch out fill tool icon to avoid text row offset artifacts 2023-04-13 00:32:03 -04:00
Isaiah Odhner
5b1c16ddc3 Use wide A character for text tool icon, centering it 2023-04-13 00:32:03 -04:00
Isaiah Odhner
e11cbb0748 Convert keyboard handling to use BINDINGS
https://textual.textualize.io/guide/input/#bindings
2023-04-12 23:57:11 -04:00
Isaiah Odhner
d748c380b4 Rename all keyboard activated functions to action_* 2023-04-12 23:32:30 -04:00
Isaiah Odhner
02fcffbb00 Position menu popup below the respective menu button 2023-04-12 23:09:34 -04:00
Isaiah Odhner
2a89948717 Get menu popups floating 2023-04-12 22:42:48 -04:00
Isaiah Odhner
044b404a0e Start making menus work 2023-04-12 22:07:38 -04:00
Isaiah Odhner
b779059208 Add non-functional menu bar 2023-04-12 20:54:21 -04:00
Isaiah Odhner
fd4944c296 Remove ugly useless gutter 2023-04-12 15:47:32 -04:00
Isaiah Odhner
082eb3d4da Tweak colors to look good in light and dark modes 2023-04-12 15:43:17 -04:00
Isaiah Odhner
b0554a6662 Change editing area background to work better with light mode 2023-04-12 15:32:16 -04:00
Isaiah Odhner
4fa7784651 Toggle dark mode with Ctrl+D 2023-04-12 15:32:16 -04:00
Isaiah Odhner
8369b4e303 Invisibly shrink #available_colors
I was trying out adding a background to it and noticed it was bigger than it needs to be.
2023-04-12 15:32:16 -04:00
Isaiah Odhner
5796c5c8b3 Give inset appearance to color wells / selected color 2023-04-12 15:31:52 -04:00
Isaiah Odhner
2e454333fb Widen selected color display 2023-04-12 15:31:52 -04:00
Isaiah Odhner
083b169257 Add ellipse tool support 2023-04-11 22:30:46 -04:00
Isaiah Odhner
f31069e3b2 Add type hints for undos/redos lists 2023-04-11 22:30:46 -04:00
Isaiah Odhner
67d256883d Refactor: don't store reference to the live document in Action
It feels in danger of accidental usage there, or preventing GC.
2023-04-11 21:45:00 -04:00
Isaiah Odhner
30cddbbde5 Save and load ANSI files 2023-04-11 21:18:11 -04:00
Isaiah Odhner
66bb55afd2 Create requirements.txt 2023-04-11 21:14:23 -04:00
Isaiah Odhner
3e84ae7e17 Disable region update debug 2023-04-11 15:20:31 -04:00
Isaiah Odhner
6d5430ad2e Fix error due to action regions exceeding canvas bounds 2023-04-11 14:41:58 -04:00