Commit Graph

128 Commits

Author SHA1 Message Date
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
Isaiah Odhner
0125374bba Ctrl+MMB to colorize without adding borders to inspect layout without modifying it 2023-04-17 03:12:30 -04:00
Isaiah Odhner
4ee5efe85c Make a filled Unicode warning icon with a border 2023-04-17 03:12:30 -04:00
Isaiah Odhner
a948d7d945 Note parallelogram candidates for eraser icon 2023-04-17 01:57:27 -04:00
Isaiah Odhner
22a251276b Use Unicode for warning icon text art 2023-04-17 01:45:20 -04:00
Isaiah Odhner
5c289e05a8 Add dev helper to inspect layout 2023-04-17 01:21:19 -04:00
Isaiah Odhner
357b68d624 Show file name only, not full path, in Header 2023-04-16 21:12:44 -04:00
Isaiah Odhner
728b4c53b9 Fix Open/Save As dialog starting location when file opened with relative path
The directory tree wasn't expanded because it was searching for e.g.
LICENSE.txt at the root of the filesystem (or perhaps AS the root?)
2023-04-16 21:12:03 -04:00
Isaiah Odhner
4ef6c07826 Add Header to show the current file name 2023-04-16 21:05:55 -04:00
Isaiah Odhner
a02431d19e Add --theme option to CLI 2023-04-16 20:34:56 -04:00
Isaiah Odhner
650584d4b2 Add usage section to readme 2023-04-16 19:38:53 -04:00
Isaiah Odhner
8929ed14b6 Clear screen during development to avoid seeing fixed errors 2023-04-16 18:54:49 -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
79ef514eb2 Make sure not to save the document with a brush preview 2023-04-16 00:50:12 -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
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
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
774547e6f8 Fix opening files outside the current directory (with Open dialog) 2023-04-15 21:19:07 -04:00