Commit Graph

1266 Commits

Author SHA1 Message Date
Isaiah Odhner
15b35eaf5c Fix new errors after updating pyright (v1.1.314 -> v1.1.317)
→ PYRIGHT_PYTHON_FORCE_VERSION=latest pyright

added 1 package, and audited 2 packages in 4s

found 0 vulnerabilities
/home/io/Projects/textual-paint/src/textual_paint/paint.py
  /home/io/Projects/textual-paint/src/textual_paint/paint.py:1173:64 - error: Condition will always evaluate to True since the types "Never" and "None" have no overlap (reportUnnecessaryComparison)
  /home/io/Projects/textual-paint/src/textual_paint/paint.py:1214:26 - error: Pattern will never be matched for subject type "Never" (reportUnnecessaryComparison)
  /home/io/Projects/textual-paint/src/textual_paint/paint.py:1217:26 - error: Pattern will never be matched for subject type "Never" (reportUnnecessaryComparison)
  /home/io/Projects/textual-paint/src/textual_paint/paint.py:1220:26 - error: Pattern will never be matched for subject type "Never" (reportUnnecessaryComparison)
  /home/io/Projects/textual-paint/src/textual_paint/paint.py:1223:26 - error: Pattern will never be matched for subject type "Never" (reportUnnecessaryComparison)
  /home/io/Projects/textual-paint/src/textual_paint/paint.py:1229:26 - error: Pattern will never be matched for subject type "Never" (reportUnnecessaryComparison)
  /home/io/Projects/textual-paint/src/textual_paint/paint.py:1233:26 - error: Pattern will never be matched for subject type "Never" (reportUnnecessaryComparison)
7 errors, 0 warnings, 0 informations
2023-07-15 23:32:18 -04:00
Isaiah Odhner
f21899fd1d Use LineFilter to avoid private _segments access
This fixes the last pyright error (on pyright v1.1.314)
2023-07-15 23:24:56 -04:00
Isaiah Odhner
f6a40028e8 Update and clarify help text 2023-07-15 23:05:41 -04:00
Isaiah Odhner
b62a92a782 Simplify using Segment.apply_style 2023-07-15 22:45:52 -04:00
Isaiah Odhner
96b2d08789 Ignore all but one last Pyright error
(on pyright v1.1.314)
2023-07-15 22:27:49 -04:00
Isaiah Odhner
26cf8c3e64 Annotate instruction from stransi 2023-07-15 22:26:41 -04:00
Isaiah Odhner
9c8c035d14 Add type stubs for Pillow and psutil 2023-07-15 21:53:09 -04:00
Isaiah Odhner
d5669f434f Fix type mismatch in unused code
error: Incompatible types in assignment (expression has type "None", variable has type "bool")  [assignment]
2023-07-15 21:52:47 -04:00
Isaiah Odhner
0a6fb29e10 Reorder None case for mypy
While Pyright can narrow down the type of format_id from `str | None` to `str` based on `format_id in Image.SAVE` (where `Image.SAVE` is `dict[str, Any]`), mypy does not.
2023-07-15 21:47:43 -04:00
Isaiah Odhner
641a46e368 Add type hints for mypy 2023-07-15 21:43:50 -04:00
Isaiah Odhner
3ff0b47650 Fix strange default for Window.title reactive var 2023-07-15 21:29:59 -04:00
Isaiah Odhner
eb81d5e934 Add missing annotations, needed for mypy 2023-07-15 21:22:25 -04:00
Isaiah Odhner
1c737fada2 Avoid shell=True and fix mypy errors about mismatching type for args 2023-07-15 21:09:08 -04:00
Isaiah Odhner
1ce0487a52 Fix reportOptionalMemberAccess errors for width/height 2023-07-15 21:09:08 -04:00
Isaiah Odhner
6c1b994598 Smooth over variable getpixel return type, for Pyright 2023-07-15 20:31:02 -04:00
Isaiah Odhner
87f1f50f06 Fix some stupid pyright errors 2023-07-15 20:27:20 -04:00
Isaiah Odhner
6f5cee0f7c Disable reportUnknownMemberType Pyright error 2023-07-15 20:27:20 -04:00
Isaiah Odhner
f50aef18e7 None pizza with left beef 2023-07-15 19:44:05 -04:00
Isaiah Odhner
16f4bc0a88 Fix some mypy errors (and a couple pyright errors) 2023-07-15 19:44:05 -04:00
Isaiah Odhner
dd4fea1e78 Add py.typed for mypy 2023-07-15 19:44:05 -04:00
Isaiah Odhner
4fc5a6e8e5 Clarify a comment
"optional" is ambiguous, between optional arguments (i.e. parameters with a default value), and a union with `None` (i.e. `Optional`, or `| None`)
2023-07-15 19:44:05 -04:00
Isaiah Odhner
cbcf22c4d7 Clean up old _expanding_directory_tree flag, and logging 2023-07-15 19:44:05 -04:00
Isaiah Odhner
54f29eabf1 Fix false positives and false negatives for when to populate file name
When opening the Open dialog, it shouldn't populate the file name input,
but when clicking a file, it should fill in the clicked file's name.

The `_expanding_directory_tree` flag gave false positives:
- When opening a file in a directory the program doesn't have permissions to via the CLI,
  such as with `python -m src.textual_paint.paint /root/nonexistent`,
  opening the Open dialog, and clicking a file, it wasn't populating the filename input,
  because the flag was never cleared if it couldn't find (access) the
  directories and file matching any of the path parts, working down the directory structure.
  
  This was broken in [b3ca55a3b1] "Use new callback to remove race condition"
  but before, it just cleared the flag after a delay, so it wasn't a good solution,

