Commit Graph

1499 Commits

Author SHA1 Message Date
Isaiah Odhner
3154ba45a3 Note about activating virtualenv in Bash on Windows 2024-02-01 18:00:00 -05:00
Isaiah Odhner
0baed2d819 VS Code: disable indentation detection to avoid future inconsistency 2024-01-11 20:15:47 -05:00
Isaiah Odhner
4375c518e4 Replace all tabs with spaces for consistency 2024-01-11 20:14:43 -05:00
Isaiah Odhner
2f5d708f4e Clarify a comment 2024-01-11 19:54:27 -05:00
Isaiah Odhner
c2f0435d36 Prepare v0.4.0 2024-01-11 17:44:00 -05:00
Isaiah Odhner
37d38d1509 Add dependencies for release process 2024-01-11 17:43:53 -05:00
Isaiah Odhner
cb5f708c16 Fix typo 2024-01-11 17:15:45 -05:00
Isaiah Odhner
6539dde40e Couch performance claims 2024-01-11 17:13:40 -05:00
Isaiah Odhner
4a4012dbfd Update pyright version
There are no new errors or anything.

This silenced error is no longer generated:
  /home/io/Projects/textual-paint/src/textual_paint/wallpaper.py:241:18 - error: Stub file not found for "xdg" (reportMissingTypeStubs)
2024-01-11 16:35:57 -05:00
Isaiah Odhner
da7f29177d Update changelog 2023-09-28 22:12:25 -04:00
Isaiah Odhner
2fdb832dbd Fix type checker errors
Pyright doesn't understand that fill_style will never be changed,
between its declaration and the inner function's scope.

    error: Argument of type "Color | None" cannot be assigned to parameter "b" of type "Color" in function "colors_match"
      Type "Color | None" cannot be assigned to type "Color"
        Type "None" cannot be assigned to type "Color" (reportGeneralTypeIssues)
2023-09-22 13:29:48 -04:00
Isaiah Odhner
d8206659c6 Make fill tool compare colors numerically (with a threshold) 2023-09-22 13:17:39 -04:00
Isaiah Odhner
f85e161e9e Test fill tool on a spiral 2023-09-22 13:16:16 -04:00
Isaiah Odhner
48a40f63c8 Simplify Color Eraser logic (color comparison) 2023-09-22 13:16:16 -04:00
Isaiah Odhner
c2decd47fe DRY textbox color updating 2023-09-22 13:16:16 -04:00
Isaiah Odhner
cbd85a0102 Add to comment 2023-09-22 13:16:16 -04:00
Isaiah Odhner
00bd187d5a Convert document model to use 2D array of Style objects directly
This brings it back to a single source of truth for the color values.
2023-09-22 13:16:05 -04:00
Isaiah Odhner
7ce6459a27 Fix fill tool 2023-09-21 20:36:09 -04:00
Isaiah Odhner
2b1b40fc12 Fix unbound var 2023-09-21 20:36:09 -04:00
Isaiah Odhner
3cc4d9ff5d Cache Style objects for each cell in the document
This is not worth the complexity. It would be better to just change the document model to replace fg and bg with a 2D array of Style objects, so there's still a single source of truth.

This touches a LOT of code, and cache invalidation is classically known as a hard problem in programming.
2023-09-21 20:36:09 -04:00
Isaiah Odhner
d4e08e136c Simplify initializing textbox colors 2023-09-21 20:36:09 -04:00
Isaiah Odhner
64e63f5cf3 Optimize meta glyph rendering? 2023-09-21 20:36:09 -04:00
Isaiah Odhner
22635bc007 Optimize show_grid state access in Canvas 2023-09-21 20:36:09 -04:00
Isaiah Odhner
7aa256e8df Optimize magnification state access in Canvas
The reactive attribute `magnification` was a performance bottleneck.
Avoid calling the getter (`reactive.__get__`) multiple times,
by storing the value, and passing it to `big_ch` as an argument.

