Commit Graph

303 Commits

Author SHA1 Message Date
Isaiah Odhner
0c3cc45ddd Start implementing copy/paste with pyperclip 2023-04-26 12:28:42 -04:00
Isaiah Odhner
ed5e399a58 Don't delete the whole textbox when pressing Delete 2023-04-26 11:19:16 -04:00
Isaiah Odhner
fe8c05bdc0 Reorder expanding_directory_tree next to directory_tree_selected_path 2023-04-26 03:21:09 -04:00
Isaiah Odhner
c81d45756b Add docstrings to all PaintApp state, replacing comments 2023-04-26 03:19:23 -04:00
Isaiah Odhner
3849f57ed6 Add docstrings to all functions 2023-04-26 03:01:00 -04:00
Isaiah Odhner
a5518a5894 Remove redundant cancel_preview, handled by stop_action_in_progress 2023-04-26 02:38:27 -04:00
Isaiah Odhner
6d6ef25da4 Cancel active tool by pressing both mouse buttons 2023-04-26 01:30:36 -04:00
Isaiah Odhner
bf8c7fa1a6 Comment/typecheck new CharInput render_line code 2023-04-26 01:24:37 -04:00
Isaiah Odhner
63c9a3ea11 Cancel active tool with Escape 2023-04-26 00:38:50 -04:00
Isaiah Odhner
c6967c69f5 Show selected foreground color in the CharInput 2023-04-26 00:06:57 -04:00
Isaiah Odhner
d043d444e9 Hide selection border while dragging 2023-04-25 19:22:57 -04:00
Isaiah Odhner
15ffabbaac Use repr instead of str when formatting exceptions
This is a little better, but not great.
2023-04-25 19:03:50 -04:00
Isaiah Odhner
1ab1dfb037 Fix extraneous white cell at top left when loading ANSI files 2023-04-25 18:43:28 -04:00
Isaiah Odhner
ba7f8e6a0a Don't invert the inner textbox border, that's too visually confusing 2023-04-25 18:31:50 -04:00
Isaiah Odhner
5ba8cbdbb8 Fix assertion error when using Select or Text before any other tool
AssertionError: selection_drag_offset should only be set if there's a selection
2023-04-25 18:26:15 -04:00
Isaiah Odhner
aae99c3247 Add parenthesis in complex canvas rendering conditional 2023-04-25 18:19:54 -04:00
Isaiah Odhner
66f4b77ff3 Further clarify comment about selection cutout vs melding regions 2023-04-25 17:36:52 -04:00
Isaiah Odhner
5141044ef0 Clarify/expound comment about selection cutout vs melding regions 2023-04-25 17:07:50 -04:00
Isaiah Odhner
91ce544569 Move selection box with arrow keys
Note: This doesn't cut out the selection if you haven't dragged it yet,
with the mouse. It should probably be equivalent to mouse dragging, but
this current behavior could be useful too.
2023-04-25 16:53:47 -04:00
Isaiah Odhner
d94482aa82 Discard textbox if you never typed anything into it 2023-04-25 16:25:47 -04:00
Isaiah Odhner
f33802af30 Make Text tool undoable 2023-04-25 16:14:29 -04:00
Isaiah Odhner
5faaccbd2a Make Clear Selection (Delete) undoable 2023-04-25 16:07:23 -04:00
Isaiah Odhner
65dbc4bfe6 Refactor conditional to early return 2023-04-25 15:54:34 -04:00
Isaiah Odhner
522004638e DRY meld_selection + action_clear_selection 2023-04-25 15:53:40 -04:00
Isaiah Odhner
b793a31108 Stop active tool when hitting Ctrl+A 2023-04-25 15:43:43 -04:00
Isaiah Odhner
277a879b5c Finalize Polygon/Curve when switching tools 2023-04-25 15:42:36 -04:00
Isaiah Odhner
0decdb06d7 DRY polygon/curve undo state creation 2023-04-25 15:41:24 -04:00
Isaiah Odhner
8472b37859 Keep Curve/Polygon preview when mouse leaves the canvas 2023-04-25 15:41:24 -04:00
Isaiah Odhner
8c932ea53f Fix dragging selection by top left corner
I recognized this as another Offset -> bool coercion issue.
2023-04-25 14:39:59 -04:00
Isaiah Odhner
b46273cf9f Add a threshold to Color Eraser, comparing color components 2023-04-25 13:51:48 -04:00
Isaiah Odhner
84af26c0a2 Implement Color Eraser feature 2023-04-25 13:27:54 -04:00
Isaiah Odhner
f5ea658848 Fix CharInput interfering with Text tool 2023-04-24 23:28:36 -04:00
Isaiah Odhner
f8cfcb0f6e Make text tool use selected colors
This is a little weird because the selected background color is
analogous to the foreground color in MS Paint, for the other tools,
with the foreground color having no equivalent as it's just pixels
instead of character cells.
So with the default white canvas and black "background color",
this now draws a black text box, unlike MS Paint's default behavior
for the text tool of drawing a white text box.
2023-04-24 23:14:46 -04:00
Isaiah Odhner
fdca36daa1 Allow setting text color with Ctrl+click 2023-04-24 22:52:24 -04:00
Isaiah Odhner
61227597f8 Fix flood fill infinite loop when color under cursor matches fill color 2023-04-24 22:18:48 -04:00
Isaiah Odhner
a91dd25996 Use interpolation feature of my localization function 2023-04-24 21:14:35 -04:00
Isaiah Odhner
cfc82a55c1 Fix unlocalized save changes prompt 2023-04-24 21:13:26 -04:00
Isaiah Odhner
de1a77036b Bind F1 to Help Topics 2023-04-24 20:43:11 -04:00
Isaiah Odhner
9c4728c483 Improve layout of Custom Zoom window 2023-04-24 20:33:12 -04:00
Isaiah Odhner
4608c73219 Make undo/redo cancel in-progress tool usage 2023-04-24 15:46:17 -04:00
Isaiah Odhner
5bf2280569 Fix cycling characters in CharInput due to events queuing 2023-04-24 15:30:08 -04:00
Isaiah Odhner
9a45b3c839 Disable and hide hotkeys for top level menus since I can't detect Alt 2023-04-24 15:08:45 -04:00
Isaiah Odhner
3a0adb3c94 Fix deselection by clicking outside canvas 2023-04-24 12:54:06 -04:00
Isaiah Odhner
889d1b5636 Invert underlying colors for Free-Form Select preview, don't use selected color 2023-04-24 12:48:49 -04:00
Isaiah Odhner
b7aabd642c Refactor shared conditional to early return in stamp_char 2023-04-24 12:16:22 -04:00
Isaiah Odhner
1a135c4153 Rename a variable that is inside is_inside_polygon
This is an AI-offered function... so I'm sort of guessing here.

