Commit Graph

1002 Commits

Author SHA1 Message Date
Isaiah Odhner
0a176fc1a4 Prevent unloading document if save fails 2023-06-13 19:14:35 -04:00
Isaiah Odhner
f2facf8a68 Rename is_resize -> is_full_update 2023-06-13 18:27:24 -04:00
Isaiah Odhner
2ed803631b Allow undoing color or character information loss
Of course, this highlights the need to prompt during Save as well,
not just Save As, or to make creating color or character information
impossible depending on the type of file that is open.
2023-06-13 14:50:08 -04:00
Isaiah Odhner
17b4a67455 Fix reloading file after losing color or character information
Can't use self.open_from_file_path because:
1. it short-circuits if the file is already open
2. it clears the undo history*
3. it does stuff with the backup file
4. plus it's not as efficient to use the FS, and it uses a callback,
   which is a pain.

*TODO: make the reload undoable
2023-06-13 14:50:08 -04:00
Isaiah Odhner
3a3a554857 Confirm losing color or character information 2023-06-13 14:50:08 -04:00
Isaiah Odhner
a598f83047 Add source column to key bindings table 2023-06-13 01:56:11 -04:00
Isaiah Odhner
d1318e696b Center checkmarks in the boolean columns 2023-06-13 01:46:55 -04:00
Isaiah Odhner
8ec9056bdf Fix "Nothing selected" text getting pushed down in Keys tab
This is just a workaround.
2023-06-13 01:38:19 -04:00
Isaiah Odhner
a690a45a98 Show key bindings in a DataTable in the inspector
This now shows bindings from ancestors DOM nodes as well.
2023-06-13 01:38:19 -04:00
Isaiah Odhner
adc21a1ef4 Prevent "(edited)" mark for unchanged values (again!)
I implemented this previously in 8278e5da94
and had to redo it after changing it to use merge()
2023-06-12 22:38:49 -04:00
Isaiah Odhner
750c77b0ed Fix editing inline styles after first time 2023-06-12 22:20:01 -04:00
Isaiah Odhner
d69334c102 Fix "(edited)" marks
Update style traces when styles are changed with `merge`/`merge_rules`.

I wish `merge` used `merge_rules` so I could define just one extra
instrumentation point. I guess I could make my `merge` use my version of
`merge_rules`, but that feels weird, even if it's probably not any more
fragile to implement it that way.
2023-06-12 21:54:25 -04:00
Isaiah Odhner
8911c406be Add error handling for inline style editing, breaking "(edited)" marks
Using .merge() isn't tracked by the call stack recording (yet), so it
can no longer attribute inline styles to editing with the inspector,
but this lack of tracking was already a problem, it just highlights it.
2023-06-12 20:48:55 -04:00
Isaiah Odhner
8278e5da94 Prevent "(edited)" mark when value was left unchanged 2023-06-12 20:06:53 -04:00
Isaiah Odhner
61eb8631b2 Edit inline styles in CSS tab of inspector 2023-06-12 20:02:29 -04:00
Isaiah Odhner
52c26ade26 Update import in an unused module 2023-06-12 00:43:42 -04:00
Isaiah Odhner
bf675e4c51 Fix two related type checking errors 2023-06-12 00:43:42 -04:00
Isaiah Odhner
93d176e656 Pyright: ignore build folder
Python files get copied to the build folder. It's kinda confusing to see type checking errors for old versions of files.
2023-06-12 00:43:42 -04:00
Isaiah Odhner
5eaabd6754 VS Code: mark files as readonly 2023-06-12 00:43:42 -04:00
Isaiah Odhner
0f5193dc50 Move auto restart code to a module 2023-06-12 00:23:51 -04:00
Isaiah Odhner
6946669a41 Update screenshot, and screenshot methodology, and remove table wrapper
The old screenshot was generated by Select All and Copy As HTML in
Ubuntu's Terminal app (using a keyboard shortcut that had to be set up
first), and post-processed using code included in screenshot.svg, which
I'm now deleting.

The new screenshot is generated using Textual's built-in SVG export.
It displays nicer, with less artifacts (seams between cells).
It doesn't need such silly explanation of the nature of the screenshot,
and was also sizing to the width of the text, so I removed the wrapper
table which was imitating (standing in for) figure/figcaption elements.

The new screenshot also includes a window border, macOS-styled, which is
a little weird since it's a remake of MS Paint (Windows software)
developed entirely on Ubuntu (Linux distro).
2023-06-11 22:59:37 -04:00
Isaiah Odhner
8f40c77d6f Point to .venv/bin/textual in VS Code launch configurations 2023-06-11 18:58:02 -04:00
Isaiah Odhner
a0f626a339 Poke around the UI to find untranslated strings
(This is generally inferior to source code analysis.)

There's also the Help / About Paint dialogs.
2023-06-11 17:42:52 -04:00
Isaiah Odhner
1d089db36b Fix localization support (--language option)
Broken in "Move package files to folder src/textual_paint/" c55620dd35
2023-06-11 17:28:49 -04:00
Isaiah Odhner
1291fd1d47 Add a few todos for the inspector 2023-06-11 16:55:59 -04:00
Isaiah Odhner
e28c7a3c7e Remove paint palette emoji, superseded by logo text art 2023-06-11 02:37:14 -04:00
Isaiah Odhner
07395517ea Update remaining command lines to run the app as a module 2023-06-10 21:20:17 -04:00
Isaiah Odhner
6fae6e501e Expand default target directory (if you Open/Save from a New file) 2023-06-10 21:09:02 -04:00
Isaiah Odhner
4e1f11ab23 Fix expanding directory tree to current folder, in file dialogs
- This regressed due to updates in Textual 0.25.0,
  because DirectoryTree now loads directory contents in a worker:
  https://github.com/Textualize/textual/issues/2456
