Commit Graph

880 Commits

Author SHA1 Message Date
Isaiah Odhner
ea1e6751a9 VS Code: Add personal workspace containing this project and textual
Maybe I should ignore this file since it's unlikely to work on other computers...
2023-04-16 18:34:29 -04:00
Isaiah Odhner
bd6ac3dd5f VS Code: Use textual run for "Open A File in App" launch task 2023-04-16 16:04:06 -04:00
Isaiah Odhner
cb6b4403a3 Handle passing arguments via textual run
It took a while to figure out this magic.

`textual run --help` says:

>  If you are running a file and want to pass command line arguments, wrap the
>  filename and arguments in quotes:
>
>      textual run "foo.py arg --option"

But it doesn't describe how to handle those arguments.
2023-04-16 16:01:24 -04:00
Isaiah Odhner
3f23a13fe1 Fix mouse coordinates for brush preview when scrolled
Don't hackily offset mouse coordinates when mouse not down
2023-04-16 15:22:38 -04:00
Isaiah Odhner
23ca2b7113 Refactor tool button CSS class handling, and remove unused tool_button class 2023-04-16 02:08:07 -04:00
Isaiah Odhner
eeaee41747 Submit dialogs with enter, unless a button has focus 2023-04-16 02:03:28 -04:00
Isaiah Odhner
79ef514eb2 Make sure not to save the document with a brush preview 2023-04-16 00:50:12 -04:00
Isaiah Odhner
35e93210c8 Close dialogs with Escape key 2023-04-16 00:16:15 -04:00
Isaiah Odhner
7aab466964 Add Cancel button to Open dialog 2023-04-16 00:11:59 -04:00
Isaiah Odhner
d4becd2da0 Refactor dumb button handling using new class DialogWindow 2023-04-16 00:11:59 -04:00
Isaiah Odhner
accc2fe85b Fix AttributeError for "parent_menu.focus" for menu bar (top level menu) 2023-04-15 23:50:45 -04:00
Isaiah Odhner
ddd89d367b Hide brush preview when you stop hovering over the canvas 2023-04-15 23:45:44 -04:00
Isaiah Odhner
faabe2c88e Play bell/beep when prompting file overwrite confirmation 2023-04-15 23:07:22 -04:00
Isaiah Odhner
ba3ecaa39a Close window only for known buttons 2023-04-15 22:40:10 -04:00
Isaiah Odhner
da3d3b0f06 Rename Save As dialog IDs to match Open dialog IDs
It's a bit verbose, but for Open, I wanted the _dialog part since "open"
can be both a verb and an adjective, and I didn't like it reading as an
adjective. It doesn't technically disambiguate it, but it reads better.

Verb "[to] open", noun "[dialog to] open", adjective "[part of the dialog to] open"
Adjective "[is] open", noun "[dialog that is] open", adjective "[part of the dialog that is] open"

Anyways this commit just makes it consistent.
Perhaps I could use classes more in place of IDs.
2023-04-15 22:37:15 -04:00
Isaiah Odhner
73d8f04329 Enable dragging windows by their title bars 2023-04-15 22:18:45 -04:00
Isaiah Odhner
e988bf787f Move window layout fix to Window 2023-04-15 22:04:15 -04:00
Isaiah Odhner
8f5bbe9635 Fix incorrect window layouts 2023-04-15 21:47:14 -04:00
Isaiah Odhner
fc3249371c Fix title bar height / invisible close icon 2023-04-15 21:39:57 -04:00
Isaiah Odhner
774547e6f8 Fix opening files outside the current directory (with Open dialog) 2023-04-15 21:19:07 -04:00
Isaiah Odhner
47622bf437 Make menu popups wider 2023-04-15 21:16:18 -04:00
Isaiah Odhner
f51f1d9b8c Implement File > Open dialog 2023-04-15 21:11:44 -04:00
Isaiah Odhner
009a06e82b VS Code: disable justMyCode debugger feature 2023-04-15 20:54:35 -04:00
Isaiah Odhner
4334d60681 Add File > Exit menu item
I'm leaving the "Quit" naming in the keybindings, because it's Ctrl+Q,
and if the keybindings are ever displayed, that's the mnemonic.
2023-04-15 20:53:53 -04:00
Isaiah Odhner
7d433cc27b Refactor expand_directory_tree and make it a method 2023-04-15 20:39:00 -04:00
Isaiah Odhner
ce2fbe44bb Allow browsing the whole filesystem, but expand to the current directory
This relies on some API internals: tree._get_label_region and node._line
2023-04-15 20:27:19 -04:00
Isaiah Odhner
63f947e7f4 Fix confirmation dialog button functionality 2023-04-15 02:18:36 -04:00
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