I added the filename = os.path.join(...) which invalidated the positive
filename check. I could move the check earlier, but a negative check
should do nicely.
This commit is mostly a dedent, though git may display the diff poorly
due to the shared line window.close()
I've settled on underscores, for now at least.
Generally I use hyphens.
Built-ins actually use hyphens, like `.-dark-mode`.
Maybe I should be using hyphens.
But for now, consistency is what's important, and I'm using underscores.
Now it's really verbose, but I don't have to worry about reusing
the same name twice. Or coming up with new, fun ones.
https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task
> Important: Save a reference to the result of this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn’t referenced elsewhere may get garbage collected at any time, even before it’s done. For reliable “fire-and-forget” background tasks, gather them in a collection:
>
> background_tasks = set()
>
> for i in range(10):
> task = asyncio.create_task(some_coro(param=i))
>
> # Add task to the set. This creates a strong reference.
> background_tasks.add(task)
>
> # To prevent keeping references to finished tasks forever,
> # make each task remove its own reference from the set after
> # completion:
> task.add_done_callback(background_tasks.discard)
- Move `self.canvas.magnification = self.magnification` up. It happens,
due to internal call_after_refresh, and should happen, before scroll.
- Remove note about other code in JS Paint, I think it's not needed.
- Note my attempts at fixing flicker, which were unsuccessful, so that
I don't try the exact same things later, and feel stupid,
and so I don't accrue so many branches.
Prevent the filename input from being populated in the first place,
instead of resetting after its unintentionally populated when the
directory tree is expanded.
Nip it in the bud. Head it off at the pass. Stop it at the source.
It still needs this new flag to be cleared on a timer, but at least this
timer is near the code for the other timers it needs to trigger after.
Explicitly set filename for Save As dialog, which SHOULD be populated.
Interestingly, this moves the filename input's cursor to the start,
whereas it was positioned at the end when using the timer.
Unfortunately the Input control doesn't support selection,
which is what I would really want as the behavior.
I don't want to bother importing Rich's Color class in addition to
Textual's Color class.
This also doesn't work, which might be the fastest if it worked:
style.color.triplet.red = 255 - style.color.triplet.red
style.color.triplet.green = 255 - style.color.triplet.green
style.color.triplet.blue = 255 - style.color.triplet.blue
style.bgcolor.triplet.red = 255 - style.bgcolor.triplet.red
style.bgcolor.triplet.green = 255 - style.bgcolor.triplet.green
style.bgcolor.triplet.blue = 255 - style.bgcolor.triplet.blue
It's a bad idea, unless applied on a case-by-case basis.
It makes things wrap badly when the viewport is narrow, making things
much less readable, even though the aim is to make it more readable
by ensuring visibility. And it makes message boxes feel less OS-like.
It's better to have to drag a window back and forth to read it, than
to have it wrap at every character.