It's still very slow when zoomed in.
2023-09-21 20:36:09 -04:00
Isaiah Odhner
fae2c216f0 Optimize Color and Style construction in Canvas
This does not change anything visually, but the snapshots are changed
because the IDs use a hash which includes color names, and the color
names changed from rgb() style to hex.
2023-09-21 20:36:09 -04:00
Isaiah Odhner
ccbd6cf5ce Remove outdated comment 2023-09-21 20:36:09 -04:00
Isaiah Odhner
4ae90dcb11 Fix missing new scope parameter to parse 2023-09-21 20:34:03 -04:00
Isaiah Odhner
71060ecd70 Use new :light/:dark pseudo classes 2023-09-21 16:17:05 -04:00
Isaiah Odhner
dd982f18b2 Update textual to 0.38.1 2023-09-21 16:14:02 -04:00
Isaiah Odhner
f2f4da73dc Sync setup.cfg with requirements.txt
Write everything twice!

I was thinking the last release was published with textual 0.28.0,
but since I didn't update setup.cfg, it would have been with 0.27.0.
2023-09-21 16:10:58 -04:00
Isaiah Odhner
4cb9b96ce3 Update rich to 13.4.2
The next version, 13.5.0, affects the centering of tool icons.
2023-09-19 00:01:17 -04:00
Isaiah Odhner
cd3137a737 Use new Collapsible widget for error details 2023-09-18 23:43:59 -04:00
Isaiah Odhner
2162ddd125 Update textual to 0.37.1 2023-09-18 22:44:55 -04:00
Isaiah Odhner
268380a0c6 Update textual to 0.36.0
All tests pass... but pyright shows the signature for app.exit changed.
2023-09-18 22:37:01 -04:00
Isaiah Odhner
e435e0a53f Update textual to 0.35.0
All tests are passing, moving on...
2023-09-18 11:50:54 -04:00
Isaiah Odhner
40220e22d2 Fix flaky CharacterSelectorDialogWindow test (hopefully)
This should fix this failure:

    FAILED tests/test_snapshots.py::test_paint_character_picker_dialog[dark_unicode] - textual.css.query.NoMatches: No nodes match <DOMQuery query='CharacterSelectorDialogWindow'>

I noticed this first in a Windows VM, and am now seeing it in Ubuntu,
so it might have to do with the test running slowly.
This was back on textual 0.28.0 by the way; it doesn't have to do with
the recent updates (as far as I know; at least, not entirely.)

I've never had it reproduce when running in isolation with
    pytest tests/test_snapshots.py::test_paint_character_picker_dialog

I tried adding a delay right before the query, and that DIDN'T work,
I got the failure at least once with that in place, so I think it was
failing to detect a double click, rather than querying while the window
was in the process of opening, and so I decided to try increasing the
double click threshold. The click() method of pilot has a cumulative
artificial delay of 0.3s, so two clicks is at least 0.6s and it's not
hard to imagine the event processing pushing that over 0.8s.
I actually created the `DOUBLE_CLICK_TIME` to allow overriding it in
tests, and I'm not sure if this actually works to override it.
2023-09-18 02:00:58 -04:00
Isaiah Odhner
0225ea8780 Update textual to 0.34.0
Tests all pass.
2023-09-18 01:18:49 -04:00
Isaiah Odhner
35a6845ab5 Update textual to 0.33.0
I had to fix the layout of a few dialogs where elements decided they
wanted to start expanding a lot more than before.
I'm guessing this has to do with the changelog entry:
    "Fixed relative units not always expanding auto containers"
    https://github.com/Textualize/textual/pull/3059

The snapshot changes are basically bogus. The before and after are
visually identical, with the difference view showing all black.

Since there were a lot of switches to toggle and I had to wait for the
snapshot tests to run (slow!), I wrote a little automation to toggle
"Show difference" for all the results:

    document.querySelectorAll("#flexSwitchCheckDefault").forEach((element)=> element.click())

