* Collapsible container widget.
* Expose collapsible widget.
* Add collapsible container example
* Rename member variables as label and apply formatting
* Apply hover effect
* Apply formatting
* Add collapsible construction example with children.
* Wrap contents within Container and move _collapsed flag to Collapsible class from Summary for easier access.
* Add collapsible example that is expanded by default.
* Update collapsed property to be reactive
* Add footer to collapse and expand all with bound keys.
* Expose summary property of Collapsible
* Assign ids of ollapsed, expanded label instead of classes
* Add unit tests of Collapsible
* Rename class Summary to Title
* Rename variables of expanded/collapsed symbols and add it to arguments..
* Add documentation for Collapsible
* Update symbol ids of Collapsible title
* Update src/textual/widgets/_collapsible.py
Correct import path
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
* Sort module names in alphabetical order
* Clarify that collapsible is non-focusable in documentation.
* Add version hint
* Fix documentation of Collapsible.
* Add snapshot test for collapsible widget
* Stop on click event from Collapsible.
* Handle Title.Toggle event to prevent event in Contents from propagating to the children or parents Collapsible widgets.
* Update Collapsible default css to have 1 fraction of width instead of 100%
* Update Collapsible custom symbol snapshot
* Add Collapsible custom symbol snapshot as an example
* Update docs/widgets/collapsible.md
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
* Update src/textual/widgets/_collapsible.py
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
* Fix typo in Collapsible docs
* Rework collapsible documentation.
---------
Co-authored-by: Sunyoung Yoo <luysunyoung@aifactory.page>
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
* Add a notification class and a class to hold notifications
This provides the core classes for holding information on a single
notification, and then on top of that a class for managing a collection of
notifications.
* WiP: End of day/week commit to pick up post-holiday
* Ask permission rather than forgiveness
Yes, this does go against all things Pythonic, but in this case it's likely
less costly to do the check first; moreover it works around the problem I
ran in to: https://github.com/Textualize/textual/issues/2863
* Move the handling of "I've seen this" into the toast rack
This way the interface becomes "here's a bunch of notifications, you go work
this out".
* Add a notify method to all widgets
* The removal time for a toast should be the time left
When it was per-screen, it made sense that it was the timeout; now that
we're carrying them over between screens we're going to make sure they're
only around for as long as they need to be.
* Carry notifications between screens
* Remove the test code
* Drop the borders from the toasts
Except for the title, keep that.
* Provide access to the notification timeout
* Remove the title panel from a Toast if the title is empty
* Make the Toast CSS classes "private"
Prefix with a - to reduce the chance of a clash with userspace.
* Refresh a docstring
* Stop widget leakage
The Toasts were removing themselves, but they're wrapped inside a helper
container that keeps them aligned right. So the problem was that the
alignment containers were leaking. This ensures that when a Toast goes away
it takes its parent with it.
* Make the alignment container hidden
This doesn't really make any difference, but it feels like it makes sense to
hide it if there's nothing to show -- it's purely for alignment.
* 🚚 Rename the toast container
This is about getting the toasts to align correctly (even when you do align
things, they don't really align as expected due to the way that a container
aligns the bounding box of all if its children, not the individual
children). However, I had this named after where it aligned them to; someone
using the system may wish to change that, so let's make the name more
generic.
* Improve ToastRack._toast_id
Add a docstring, and also change the format of the identity somewhat so that
it's even "more internal".
* Add some initial low-level notification testing
* Add initial testing of notifications within an application
* Add tests for notifying from the 3 main levels within the DOM
* Add a toast example to the docs and a snapshot test
This might not be the final form, but it'll do for the moment. I want to get
the snapshot test in place at least.
* Add a snapshot test for notifications persisting between screens
* Add some documentation for a Toast
This isn't going into the index, just yet. This is *technically* an internal
widget so I'm not sure how and where it makes sense to document it; if at
all. But let's get some documentation in here anyway.
* Flesh out the docstrings for the notify methods
* Add a missing docstring to the Notifications __init__ method
* Add snapshot tests for persisting notifications through mode switches
* Remove unused import
Looks like eglot/pyright tried to be "helpful" at some point and I didn't
notice.
* Correct the Toast severity level classes in the docs
Originally they weren't in the "internal" namespace, then I decided that
they should be so there's less chance of a clash with dev-space code; but I
forgot to reflect this in the docs.
This fixes that.
* Make the removal of notifications/toasts a two way thing
The addition of the ability to dismiss a toast by clicking on it had a flaw:
the notification->toast code had been written with things being one way. The
expiration of notifications happened in the notification handler, and the
expiration of Toasts was done in the Toast system, on purpose (notifications
might end up being routed via elsewhere so this needs to be done).
But... this meant that hand-removed Toasts kept coming back from the dead
when a new notification was raised iff the hand-removed ones hadn't yet
expired.
So here I add the ability the remove a notification from the notification
collection.
* Remove an unhelpful comment
Sort of a hangover from what was initially looking like it was going to be a
longer body of code. It doesn't really need explaining any more.
* Add in support to the notification collection
* Change the toast rack adder to be a general "show" method
This turns the method into one that further aids making the connection
between the notifications and the toasts two way. Now it makes sense that if
there are toasts for notifications that no longer exist, they also get
removed.
This makes it easier to add all sorts of clear options later on.
* Add a method to clear notifications
* Add an App method for clearing all existing notifications
* Add a missing docstring to _refresh_notifications
* Return the notification from the notify methods
It can be seen as, and used as, a handle of sorts (see unnotify); so return
it so people can use it.
* Add some more notifications unit testing
* Add some more app-level notification unit testing
* Style tweaks
* docs
* added notifications
* snapshots
---------
Co-authored-by: Will McGugan <willmcgugan@gmail.com>
* WiP: Move the devtools and related code to `textual-dev` (#2834)
* Remove the textual script from the project file
This is moving into the textual-dev package.
* Remove the textual CLI code from Textual
This has all gone to live in textual-dev.
* Remove the devtools testing from Textual's unit tests
They've moved over to textual-dev instead.
* Remove the devtools server from Textual itself
The start of the process to remove as much of the core devtools as possible
from Textual.
* Switch the console docs example screenshot over to textual_dev
* Remove rednerables.py from Textual
* Remove the last parts of devtools from Textual
This is the last step. It remains to be seen if this is sustainable, but for
testing purposes this is the extreme case we're aiming for. I *think* this
will work though.
Hereon we'll be needing to do an editable install of textual-dev into
textual, and more generally and once this is "live" we'll be needing to make
sure that textual[dev] is installed when doing development work on textual
apps.
The thing that remains to be seen however is how this all works
with *developing* Textual itself. Will I always need to do an editable
install? Still got to figure that one out.
* Start to whittle down the pyproject file
The next step is to try and work out what can come out of the pyproject
file.
* Remove aiohttp from Textual
* Remove some more development dependencies we don't need any more
* Relock
* Remove the pointer to the previews directory
* Reintroduce the border preview snapshot test
* Reintroduce the color preview snapshot test
* Reinstate the key press for the border preview snapshot test
* Reintroduce the easing preview snapshot test
* Reintroduce the keys tool snapshot test
* Add pytest-asyncio as a development dependency
* Relock
* Pin the textual-dev version to 0.1.0 or later
Mostly to try and get the tests kicked off properly.
* Relock dependencies
* Further `textual-dev` changes (#2850)
* Remove the textual script from the project file
This is moving into the textual-dev package.
* Remove the textual CLI code from Textual
This has all gone to live in textual-dev.
* Remove the devtools testing from Textual's unit tests
They've moved over to textual-dev instead.
* Remove the devtools server from Textual itself
The start of the process to remove as much of the core devtools as possible
from Textual.
* Switch the console docs example screenshot over to textual_dev
* Remove rednerables.py from Textual
* Remove the last parts of devtools from Textual
This is the last step. It remains to be seen if this is sustainable, but for
testing purposes this is the extreme case we're aiming for. I *think* this
will work though.
Hereon we'll be needing to do an editable install of textual-dev into
textual, and more generally and once this is "live" we'll be needing to make
sure that textual[dev] is installed when doing development work on textual
apps.
The thing that remains to be seen however is how this all works
with *developing* Textual itself. Will I always need to do an editable
install? Still got to figure that one out.
* Start to whittle down the pyproject file
The next step is to try and work out what can come out of the pyproject
file.
* Remove aiohttp from Textual
* Remove some more development dependencies we don't need any more
* Relock
* Remove the pointer to the previews directory
* Reintroduce the border preview snapshot test
* Reintroduce the color preview snapshot test
* Reinstate the key press for the border preview snapshot test
* Reintroduce the easing preview snapshot test
* Reintroduce the keys tool snapshot test
* Add pytest-asyncio as a development dependency
* Relock
* Pin the textual-dev version to 0.1.0 or later
Mostly to try and get the tests kicked off properly.
* Relock dependencies
* Whitespace cleaning
* Swap mentions of textual[dev] to textual-dev
* Remove the dev extra
* Tweak README.md in response to PR review
* Tweak animation.md in response to PR review
* Tweak getting_started.md in response to PR review
* bump version
* lock
* drop dev
* more
* version bump
---------
Co-authored-by: Dave Pearson <davep@davep.org>
* blog post new release
* update words
* Update docs/blog/posts/release0-27-0.md
Co-authored-by: Dave Pearson <davep@davep.org>
---------
Co-authored-by: Dave Pearson <davep@davep.org>
* A few different types of validation
* Rename
* Fix test
* Updating validation framework
* Update lockfile
* Ensure validators can be None
* Reworking the API a little
* Convert Input.Changed to dataclass
* Add utility for getting failures as strings
* Update an example in Validator docstring
* Remove some redundant `pass`es
* Renaming variables
* Validating Input on submit, attaching result to Submitted event
* Testing various validation features
* Update snapshots and deps
* Styling unfocused -invalid Input differently
* Add snapshot test around input validation and associated styles
* Validation docs
* Tidying validation docs in Input widget reference
* Fix mypy issues
* Remove __bool__ from Failure, make validator field required
* Code review changes
* Improving error messages in Validators
* First prototype of PB.
* Repurpose UnderlineBar.
* Factor out 'Bar' widget.
* Revert "Factor out 'Bar' widget."
This reverts commit 0bb4871adf.
* Add Bar widget.
* Cap progress at 100%.
* Add skeleton for the ETA label.
[skip ci]
* Add ETA display.
* Improve docstrings.
* Directly compute percentage.
* Watch percentage changes directly.
[skip ci]
* Documentation.
* Make reactive percentage private.
Instead, we create a public read-only percentage property.
* Update griffe to fix documentation issue.
Related issues: #1572, https://github.com/mkdocstrings/griffe/issues/128.
Related PRs: https://github.com/mkdocstrings/griffe/pull/135.
* Add example and docs.
* Address review feedback.
[skip ci]
* More documentation.
* Add tests.
* Changelog.
* More tests.
* Fix/fake tests.
* Final tweaks.
Initially we went with a RadioSet being a simple container of RadioButtons,
with the user navigating the RadioButtons like you would any other set of
widgets. This was fine but it became pretty clear pretty quickly that having
to tab through a non-trivial collection of buttons in a set to get to the
next widget wasn't ideal.
This commit, satisfying #2368, takes over the navigation of the buttons
within the container, makes the container itself a focusable widget, and
sets up some new bindings to allow a more natural and efficient interaction
with the set.
* Remove hanging lines from docstrings.
Deleted hanging blank lines at the end of docstrings.
Regex pattern:
- find `\n\n( *)"""`
- replace with `\n$1"""`