Commit Graph

152 Commits

Author SHA1 Message Date
Isaiah Odhner
3235ebcf26 Implement About Paint dialog 2023-04-20 16:27:41 -04:00
Isaiah Odhner
a33dd153ce I tried to fix flickering when using magnifier tool
- Move `self.canvas.magnification = self.magnification` up. It happens,
  due to internal call_after_refresh, and should happen, before scroll.
- Remove note about other code in JS Paint, I think it's not needed.
- Note my attempts at fixing flicker, which were unsuccessful, so that
  I don't try the exact same things later, and feel stupid,
  and so I don't accrue so many branches.
2023-04-20 15:39:33 -04:00
Isaiah Odhner
896f43e7ed Fix one canvas refresh not using magnification 2023-04-20 15:13:14 -04:00
Isaiah Odhner
1740e39301 Fix canvas size not updating
I actually added this before, and then thought it wasn't needed for some reason.
2023-04-20 14:54:20 -04:00
Isaiah Odhner
56ad762819 Fix mismatch between file opening behavior of Open dialog vs CLI arg 2023-04-20 14:51:06 -04:00
Isaiah Odhner
c3763523bd Visually debug IndexError...
The canvas size isn't getting updated (fully) when loading a document.
2023-04-20 14:45:11 -04:00
Isaiah Odhner
5958ba348b OK maybe this isn't so robust... 2023-04-20 14:42:51 -04:00
Isaiah Odhner
51c370dc24 Instead of clearing, prevent filling filename input in Open dialog
Prevent the filename input from being populated in the first place,
instead of resetting after its unintentionally populated when the
directory tree is expanded.

Nip it in the bud. Head it off at the pass. Stop it at the source.

It still needs this new flag to be cleared on a timer, but at least this
timer is near the code for the other timers it needs to trigger after.

Explicitly set filename for Save As dialog, which SHOULD be populated.
2023-04-20 14:42:51 -04:00
Isaiah Odhner
801c147d4c Clear filename input in Open dialog, which gets set unintentionally 2023-04-20 13:00:05 -04:00
Isaiah Odhner
ec4d044f8a Handle FileNotFoundError coming from os.path.samefile 2023-04-20 12:08:03 -04:00
Isaiah Odhner
61d1532552 Prevent multiple character selector dialogs from opening at once 2023-04-20 11:54:42 -04:00
Isaiah Odhner
74c4af1a5b Refactor meta character mapping to use match 2023-04-20 01:26:00 -04:00
Isaiah Odhner
7cdb35a4ae Start defining an enlarged view for certain characters 2023-04-20 01:25:43 -04:00
Isaiah Odhner
b955aaf361 Input or pick character to draw with 2023-04-20 01:21:06 -04:00
Isaiah Odhner
8727ed27de Use .dialog_window, already specified in one place, instead of .dialog, scattered about 2023-04-20 00:28:45 -04:00
Isaiah Odhner
29bc94efbc Ignore RuntimeError "cannot join current thread" 2023-04-19 21:45:18 -04:00
Isaiah Odhner
ac10d5e500 Tweak error messages to use colons for clarity 2023-04-19 21:34:29 -04:00
Isaiah Odhner
c659418240 Clean up attempt at more optimal color inverting
I don't want to bother importing Rich's Color class in addition to
Textual's Color class.

This also doesn't work, which might be the fastest if it worked:

    style.color.triplet.red = 255 - style.color.triplet.red
    style.color.triplet.green = 255 - style.color.triplet.green
    style.color.triplet.blue = 255 - style.color.triplet.blue
    style.bgcolor.triplet.red = 255 - style.bgcolor.triplet.red
    style.bgcolor.triplet.green = 255 - style.bgcolor.triplet.green
    style.bgcolor.triplet.blue = 255 - style.bgcolor.triplet.blue