It would be good to have this ability in the snapshot report UI itself,
maybe even replacing the individual toggles, although I'm not sure about
that, especially since it might be laggy toggling the blend modes with
a lot of test results. (I suppose if that was really an issue, it could
toggle all the visible test results and then toggle others as they come
into view, though that's a bit more complex.)

As for understanding the structural changes to the snapshots, I tried
making a visualization using hue, coloring according to the position
of a rect within the list of rects:

    const richTerminals = document.querySelectorAll(".rich-terminal");
    
    richTerminals.forEach(function(terminal) {
        const rectElements = terminal.querySelectorAll("rect");
        
        rectElements.forEach(function(rect, index) {
            const fraction = index / (rectElements.length - 1);
            const cycles = 40;
            const hue = fraction * cycles * 360;
            rect.style.fill = `hsl(${hue}, 100%, 50%)`;
        });
    });

This shows some difference, but it isn't very elucidating, since the
structural changes only show as gradual shifts in the hue, and affect
other rects even if said rects are identical, so it's subtle and messy.

Coloring based on a hash proves to actually highlight differences:

    const richTerminals = document.querySelectorAll(".rich-terminal");
    
    richTerminals.forEach(function(terminal) {
        const rectElements = terminal.querySelectorAll("rect");
        
        rectElements.forEach(function(rect, index) {
            const hash = hash(rect.outerHTML);
            const hue = (hash % 360 + 360) % 360;
            rect.style.fill = `hsl(${hue}, 100%, 50%)`;
        });
    });
    
    function hash(s) {
        let hash = 0;
        for (let i = 0; i < s.length; i++) {
            const char = s.charCodeAt(i);
            hash = (hash << 5) - hash + char;
        }
        return hash;
    }

As for analyzing the differences now visible, eh, "maybe later."
2023-09-18 01:08:22 -04:00
Isaiah Odhner
dd9da9cfb1 Update textual to 0.32.0
No changes seem to be needed here.
I'm updating textual-dev too just because it's compatible now.
2023-09-17 00:57:00 -04:00
Isaiah Odhner
3944a6e404 Update textual to 0.31.0
DataTable now has `max-height: 100%` by default, which breaks my layout.
2023-09-17 00:56:49 -04:00
Isaiah Odhner
938a320391 Update textual to 0.30.0
This seems fine.
2023-09-17 00:56:41 -04:00
Isaiah Odhner
28d9a2ff04 Update textual to 0.29.0
This only slightly affects the exact lightness of the grayed out radio button labels, at least as far as the tests cover.
2023-09-17 00:56:21 -04:00
Isaiah Odhner
a0247a0870 Prepare 0.3.0 2023-09-16 23:32:02 -04:00
Isaiah Odhner
99a5441a10 Ignore private access specifically; don't mask future removals/renames
Found these with regexp: /\._.+ type: ignore/
I also looked for: /import (\w+,\s*)*_/
And: /^from (\w+\.)*_/
2023-09-16 23:31:08 -04:00
Isaiah Odhner
06344fb8de Silence type checker warnings (reportOptionalMemberAccess) 2023-09-16 23:31:08 -04:00
Isaiah Odhner
7f9243167c Remove obsolete "type: ignore" comments 2023-09-16 23:31:08 -04:00
Isaiah Odhner
0791b1c080 Satisfy the type checker
`PYRIGHT_PYTHON_FORCE_VERSION=1.1.327 pyright` now gives 0 errors

(before this commit it was 16 errors)
2023-09-16 23:31:08 -04:00
Isaiah Odhner
a6b5cb31be Clean up mocked method FigletFont.preloadFont 2023-09-16 23:31:08 -04:00
Isaiah Odhner
62ee8c2fcf Add publishing section to readme 2023-09-16 23:31:08 -04:00
Isaiah Odhner
3e9f1dd94b Tidy imports 2023-09-15 23:44:22 -04:00