Commit Graph

66 Commits

Author SHA1 Message Date
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
Will McGugan
8151946f38 add blur (#2645)
* add blur

* docstring

* blur on disabled

* snapshot test

* Add test
2023-05-24 20:16:11 +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
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
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
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
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
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
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
e87edd79cb Add test for scroll_to_center method. 2023-04-11 13:29:56 +01:00
darrenburns
40cc2db3b9 Fix for viewport units, remove DataTable max-height (#2247)
* Add viewport units snapshot test

* Fix snapshot app

* Update snapshots

* Update DataTable max-height to 100%

* Update CHANGELOG.md

* Remove max height from DataTable CSS
2023-04-10 16:13:48 +01:00
Will McGugan
44367a7422 Expanding fr (#2221)
* forced fr to expand

* margin size

* remove comment

* missing snapshot

* snapshot tests

* changelog

* optimize

* snapshot fix

* snapshot update

* snapshot and fixes

* docstrings [skip ci]
2023-04-06 17:30:32 +01:00
Will McGugan
5c514b0dab scroll visible snapshot (#2225)
* scroll visible snapshot

* change text of test
2023-04-06 11:13:09 +01:00
Will McGugan
eab073e603 Layer scroll fix (#2196)
* fix scroll spacing

* fix and snapshot

* changelog
2023-04-02 09:56:50 +01:00
Will McGugan
eb4c7ef50f Fix issue with modals (#2195)
* Fix issue with modals

* changelog

* fix binding on button

* binding tweak

* changelog

* snapshots

* version bump
2023-04-02 08:52:35 +01:00
Rodrigo Girão Serrão
a06b59f951 Merge branch 'main' into fix-2063 2023-03-28 15:49:07 +01:00
Will McGugan
b005c13956 remove arrangement spacing (#2157)
* remove arrangement spacing

* snapshot test

* comment

* changelog
2023-03-28 15:27:01 +01:00
Rodrigo Girão Serrão
b9c6aec2e6 Add clarifications. 2023-03-28 15:07:39 +01:00
Rodrigo Girão Serrão
e2a16b5696 Add snapshot test for hot reloading. 2023-03-28 15:01:51 +01:00
Will McGugan
472b5cd946 snapshot test 2023-03-23 21:00:26 +00:00
Will McGugan
11cf1f1d28 Fix map invalidation (#2129)
* Invalidation logic

* comment and docstring

* changelog

* snapshot
2023-03-23 18:36:46 +00:00
Will McGugan
3fe04f7b2d Text log scroll end (#2127)
* added switches

* snapshot

* changelog

* tweak docstrings

* Update src/textual/widgets/_text_log.py

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-03-23 17:21:13 +00:00
Will McGugan
a4252a5760 auto table (#2123)
* auto table

* ws

* debug
2023-03-23 15:47:14 +00:00
Will McGugan
461db5dcd6 enable console markup (#2122)
* enable console markup

* changelog

* snapshot
2023-03-23 14:56:35 +00:00
Will McGugan
f5e779c4c4 tabbed content widget (#2059)
* tabbed content widget

* TabbedContent widget and docs

* missing docs

* fix active

* doc fix

* test fix

* additional test

* test for render_str

* docstring

* changelog

* doc update

* changelog

* fix bad optimization

* Update docs/widgets/tabbed_content.md

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

* fix for empty initial

* docstrings

* Update src/textual/widgets/_content_switcher.py

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

* docstring

* remove log

* permit nested tabs

* renamed TabsCleared to Cleared

* added tests, fix types on click

* tests

* fix broken test

* fix for nested tabs

---------

Co-authored-by: Dave Pearson <davep@davep.org>
2023-03-18 10:38:41 +00:00
Will McGugan
43253f5d80 fix border issue (#2074)
* fix border issue

* add PR to changelog
2023-03-16 09:03:02 +00:00
Rodrigo Girão Serrão
285de4b0fa Merge branch 'main' into add-containers 2023-03-14 14:35:23 +00:00
Dave Pearson
dd49a723ee Simplify the disabled snapshot test
Initially this was "throw most if not all widgets at the display and disable
everything" test; but in #2028 it was requested that this be simplified,
just using the same widget, in enabled and disabled states.

Button seems like a good choice here.

To ensure that things work as intended, I'm going with the approach of
disabling via a container as that's one big change that the disabled
facility brought in.
2023-03-13 15:31:29 +00:00
Rodrigo Girão Serrão
cc8f65259e Merge branch 'main' into add-containers 2023-03-13 12:00:08 +00:00
Rodrigo Girão Serrão
48ce1a149d Add snapshot test for Center/Middle. 2023-03-13 11:18:33 +00:00
Will McGugan
9c5e0336f8 Fix scrollbar (#2024)
* Fix scrollbar

* changelog PR

* fix snapshots
2023-03-13 10:39:14 +00:00
Will McGugan
d3bdaf8ae5 fix refresh on remove (#2008)
* fix refresh on remove

* changelog

* optimization

* added snapshot
2023-03-10 10:06:10 +00:00
Rodrigo Girão Serrão
c13308a360 Add tests for Horizontal/Vertical(Scroll) containers. 2023-03-09 17:39:05 +00:00
Rodrigo Girão Serrão
8565d3cef6 Renamed 'Vertical' to 'VerticalScroll'.
Related issues: #1957.
2023-03-08 18:31:24 +00:00
Dave Pearson
b7de48cca3 Border colour percentage (#1954)
* Allow setting an additional alpha on a border

See #1863.

* Update the ChangeLog

* Add snapshot tests for the border alpha value

* Extend the border snapshot tests

While this doesn't test *every* permutation, it covers enough bases that if
something were to change it should catch it.

* Tweak a typo in the border style examples

* Add border transparency percentage to the border docs

* Add a CSS example for using border transparency

* Add Color.multiply_alpha

* Update the CHANGELOG

* Multiply the alpha on a colour rather than replace it

As requested in
https://github.com/Textualize/textual/pull/1954#pullrequestreview-1328170386

(actually required while talking in person with Will, but noted in the
above)

* Multiply the alpha on a border colour rather than replace it

As requested in
https://github.com/Textualize/textual/pull/1954#pullrequestreview-1328170386

(actually requested while talking in person with Will, but noted in the
above)
2023-03-07 14:14:17 +00:00
Will McGugan
41003e356c Fix content width (#1910)
* fix calculation for scrollbars

* added snapshot

* fix for name change

* snapshot

* fix for textual colors

* remove logs

* scrollbar logic

* scroll logic

* remove dead code

* snapshot tests

* scrollbar mechanism

* tidy

* demo tweak

* preset window size

* no need for repaint

* Restore repaint

* wait for idle on pause

* colors tweak

* remove wait for idle

* snapshot

* small sleep

* change stabilizer

* debug tweaks

* remove debug

* remove debug

* snapshot test

* docstring

* changelog

* add pause
2023-03-02 14:39:31 +00:00
darrenburns
cbe2ab87c6 Datatable labelling rows (#1868)
* Renaming some component classes in DataTable

* Some more renaming of DataTable component classes

* Separate styling for fixed rows/columns from labels

* Highlight fixed rows/cols affected by colour differently

* Tweaking styles for fixed data in DataTable

* Update DataTable snapshots

* Add row label to Row metadata

* Wiring up some labelled row logic behind flags

* Renaming variable in DataTable

* Variable renaming in DataTable

* [no ci] Labelling rows progress

* Add RenderedRow abstraction to DataTable

* Computing label widths

* Use the Column object to represent row label column

* Ability to toggle row labels reactively

* Adjust width calculation for label widths

* Add DataTable.RowLabelSelected

* Posting the RowLabelClick message

* Hovering of row labels applies new style

* Remove a print

* Ensure horizontal scrolling with column cursor accounts for row label column

* Account for possible row labels in cell cursor horizontal scrolling

* Ensure cursor highlighting is correct on row label cells

* Document component class for DataTable label hover

* Test to ensure clicking row label emits correct event

* Add snapshot test for DataTable with fixed rows/cols and row labels

* Using pilot pause instead of wait_for_idle directly

* Update CHANGELOG

* Add a docstring

* Add a note to CHANGELOG.md about RowLabelSelected
2023-02-27 10:29:17 +00:00
Will McGugan
8152b2af2d snapshot 2023-02-22 09:59:29 +00:00
Dave Pearson
d90cae3a92 Add Markdown and MarkdownViewer to the disabled snapshot test 2023-02-15 11:26:58 +00:00
Dave Pearson
2379bb46e0 Add type annotation to the DataTable
Now that the new DataTable is merged in.
2023-02-15 11:22:58 +00:00
Dave Pearson
ba9b2e03d9 Merge branch 'main' into promote-disabled 2023-02-15 08:47:20 +00:00
Dave Pearson
26df6aeb00 Tidy up the disabled snapshot test 2023-02-14 16:20:52 +00:00
Dave Pearson
fbd871c3d7 Start a snapshot test for disabled widgets
Eventually this should likely have every user-interactive widget within it.
Perhaps every widget.
2023-02-14 15:52:52 +00:00
Darren Burns
f4cd51e5e8 Merge branch 'main' of github.com:Textualize/textual into datatable-cell-keys 2023-02-09 15:55:45 +00:00
Will McGugan
f450d98e3e snapshot 2023-02-09 11:55:36 +00:00