Fix toggling light/dark mode not affecting file/folder icons in tree

I already fixed my first bug caught by the snapshot testing!
These variables were intended as constants, but were being mutated.
I recall writing it as `prefix = (...).stylize_before(...)` and then
moving it to a new line when I realized it was mutation-style method,
not so much the chaining-style factory that I wanted, but I conceived
of it too much as a stylistic distinction in the moment, looking back.
Mutation style means mutation!

Side note: tests also showed a spurious change of a cursor blinking.
I don't really know whether that's in this changeset or not, because
the workflow involves re-running the tests to update the baseline, and
the nice visual diffs provided in the snapshot report aren't available
when viewing the commit diff.
1. If the SVGs were separate files, I could see the diffs on GitHub
   or in GitHub Desktop, and maybe some other Git clients.
   It would also make it a lot easier to simply view the baselines,
   which is useful in general.
2. It would be nice if built-in components didn't cause spurious diffs,
   including the Input's cursor blinking and the Header's clock ticking.
   I already removed the clock from my gallery app, because it's a sort
   of trivial decision, but Inputs I'll have to reckon with.
This commit is contained in:
Isaiah Odhner 2023-09-08 02:00:17 -04:00
parent f09f5fbf55
commit 8a4ca8d380
2 changed files with 325 additions and 325 deletions

View File

@ -172,13 +172,13 @@ class EnhancedDirectoryTree(DirectoryTree):
node_label.stylize(style)
if node._allow_expand: # type: ignore
prefix = (FOLDER_OPEN_ICON if node.is_expanded else FOLDER_CLOSED_ICON)
prefix = (FOLDER_OPEN_ICON if node.is_expanded else FOLDER_CLOSED_ICON).copy()
prefix.stylize_before(base_style + TOGGLE_STYLE)
node_label.stylize_before(
self.get_component_rich_style("directory-tree--folder", partial=True)
)
else:
prefix = FILE_ICON
prefix = FILE_ICON.copy()
prefix.stylize_before(base_style)
node_label.stylize_before(
self.get_component_rich_style("directory-tree--file", partial=True),

File diff suppressed because one or more lines are too long