* Handle other Tabs widgets as DOM descendants of a TabbedContent
* Update CHANGELOG.md
* Ensure TabbedContent can identify messages from the associated Tabs so that it can ignore messages from other, irrelevant Tabs instances that may exist as descendants deeper in the DOM. Also adds some tests to ensure corresponding issues are fixed.
* Improve docstrings for Tabs.Cleared and corresponding handler inside TabbedContent - it now includes a note that the Cleared message is sent when all tabs are hidden.
* Modifying two flaky animation tests, hopefully removing flakiness :)
* Make switch_mode return an AwaitMount
* Fix event issue
* Add AwaitComplete - a more generalised optionally awaitable object
* Use AwaitComplete in Tabs.remove_tab() and update tests accordingly.
* Update TabbedContent to use AwaitComplete instead of AwaitTabbedContent
* Simplifying - dont use optional awaitables where not required
* Update variable name
* Update a comment
* Add watcher for cursor blink to ensure when blink is switched off, the cursor immediately becomes visible. Ensure we turn of cursor blink inside the input suggetions snapshot test.
* Fix cursor blink reactive and disable cursor blink in the command palette snapshot test
* More progress
* Reworking AwaitComplete
* Some more work on tabs flakiness/race-conditions
* Ensure active tab is set correctly
* Simplify next tab assignment
* Simplify removing tabs logic
* Make button animation duration configurable; Switch off button animation in snapshot test
* Remove a flawed test
* Add awaits in some tests
* Docstrings
* Make active_effect_duration an instance attribute
* Fix a Tabs crash
* Await the tree reload when the path changes in DirectoryTree
* Change AwaitComplete _instances class attr to a set from a list
* Make AwaitComplete generic, AwaitComplete._wait_all is now private, and exposes timeout parameter
* Actually make AwaitComplete instances a set, not a list
* Update CHANGELOG.md regarding flaky-test adjacent changes, AwaitComplete, etc..
* Remove whitespace
* Use list() instead of useless comprehension, remove unused import
* Ensure loading indicator _start_time is initialised correctly
* Switch from time.sleep to asyncio.sleep in a notifications test, rework numbers to try and prevent flakiness
* Resolve deadlock by awaiting event on the event loop instead of in the message pump
* Renaming for clarity
* Debugging for remove_tab test flakiness
* Running all tests
* Updating snapshots
* Remove debugging prints
* Fix broken docstring, remove unused import
* Rename variable to make it clearer
* Add missing return type annotation
* Update src/textual/widgets/_tabbed_content.py
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
* Update src/textual/widgets/_tabbed_content.py
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
* Update src/textual/widgets/_tabs.py
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
* Scroll datatable cursor after refresh
* Add comment explaining use of call_after_refresh when scrolling data table cursor into view
* Add repr to AwaitComplete (auto-repr_
* Remove use of generics from AwaitComplete
* Update changelog and improve docstring
* Add a missing parameter from DirectoryTree.reset_node docstring.
Signed-off-by: Darren Burns <darrenb900@gmail.com>
* Improve docstring in DirectoryTree
Signed-off-by: Darren Burns <darrenb900@gmail.com>
* Rename parameter coroutine to coroutines in await_complete.py, since it's a variable length param.
---------
Signed-off-by: Darren Burns <darrenb900@gmail.com>
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
* Add a unit test for https://github.com/Textualize/textual/issues/2807
* Add a test for removing tabs in reverse
* Add a test for the messages sent when removing tabs in reverse
Marked as xfail for the moment, I suspect the root cause of #2807.
* Don't sent Changed when tab removal doesn't result in change
* Update the CHANGELOG
---------
Co-authored-by: Will McGugan <willmcgugan@gmail.com>
The tests touched in this commit are working fine in CI for GNU/Linux and
macOS; but fail on Windows as the message we need to come through doesn't
seem to be coming through.
Testing on Windows (11, in Parallels, on macOS) it seems that setting an
actual time for the pauses does the trick. I'm not sure why, I thought a
pause with no time ensured that all message queues were emptied before
coming out of the pause. Apparently not.
So this is an experiment to see if it'll pass in CI too.
Much like Tabs.Cleared, this indicates that all available tabs/panes have
been removed and the widget is now empty. This is especially important here
as the way we remove tabs is such that we can't await their removal and then
make the remove methods async (because Tabs doesn't allow for that).
So the approach taken here is to send a message from TabbedContent, and
delay it as much as possible, ideally once the action that's taking
place *has* taken place.
The reasoning is: a user may clear down all panes, then want to add some
back, possibly with IDs they've used before. The clear down might not have
fully happened, but we can't await it all, so the approach for the user
would be to wait until the Cleared message turns up *then* repopulate.
This particular test seems rather flakey in GitHub's actions. In most cases
passing, with the odd fail here and there (normally when unrelated changed
are made -- I've had this fail when docs have been changed; zero code
changes!)
So, on the off chance that a little extra pause will help...
Ensures that the actual content gets changed when TabbedContent.active is
updated via code. Also adds more testing for TabbedContent.
See #2352 for details.
* Add a message for the tabbed content activated
* Add a docstring
* Testing tabbed content activated message
* Update changelog
* Add reference to the docs about TabbedContent.TabActivated