Commit Graph

269 Commits

Author SHA1 Message Date
darrenburns
a40300a6f5 Ensure reflow reflows non-visible widgets, fix scroll_to_center issue (#2684) 2023-05-29 18:23:49 +01:00
Rodrigo Girão Serrão
fd57309ad0 Make validators kwd-only. 2023-05-25 17:57:33 +01:00
Rodrigo Girão Serrão
31e2d1c839 Merge branch 'main' into input-auto-completion 2023-05-25 17:42:37 +01:00
Dave Pearson
400043dda1 Update snapshit tests 2023-05-25 14:47:11 +01:00
Dave Pearson
93c3c3652b Merge branch 'main' into multiselect 2023-05-25 13:59:34 +01:00
darrenburns
62fcefbd2d Validation (#2600)
* 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
2023-05-25 13:29:33 +01:00
Dave Pearson
51f8d0dc9a Break up the SelectionList snapshit tests
Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-05-25 13:20:22 +01:00
Dave Pearson
939586f5f8 Add snapshot tests for the SelectionList examples 2023-05-25 11:06:21 +01:00
Will McGugan
8151946f38 add blur (#2645)
* add blur

* docstring

* blur on disabled

* snapshot test

* Add test
2023-05-24 20:16:11 +01:00
Rodrigo Girão Serrão
297549c7d8 V2 of input suggestions API. 2023-05-23 10:47:22 +01:00
Rodrigo Girão Serrão
6523fbaff1 Fix tests. 2023-05-18 16:27:09 +01:00
Rodrigo Girão Serrão
75606c8dfd Add explicit sleep. 2023-05-18 16:11:02 +01:00
Rodrigo Girão Serrão
bfdaf02f66 Add snapshot test. 2023-05-18 14:26:32 +01:00
Rodrigo Girão Serrão
03a43521dd Fix test. 2023-05-18 14:02:51 +01:00
Rodrigo Girão Serrão
38f9500642 Fix test. 2023-05-17 11:35:10 +01:00
Rodrigo Girão Serrão
dea133d357 Merge branch 'main' into auto-focus-improv 2023-05-17 10:28:54 +01:00
Rodrigo Girão Serrão
45686c8aca Fix tests. 2023-05-17 10:27:57 +01:00
Will McGugan
53e765f7d6 Avoid docks when scrolling (#2571)
* handle docked layers

* handle scroll better

* snapshot update

* remove commented out code

* superflous

* dock gutter

* snapshit

* snapshit test

* changelog

* mistake

* docstrings

* changelog

* whitespace

* missing punctuation

* ofx docstring

* Apply suggestions from code review

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>

---------

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-05-16 21:34:59 +01:00
Dave Pearson
1ebfe2f418 Update the snapshits 2023-05-16 14:38:11 +01:00
Dave Pearson
3d2e3d9092 Add a snapshot test for a rebuilt Select
This helps test the practical impact of the fix added for #2557.
2023-05-16 14:34:18 +01:00
Rodrigo Girão Serrão
a6ee867ee3 Fix tests. 2023-05-16 11:39:38 +01:00
Will McGugan
d266e3685f snapshot update (#2555) 2023-05-12 18:57:53 +02:00
Will McGugan
7db7139bb8 Select widget (#2501)
* overlay rule

* select WIP

* select control, made binding description optional

* changelog

* style tweak

* Added constrain

* changelog

* test fix

* drop markup, tidy

* tidy

* select namespace

* tests

* docs

* Added changed event

* changelog

* expanded

* tests and snapshits

* examples and docs

* simplify

* update reactive attributes

* type fix

* docstrings

* allow renderables

* superfluous init

* typing fix

* optimization

* revert optimizations

* fixed words

* changelog

* docstrings

* don't need this

* changelog

* comment

* Update docs/widgets/select.md

Co-authored-by: Dave Pearson <davep@davep.org>

* review changes

* review updates

---------

Co-authored-by: Dave Pearson <davep@davep.org>
2023-05-08 10:55:39 +01:00
Dave Pearson
84ddd09223 Add extra snapshit tests
This tests the three main ways of making an option list, and ensures they
all turn out the same.
2023-05-07 20:26:12 +01:00
Will McGugan
41dbc66b23 optimize focus (#2460)
* optimize focus

* immediate call

* update previews

* snapshot
2023-05-03 11:48:56 +01:00
Dave Pearson
2ad3903d43 Remove the bytewise diffing of failed snapshots
In doing so this removes the file similarity value, and as such the key that
the failure report was sorted on. This was done because, given how many
snapshot tests we have now, if lots failed, it would take a long time (often
many minutes) to compile the report.

The report is now sorted on the test name.

Now, no matter how many snapshots fail, the report should be produced pretty
much instantly.
2023-05-02 13:47:18 +01:00
Will McGugan
124c45e68c Bump0220 (#2405)
* Version bump

* upate version

* fix domain name

* wrong project

* skip on Windows

* disable demo snapshot

* 37 fix
2023-04-27 15:01:46 +01:00
Will McGugan
dd70a7a2dc fix for min and max with fr unints (#2390)
* fix for min and max with fr unints

* snapshit

* forgot snapshit tests

* fix resolve

* added unit tests

* Windoze fix
2023-04-27 13:35:16 +01:00
Rodrigo Girão Serrão
4148b1d450 Implement a Progress Bar widget. (#2333)
* 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.
2023-04-26 15:25:39 +01:00
Dave Pearson
7a536c790c Demo snapshot test back up to a 250 wait
Waiting 100 resulted in a fail, so let's bump back up again.
2023-04-25 15:49:43 +01:00
Dave Pearson
db45287646 Lower the wait for the demo snapshot test
250 worked; so let's try it lower.
2023-04-25 15:41:02 +01:00
Dave Pearson
88926a4bb8 Force a wee wait when testing the demo
This keeps randomly failing in Windows in CI; multiple subsequent runs gets
it going in the end, normally one further fail at a time. So let's throw a
wee wait on the end and see if that helps.
2023-04-25 15:27:43 +01:00
Dave Pearson
c45f9358ee Change RadioSet so it's less a container of widgets and more a widget
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.
2023-04-25 15:00:44 +01:00
Dave Pearson
e16493bf81 Update the snapshot tests
This is necessary now that a focused RadioSet has acquired a border colour
similar to that if a focused Input.
2023-04-25 11:27:23 +01:00
Dave Pearson
ca94c5eed0 Merge branch 'main' into no-container-scroll 2023-04-24 11:35:47 +01:00
Rodrigo Girão Serrão
e5033d7d23 Remove hanging lines from docstrings. (#2349)
* Remove hanging lines from docstrings.

Deleted hanging blank lines at the end of docstrings.

Regex pattern:
 - find `\n\n( *)"""`
 - replace with `\n$1"""`
2023-04-24 11:21:38 +01:00
Dave Pearson
b896e9d7f9 Update tests to handle scroll changes to Container
See #2361.
2023-04-24 11:10:37 +01:00
Will McGugan
a2633ca31e fix text opacity (#2356) 2023-04-22 08:50:14 +01:00
Will McGugan
cab4925eaa New CLI runner (#2338)
* New CLI runner

* runner functionality

* Add port

* use env for port

* changelog

* test fix

* flush

* remove constant

* comment

* tidy docs

* docstrings

* punctuation

* docstring

* fix test

* snapshot

* Update src/textual/cli/cli.py

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>

* guard against bad imports

* guard againsts screenshot

* always print return

* docstrings

* docstrings

---------

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2023-04-20 17:09:39 +01:00
Rodrigo Girão Serrão
66a644845b Prevent reactive-watcher loop in Tabs / TabbedContent. (#2305)
* Add regression test for #2229.

* Fix potential reactive-watch loop.

* Simplify regression test.

Labels are cheaper to use and the final visual result of the test won't depend on the directory it runs from.

* Simplify solution.

Turns out I didn't need a descriptor. :(

* Fail on empty tab.
2023-04-18 11:48:33 +01:00
Rodrigo Girão Serrão
3a7cf08ef2 Make scrollable containers focusable. (#2317)
* Make scrollable containers focusable.

Related issues: #2270.
2023-04-18 11:44:32 +01:00
Will McGugan
0509cf8948 Border style (#2292)
* border styles

* docs for border styles

* fix tests

* tests

* tests and docs

* changelog

* implement auto

* style information fix
2023-04-16 12:31:39 +01:00
Rodrigo Girão Serrão
bb2c31ba35 Add --port option to textual console. (#2258)
* Add --port option to textual console.

* Changelog.

* Address review feedback.

* Mark unpredictable test as xfail.

This test gets an xfail mark until #2254 is open.

* Make DEVTOOLS_PORT a constant.

Related review: https://github.com/Textualize/textual/pull/2258\#discussion_r1165210395

* Factor logic into function.

Related review: https://github.com/Textualize/textual/pull/2258\#discussion_r1165298259

* Remove dead import.
2023-04-13 11:57:35 +01:00
Rodrigo Girão Serrão
663b09736e Scroll to center when tab is clicked.
Related comment: https://github.com/Textualize/textual/issues/2256#issuecomment-1505551728
2023-04-12 22:25:37 +01:00
darrenburns
6369c37907 Ensure styles applied in correct order in DataTable (#2272)
* Ensure styles applied in correct order in DataTable

* Add snapshot regression test for datatable style ordering

* Update CHANGELOG
2023-04-12 14:45:24 +01:00
darrenburns
6352ceb61b Datatable remove row (#2253)
* Checking in remove_row progress

* Ensuring structures updated correctly when row deleted

* Clamping index

* Failed attempt

* Removing rows

* Update a type hint in DataTable

* Remove some code that wasnt required

* Use index syntax instead of get

* Add DataTable remove row test

* Snapshot tests for removing rows

* Add a docstring for DataTable.remove_row method

* Update changelog regarding DataTable.remove_row

* Add check_idle call to remove_row
2023-04-11 18:48:58 +01:00
Rodrigo Girão Serrão
8fe9e97fd7 Restore deleted snapshot tests. 2023-04-11 14:23:45 +01:00
Rodrigo Girão Serrão
2588cfdb0d Update snapshot test. 2023-04-11 13:39:24 +01:00
Rodrigo Girão Serrão
454254fab4 Implement scroll_to_center method. 2023-04-11 13:36:34 +01:00
Rodrigo Girão Serrão
e87edd79cb Add test for scroll_to_center method. 2023-04-11 13:29:56 +01:00