It also gave false negatives:
- When opening the Open dialog, it was populating the name input field
  with the file selected programmatically with `expand_to_path`,
  instead of leaving it blank.
  
  The automatic expansion was broken in [e9755637d6] "Update Textual to 0.26.0"
  due to changes 0.25.0, since directory contents are now loaded in a worker.
  This flag's behavior was broken since rewriting the code to handle asynchronous directory loading in
  [4e1f11ab23] "Fix expanding directory tree to current folder, in file dialogs"

An alternative I considered was to create a new message such as `EnhancedDirectoryTree.NodeHighlighted`, but let's call it `EnhancedNodeHighlighted`, then to have `on_tree_node_highlighted` in `EnhancedDirectoryTree` which sends `EnhancedNodeHighlighted` always with `from_expand_to_path=False`, and then do:

    | # Suppress EnhancedNodeHighlighted with from_expand_to_path=False
    | with self.prevent(self.EnhancedNodeHighlighted):
    | 	self.select_node(node)
    | # Send it with the flag set
    | self.post_message(self.EnhancedNodeHighlighted(..., from_expand_to_path=True))

The solution I settled on was to add an `on_tree_node_highlighted` method to my `EnhancedDirectoryTree` for the purpose of clearing the flag, with still a further delay so that the app's `on_tree_node_highlighted` can use the flag before its cleared.

(I left `_expanding_directory_tree` in at this commit for comparison of the behavior. For a fair estimate of the complexity of this change, include the following cleanup in the diff.)
2023-07-15 19:44:05 -04:00
Isaiah Odhner
1b8b07def9 Move callback outside try block 2023-07-14 00:08:08 -04:00
Isaiah Odhner
f6607195e8 Clarify docstring association 2023-07-13 22:19:55 -04:00
Isaiah Odhner
c97203e882 Add more error handling to Get Colors 2023-07-13 20:03:23 -04:00
Isaiah Odhner
489bd95a20 Ignore permission errors when deleting backup
and improve error message in the general (fallback) case
2023-07-13 19:43:15 -04:00
Isaiah Odhner
6a4351d824 Handle arbitrary exceptions when deleting backup 2023-07-13 19:35:25 -04:00
Isaiah Odhner
6d5ffabcfb Add smaller versions of the Pipe Strip (and sequel)
Making use of the new Stretch/Skew dialog to scale the comic down by 50%
increments, and then hand-editing from there.
2023-07-13 17:32:03 -04:00
Isaiah Odhner
d5b738e034 Add to Known Issues 2023-07-12 17:33:23 -04:00
Isaiah Odhner
67b4ec8ac4 Return to custom zoom level when zooming out and back in 2023-07-12 02:16:24 -04:00
Isaiah Odhner
9876a3c15c Repeat first color in palette when loading a palette
This ensures all colors are part of the palette.
It would be better to allow the number of color wells to change.
2023-07-12 01:51:57 -04:00
Isaiah Odhner
3713e9ed00 Switch color palette to mIRC's palette when saving/opening as mIRC code format 2023-07-12 01:51:57 -04:00
Isaiah Odhner
618fe00d81 Simplify IRC palette data structure, to match regular palette 2023-07-12 01:51:57 -04:00
Isaiah Odhner
967801cf17 Prevent digits in document from merging with mIRC color codes
If digits were present in the document, they were concatenated after
the color codes, and they ran together indistinguishably.
This changed the color index numbers that were read back, to potentially
invalid color indices, and lost the digits as part of the document.
It needs the delimiter of the ending escape code to separate the digits.
2023-07-12 01:51:57 -04:00
Isaiah Odhner
f77d2bba38 Note new format support 2023-07-12 01:44:08 -04:00
Isaiah Odhner
878bf45ea3 Fix nearest color finding 2023-07-11 18:51:12 -04:00
Isaiah Odhner
0eea55e7f6 Make saved mIRC files openable 2023-07-11 18:25:49 -04:00
Isaiah Odhner
645f1ec127 Add missing duplicate error handling for Paste From 2023-07-11 17:19:08 -04:00
Isaiah Odhner
da85d319e4 Add mIRC code export support 2023-07-11 04:00:22 -04:00
Isaiah Odhner
b885436966 Fix drag and drop of files with CharInput focused 2023-07-11 02:02:18 -04:00
Isaiah Odhner
85ba439cbd Fix pasting into CharInput not affecting brush 2023-07-11 02:02:18 -04:00
Isaiah Odhner
2c1069d619 Fix contrast of fieldsets in dark mode 2023-07-11 00:02:39 -04:00
Isaiah Odhner
da0abcbf1e Add stretch/skew icons to dialog 2023-07-10 23:57:48 -04:00
Isaiah Odhner
6309e05d8f Update readme 2023-07-10 23:02:04 -04:00
Isaiah Odhner
2d9ba1ae5f Implement stretch/skew 2023-07-10 21:32:17 -04:00
Isaiah Odhner
b5e52a1463 Conditionally enable angle radio buttons 2023-07-10 19:30:18 -04:00
Isaiah Odhner
f979090b42 Fix layout (Container caused contents to collapse) 2023-07-10 19:10:18 -04:00
Isaiah Odhner
7a81446558 WIP: merge flip/rotate and rotate dialogs 2023-07-10 19:10:18 -04:00
Isaiah Odhner
7d8dddb97f Implement rotate by angle 2023-07-10 18:47:11 -04:00