Commit Graph

350 Commits

Author SHA1 Message Date
Isaiah Odhner
1f5457d992 Fix crash with Polygon tool(s), dragging from outside to inside canvas
When clicking outside the canvas and dragging and releasing over it,
several tools exhibited issues, which this commit fixes.

- Free-Form Select, Polygon: crash with IndexError
- Select: useless selection created
- Magnifier, Pick Color: returned to last tool before use
2023-04-29 12:43:34 -04:00
Isaiah Odhner
9897266a14 Fix error during undo after redo after undo after resize
When you've finally tracked down an issue and to fix it all you have to
do is point the cursor in the right spot and hit tab to accept the AI's
auto completion, it really makes you wonder about proactive AI coding
assistance, and a future with AGI. Or even without any AGI or proactive
AI, just having a gutter view that shows how surprised a language model
is at a given line of code could really work wonders on a problem like
this. It might feel _judgy_, but it could solve problems.
2023-04-29 12:22:32 -04:00
Isaiah Odhner
fffd287ff0 WIP: make resizing the canvas undoable
Resize, undo, redo works, but:
Resize, undo, redo, undo errors.
2023-04-28 22:40:00 -04:00
Isaiah Odhner
7d4a463668 Tweak comment 2023-04-28 21:57:02 -04:00
Isaiah Odhner
4fed90c794 Clean up
btw backslash was to avoid comment detected as a #region comment
which Pylance complained about not having a respective end comment
2023-04-28 21:54:35 -04:00
Isaiah Odhner
9c1b617440 Fix error undoing ineffective flood fill 2023-04-28 21:54:35 -04:00
Isaiah Odhner
5be895732d Remove document argument to Action in favor of action.update()
I'm probably breaking stuff here, by disabling the region fallback, etc.
2023-04-28 21:31:57 -04:00
Isaiah Odhner
dbf6b78659 Add missing docstrings (both identical for now) 2023-04-28 21:31:57 -04:00
Isaiah Odhner
67015ae1ca Add a known crash-causing issue 2023-04-28 20:46:38 -04:00
Isaiah Odhner
e5eaef3409 Use new SVG export for wallpaper feature
save_screenshot() includes a simulated window frame.
2023-04-28 20:16:44 -04:00
Isaiah Odhner
a05a85b103 Remove extraneous div from SVG output 2023-04-28 20:10:50 -04:00
Isaiah Odhner
785b9daea9 Save as SVG, and better (fuller) HTML 2023-04-28 19:52:52 -04:00
Isaiah Odhner
af14c36179 Save as different file types according to the extension 2023-04-28 19:09:59 -04:00
Isaiah Odhner
05b4f866e3 Rename filename -> file_path 2023-04-28 18:56:08 -04:00
Isaiah Odhner
bd3b99ac32 Fix errant newline in comment
It was introduced in a commit where I wasn't able to easily review the
diff, which should have been rather trivial (a23eeaf1dd)
2023-04-28 18:56:08 -04:00
Isaiah Odhner
93a1d2674f Clear undos/redos to avoid errors when applying undo actions 2023-04-28 18:37:13 -04:00
Isaiah Odhner
cc2ba1f043 Warn before permanently resizing the canvas 2023-04-28 18:37:13 -04:00
Isaiah Odhner
6ad4b7e442 Refresh canvas when resizing document 2023-04-28 15:27:23 -04:00
Isaiah Odhner
4effc9d599 Compromise on the layout of the image attributes dialog for now 2023-04-28 15:27:15 -04:00
Isaiah Odhner
34d3c79c3b WIP: image attributes dialog
All of this code was autocompleted by GitHub Copilot.
2023-04-28 15:09:09 -04:00
Isaiah Odhner
7b4ba83b42 Split long line into three 2023-04-28 14:32:02 -04:00
Isaiah Odhner
091c9597d7 Replace Style.parse() with direct Style()-style Style construction 2023-04-28 14:27:07 -04:00
Isaiah Odhner
8d7843b383 Finalize selection and cancel other tools when saving 2023-04-28 14:06:14 -04:00
Isaiah Odhner
b764ab6f45 Hook up Set As Wallpaper menu items 2023-04-26 22:30:59 -04:00
Isaiah Odhner
06e2ad41e4 Fix cells inverted outside the textbox to the left of the selection after closing a menu over the region
Normally, only the region with the textbox is updated, when the text selection changes, but if the canvas is refreshed by other means, like a menu, it can show up.
2023-04-26 21:32:42 -04:00
Isaiah Odhner
f6b94f67c4 Fix: refresh canvas when selecting all 2023-04-26 21:29:31 -04:00
Isaiah Odhner
dc6ab4d72e Type hint pyperclip.paste() 2023-04-26 21:27:33 -04:00
Isaiah Odhner
f1652c257a Fix: refresh canvas when pasting
Broken in last commit by adding:

        if "ctrl" in key:
            # Don't interfere with Ctrl+C, Ctrl+V, etc.
            return