2023-04-19 21:20:10 -04:00
Isaiah Odhner
bf16e60509 Clean up old magnifier preview approach 2023-04-19 21:14:07 -04:00
Isaiah Odhner
bd8ebad377 Implement magnifier preview 2023-04-19 21:08:59 -04:00
Isaiah Odhner
0026c06268 Fix inconsistent indentation 2023-04-19 19:58:07 -04:00
Isaiah Odhner
9120d49546 Implement the magnifier tool 2023-04-19 19:44:57 -04:00
Isaiah Odhner
ad6d799db9 Note reset command to recover from bad terminal state 2023-04-19 19:09:02 -04:00
Isaiah Odhner
dd5e646dfe Prompt to save changes before reloading program 2023-04-19 16:00:43 -04:00
Isaiah Odhner
509618c1be Try to clean up the file change observer when restarting
This is all theoretical.
2023-04-19 15:19:27 -04:00
Isaiah Odhner
140ff15ff1 Restart the app on changes 2023-04-19 14:27:12 -04:00
Isaiah Odhner
7b0eaff108 Reload the app with F2, not F4
I'm dumb, I forgot the app uses F4.
2023-04-19 02:45:55 -04:00
Isaiah Odhner
dfa4212548 Fix terminal state after reloading and exiting 2023-04-19 02:23:29 -04:00
Isaiah Odhner
f4075282ce Reload the app with F4 2023-04-19 02:08:01 -04:00
Isaiah Odhner
655d42e414 Change shortcut label for exiting
Alt+F4 is handled by the window manager, we can't handle it.
2023-04-19 00:37:59 -04:00
Isaiah Odhner
4cbafea3cb Show accelerators/shortcuts in menus 2023-04-18 23:34:05 -04:00
Isaiah Odhner
1659f2d75b Improve error handling for saving files 2023-04-18 18:56:29 -04:00
Isaiah Odhner
b8c7e0eb72 Add all of the menu items from MS Paint 2023-04-18 18:56:29 -04:00
Isaiah Odhner
ac8c3819cf Some things aren't translated yet 2023-04-18 18:55:45 -04:00
Isaiah Odhner
c5f7c9f387 Rename "Rectangular Select" to "Select" to match MS Paint and for localization 2023-04-18 18:55:45 -04:00
Isaiah Odhner
f1a4b9736e Improve error handling for saving and loading files 2023-04-18 18:55:45 -04:00
Isaiah Odhner
fcf44a8b94 Handle errors when saving a file 2023-04-18 18:55:44 -04:00
Isaiah Odhner
e715a28e59 Fix error when hitting OK button with no callback 2023-04-18 04:04:46 -04:00
Isaiah Odhner
8c4a5bf583 Handle errors when opening a file 2023-04-18 04:04:46 -04:00
Isaiah Odhner
2d3f05ff12 Rename "Redo" to "Repeat" to match MS Paint and for localization 2023-04-18 03:48:47 -04:00
Isaiah Odhner
a9fd9d090c Enable localization! 2023-04-18 03:31:47 -04:00
Isaiah Odhner
5e994fbc91 Move command line argument parsing to the top
This will make it possible to load localization data for a language
defined by a command-line argument, throughout the program.

Unfortunately this separates the usage of the arguments from their
definitions by a wide margin, making it harder to edit, especially
with AI autocomplete. For now. I could refactor things, either move
the bulk of this file to separate files, or define a configure_app
function up top to use down below.
2023-04-18 03:31:47 -04:00
Isaiah Odhner
8971122581 Wrap strings in _() function for localization 2023-04-18 03:31:47 -04:00
Isaiah Odhner
973f67240d WIP: i18n
Giving up on the python translation of the RC file parsing and pre-processing for now, in favor of simply parsing the JS files already generated, which is a much simpler task.
2023-04-18 03:31:47 -04:00
Isaiah Odhner
baf804f2b1 Fix: use title argument in warning_message_box 2023-04-18 03:08:58 -04:00
Isaiah Odhner
b4468d3a76 Update some comments about ANSI I/O 2023-04-18 02:55:11 -04:00
Isaiah Odhner
87f8faf956 Use choices option for expressing --theme 2023-04-18 01:06:45 -04:00
Isaiah Odhner
6fbcbf9ec3 Refactor ync flag to button_types argument, to support OK-only dialogs 2023-04-17 23:32:20 -04:00
Isaiah Odhner
d950295df7 Simply close the Open dialog if you select the open file 2023-04-17 23:09:13 -04:00
Isaiah Odhner
8ec24a8fdc Prompt to save changes when unloading a document
- Confirm discarding changes for Open, New, or Exit, including for
  exit via Ctrl+C which was previously handled by a built-in binding.
- Await Save As dialog closing, including when Save triggers Save As.
  This is my first time using asynchronous features in Python,
  (as far as I remember,) so it's a bit messy.
- Make DialogWindow callback also for Cancel, which means all
  DialogWindow usage sites care what button is selected.
- Send RequestClose event for Esc key.
2023-04-17 23:09:13 -04:00