This fixes a spell checker issue but there's also a "possibly unbound"
type checker issue here.
2023-04-24 03:09:06 -04:00
Isaiah Odhner
23352d64ac Fix "incompatible" override type checker errors
Method "watch_value" overrides class "Input" in an incompatible manner
  Return type mismatch: base method returns type "Coroutine[Any, Any, None]", override returns type "None"
    Type "None" cannot be assigned to type "Coroutine[Any, Any, None]"PylancereportIncompatibleMethodOverride

Method "validate_cursor_position" overrides class "Input" in an incompatible manner
  Parameter 2 name mismatch: base parameter is named "cursor_position", override parameter is named "position"PylancereportIncompatibleMethodOverride

These wouldn't actually be problems, due to the nature of the reactive properties system, but whatever, I can make it match, no problem.
2023-04-24 03:07:19 -04:00
Isaiah Odhner
6259d11ec5 Switch to previous tool only on mouse up (for Magnifier)
This fixes accidentally activating the other tool when using the Magnifier, and matches the behavior of MS Paint.
2023-04-24 02:16:40 -04:00
Isaiah Odhner
961dfe8039 Add some type hints to variables
I don't know what all should have type annotations, and honestly it's
pretty confusing how these are used. For instance, `selecting_text`
goes from:
    (variable) selecting_text: bool
to:
    (variable) selecting_text: Literal[False]
when annotating it as a bool, looking at the hover text in VS Code
with Pylance language server.
2023-04-24 02:08:48 -04:00
Isaiah Odhner
0c42edce9c Fix cells stroked outside the mouse's path
Use absolute positions instead of delta coordinates.

The deltas would sometimes give points "jutting out" — only by a pixel,
but confusing when trying to do pixel art. You might not even notice it
but it might make you feel like a bad artist until you do.
2023-04-24 01:41:18 -04:00