Commit Graph

1470 Commits

Author SHA1 Message Date
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
Isaiah Odhner
22ce654579 Move method next to other ColorsBox event handler 2023-09-15 23:36:08 -04:00
Isaiah Odhner
82e0fbada7 Re-optimize ColorsBox palette updating 2023-09-15 23:31:29 -04:00
Isaiah Odhner
0647e7be8b Decouple ColorsBox from PaintApp
There's no practical utility in this unless I want to make the palette size variable,
and this makes performance worse updating the screen when the palette changes,
but I'm on a mission to remove `from textual_paint.paint import PaintApp`
since it can't be at top level due to cyclic imports, and it has
side effects when importing `textual_paint.args` in turn.
2023-09-15 23:25:21 -04:00
Isaiah Odhner
a2cf93ae99 Update palette reactively 2023-09-15 23:00:29 -04:00
Isaiah Odhner
f1d288d79c Make palette immutable 2023-09-15 22:53:40 -04:00
Isaiah Odhner
b34c03e788 Tweak changelog entry wording 2023-09-15 22:29:19 -04:00
Isaiah Odhner
80d9f38318 Move ThemedIcon to a separate file 2023-09-15 22:07:04 -04:00
Isaiah Odhner
0f617dd8c4 Dynamically theme message box icons 2023-09-15 22:03:34 -04:00
Isaiah Odhner
7a13659d48 Fix "Show Details" not changing to "Hide Details" when expanding error 2023-09-15 20:44:40 -04:00
Isaiah Odhner
0c44759b28 Refactor to avoid using negative coords to mean "no mouse position"
My TODO comment said "add an attribute to ToolPreviewUpdate or make it's x/y Optional", which is both bad grammar ("it's" vs "its") and a bad idea, since the Canvas isn't involved in this update, so its event definition shouldn't have to be complicated by it.

I like this much better, just splitting the event handler into two functions, giving room to express the optional nature of the coordinate in the signature, and avoiding constructing two message objects at both of the callsites.
2023-09-15 20:21:19 -04:00
Isaiah Odhner
fc1baa9815 Move imports so that Organize Imports doesn't break it
Before, if I ran Organize Imports in VS Code, it reordered things such that `sys.path.insert` was after the import that needed it.
Now it's stable.
2023-09-15 19:56:27 -04:00
Isaiah Odhner
b6e2c245a2 Get file dialog snapshot tests passing on Windows
Now it's just a few round trip tests failing, and maybe a flaky snapshot test for the character selector dialog.
2023-09-15 17:13:15 -04:00
Isaiah Odhner
8cd164bb37 Fix preventing icon swaps during pytest, for Windows Terminal and Kitty
If git blame tools were smarter/easier to use, or if I was using a node-based programming paradigm, I would've never made this mistake. I would have done the natural and correct thing in the first place, but instead, I tried to avoid indenting a large block of code, which generates a noisy commit, and a barrier when using git blame.
2023-09-15 17:08:13 -04:00
Isaiah Odhner
857e459b2d Get tests running, if not passing, on Windows 2023-09-15 17:08:13 -04:00
Isaiah Odhner
40291f29fd Add fake folders to mask OS differences in snapshot tests
Now the tests pass on macOS, not just Ubuntu. Not sure about Windows.
2023-09-15 17:08:13 -04:00
Isaiah Odhner
7838b6373b Tweak changelog 2023-09-14 20:50:48 -04:00
Isaiah Odhner
7fa80b853c Fix flaky test due to pressed button style 2023-09-14 20:22:48 -04:00
Isaiah Odhner
ba4d023387 Fix status bar showing -100, -100 value I used for color updates 2023-09-14 20:21:05 -04:00
Isaiah Odhner
d229bc4108 Ignore new snapshot testing related files for spell checking 2023-09-14 20:08:00 -04:00
Isaiah Odhner
91b2c285fe Re-color in-progress polygon/curve immediately 2023-09-14 20:04:31 -04:00
Isaiah Odhner
ad39f34084 Add Polygon test with dragging 2023-09-14 16:58:47 -04:00
Isaiah Odhner
3f1c6c964a Fix Polygon tool detecting double clicks despite distance 2023-09-14 16:32:40 -04:00
Isaiah Odhner
da7f8f350e Not sure about un-dimming colors in header icon 2023-09-14 16:13:10 -04:00
Isaiah Odhner
b6d0d2cc7b Delete debug scratchpad for polygon test 2023-09-14 15:09:22 -04:00
Isaiah Odhner
bf8e445f69 Make palette state local to the app instance 2023-09-14 02:31:49 -04:00
Isaiah Odhner
faa9c76ba8 Test file drag-and-drop handling 2023-09-14 02:03:52 -04:00
Isaiah Odhner
070e253394 Move fixtures to conftest.py 2023-09-14 01:17:01 -04:00
Isaiah Odhner
9280dcdb92 Fix ASCII-only mode test failures 2023-09-13 23:41:37 -04:00
Isaiah Odhner
3b247cde1a Move window titlebar icons to icons module 2023-09-13 23:27:46 -04:00