2023-04-26 21:25:57 -04:00
Isaiah Odhner
a7619b7721 Copy selected text within textbox, instead of whole textbox 2023-04-26 21:25:57 -04:00
Isaiah Odhner
abb1e9128d Refactor: extract selected_text_range and supporting functions 2023-04-26 21:11:26 -04:00
Isaiah Odhner
df2d19af0a Fix background color of text pasted into textbox 2023-04-26 21:02:32 -04:00
Isaiah Odhner
09a03bdcbf Paste text into textbox 2023-04-26 20:35:13 -04:00
Isaiah Odhner
1c9fb0ca1b Delete/backspace ranges of text 2023-04-26 17:54:00 -04:00
Isaiah Odhner
06836d77bb Add textbox variable to shorten code 2023-04-26 17:24:28 -04:00
Isaiah Odhner
66f0e3fd42 Tweak comments in on_key in PaintApp 2023-04-26 17:23:45 -04:00
Isaiah Odhner
e3c985d0a5 Fix indent 2023-04-26 17:15:27 -04:00
Isaiah Odhner
0754db7218 Fix IndexError when pressing Ctrl+A followed by Delete in a textbox 2023-04-26 17:08:32 -04:00
Isaiah Odhner
c1375d81ed Make Select All select text within the textbox, if applicable 2023-04-26 17:04:24 -04:00
Isaiah Odhner
088b7e9b2d Clamp text selection endpoint while dragging
This fixes weird or non-traditional behavior where dragging further away
from the textbox when the mouse is outside the textbox would continue to
offset the cursor index. It wasn't totally unreasonable, but the
traditional behavior is to clamp it, and it makes it easier to select
whole lines.
2023-04-26 17:00:54 -04:00
Isaiah Odhner
c46586cc51 Show text selection within Textbox, and update it with Shift+arrows 2023-04-26 16:47:55 -04:00
Isaiah Odhner
1f171259bb Fix shifted/cutoff selection when melding with negative coordinates
Code intended to prevent errors was also creating an offset between
the source and target regions. The source region needs to be adjusted
to match the clipped target region.
2023-04-26 13:49:33 -04:00
Isaiah Odhner
0c52788843 Fix some type checker errors 2023-04-26 13:35:52 -04:00
Isaiah Odhner
3f3375c1fd Paste to top left of viewport (when scrolled right/down) 2023-04-26 13:13:42 -04:00
Isaiah Odhner
5bd6684ba7 Clean up commented out clipboard code 2023-04-26 13:03:53 -04:00
Isaiah Odhner
f114723be4 Make pasting undoable 2023-04-26 12:47:08 -04:00
Isaiah Odhner
55c280cdfb Don't use pyperclip.is_available() 2023-04-26 12:38:14 -04:00
Isaiah Odhner
8c936552b7 Don't delete selection if copy fails during cut 2023-04-26 12:32:12 -04:00
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