- Directory tree expansion may be more robust now, although it's using
  more internals now, and it still needs timers for whatever reason.
2023-06-10 21:05:19 -04:00
Isaiah Odhner
9f7f198518 Ignore backup file not existing when comparing file identity 2023-06-10 18:14:56 -04:00
Isaiah Odhner
58cfbfae0a Fix discarding Untitled.ans~ on startup 2023-06-10 18:13:35 -04:00
Isaiah Odhner
1b5d1ce988 Disable most print statements 2023-06-10 02:21:53 -04:00
Isaiah Odhner
2631256994 Try a more heavy-handed way of getting GitHub to detect the language 2023-06-09 23:24:55 -04:00
Isaiah Odhner
3fe9fed6ad Clean up some things 2023-06-09 21:58:46 -04:00
Isaiah Odhner
bb9042a6c0 Fix extraneous space 2023-06-09 21:39:30 -04:00
Isaiah Odhner
9f283458bf Fix color highlight for border properties where it's not the whole value 2023-06-09 21:37:20 -04:00
Isaiah Odhner
3f55179ef7 Fix color highlight for some color syntax 2023-06-09 21:21:25 -04:00
Isaiah Odhner
dfcdd33a7a Highlight color values also within rule sets
This also removes an extraneous newline for an empty inline styles block (by accident)
2023-06-09 21:03:42 -04:00
Isaiah Odhner
675cee043f Clean up 2023-06-09 20:02:52 -04:00
Isaiah Odhner
f677a3337c Highlight color values in inline styles in inspector 2023-06-09 18:17:09 -04:00
Isaiah Odhner
7bae717df1 Mark *args/**kwargs as Any for RuleSet instrumentation 2023-06-09 17:43:04 -04:00
Isaiah Odhner
812d628c42 Add tooltips to tool buttons 2023-06-09 15:13:29 -04:00
Isaiah Odhner
2bc8d33079 Disable DOM inspector when --inspect-layout isn't passed
In the future I could make this more flexible, since you don't always
need the instrumentation in order to benefit from the inspector.
2023-06-09 02:02:36 -04:00
Isaiah Odhner
ca1780ce0d Remove special handling for textual run that's no longer needed
No that it's a run as a module, the arguments are separated:

$ textual run --dev "src.textual_paint.paint --language en --clear-screen --inspect-layout --restart-on-changes samples/ship.ans"
	__name__: src.textual_paint.paint
	sys.argv: ['-c', '--language', 'en', '--clear-screen', '--inspect-layout', '--restart-on-changes', 'samples/ship.ans']

$ python -m "src.textual_paint.paint" --language en --clear-screen --inspect-layout --restart-on
-changes samples/ship.ans
	__name__: __main__
	sys.argv: ['/home/io/Projects/textual-paint/src/textual_paint/paint.py', '--language', 'en', '--clear-screen', '--inspect-layout', '--restart-on-changes', 'samples/ship.ans']

$ python src/textual_paint/paint.py --language en --clear-screen --inspect-layout --restart-on-changes samples/ship.ans
	__name__: __main__
	sys.argv: ['src/textual_paint/paint.py', '--language', 'en', '--clear-screen', '--inspect-layout', '--restart-on-changes', 'samples/ship.ans']

$ src/textual_paint/paint.py --language en --clear-screen --inspect-layout --restart-on-changes 
samples/ship.ans
	__name__: __main__
	sys.argv: ['src/textual_paint/paint.py', '--language', 'en', '--clear-screen', '--inspect-layout', '--restart-on-changes', 'samples/ship.ans']
2023-06-09 01:27:13 -04:00
Isaiah Odhner
178e4c0689 Fix name of program in help text
Originally it was `paint.py`, but after switching to running as a module
(needed to use Python's relative imports for some reason) it became "-c"
when running with the `textual` CLI.
2023-06-09 01:27:13 -04:00
Isaiah Odhner
c15e8ce427 Handle "ValueError: No closing quotation" on paste with MMB
I'm not sure what I had in the clipboard that triggered this,
but it reproduces easily enough with `"unbalanced`
2023-06-09 01:27:13 -04:00
Isaiah Odhner
8c0bb993ad How much shading is too much shading? 2023-06-09 00:12:13 -04:00
Isaiah Odhner
beefe9f560 Tweak Paint icon (the cup, and shading of the cup and folded corner) 2023-06-08 23:54:56 -04:00
Isaiah Odhner
c83efb4ddf Tweak Paint icon, using heavy slashes
- Use very heavy solidus for paint brushes. This renders in a strange
  overlapped way in Ubuntu Terminal and VS Code's terminal, which
  actually works really well here. I just hope it doesn't become
  a wide character in the future, or isn't treated as such on other
  terminals.
- Add brush tips to the other brushes, each using a different character.
- Remove top border, since it conflicts with brush tips.
2023-06-08 23:54:56 -04:00
Isaiah Odhner
7e30f39374 Add Paint icon ANSI art to Help > About Paint 2023-06-08 23:54:56 -04:00