Commit Graph

67 Commits

Author SHA1 Message Date
Will McGugan
3ab315beb6 Anim screenshot fix (#2655)
* fix screenshots in docs

* fix anim

* added wait for animation switch

* remove comment
2023-05-25 13:46:14 +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
Rodrigo Girão Serrão
819b2f1eb3 Add DataTable.move_cursor (#2479)
* Add 'DataTable.move_cursor'.

Related issues: #2472.

* Fix #2471.

* Simplify cursor changes.

* Address review feedback.

Related comments: https://github.com/Textualize/textual/pull/2479\#discussion_r1185016002
2023-05-08 10:44:34 +01:00
Rodrigo Girão Serrão
3728555fbd Scroll cursor into view. (#2464)
* Scroll cursor into view.

Related issues: #2459.

* Add regression test.

* Update changelog.
2023-05-03 13:57:04 +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
darrenburns
976bd2f5c2 Move DataTable cursor with page up/down, home, end (#2228)
* Add pageup and pagedown actions to DataTable, with no impls

* Pagedown moves DataTable cursor now

* Account for header height in pagedown action

* Page Up support in the DataTable

* Fix and off-by-1, ensure page up/down works on col cursor

* Add placeholder scroll home/end action handlers to datatable

* Add scroll home and scroll end

* Hide hover cursor when home or end is used

* Ensure home and end work correctly with all curosrs

* Testing home/end/pagedown/pageup cursor movement in DataTable

* Docstrings for new datatable actions

* Fix a broken unit test for the DataTable
2023-04-06 21:22:31 +01:00
darrenburns
17c6f3fc2a Fix for interaction between pseudoclasses and widget-level render caches (#2155)
* Using pseudoclass state in DataTable cache keys

* Use full pseudo-class state on tree cache key

* Adding tests for Widget.get_pseudo_class_state

* Test hiding hover cursor when mouse cursor leaves DataTable

* Update CHANGELOG.md
2023-03-28 14:26:24 +01:00
Will McGugan
a4252a5760 auto table (#2123)
* auto table

* ws

* debug
2023-03-23 15:47:14 +00:00
darrenburns
2ed72e1710 DataTable - fix crash when selection made in empty table (#1973) 2023-03-07 20:58:28 +00:00
darrenburns
b366d1d49c Pilot - add hover and click methods (#1966)
* Delete redundant test file

* Sketch out pilot API improvements - signatures/docstrings

* Pilot click and hover

* Updating test to use new pilot hover method for DataTable

* hover and click methods for Pilot

* Update changelog

* Add docstring
2023-03-07 15:19:23 +00:00
Will McGugan
373fc95fc1 Drop explicit sender attribute from messages (#1940)
* remove sender

* removed priority post

* timer fix

* test fixes

* drop async version of post_message

* extended docs

* fix no app

* Added control properties

* changelog

* changelog

* changelog

* fix for stopping timers

* changelog

* added aliases to radio and checkbox

* Drop sender from Message init

* drop time

* drop cast

* Added aliases
2023-03-06 10:52:34 +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
Darren Burns
921a65816e Ensuring new caches cleared, location mapping reset when clear called 2023-02-16 10:27:56 +00:00
Darren Burns
4ec5d3f9db Migrate some DataTable tests from pilot.pause to wait_for_idle 2023-02-14 15:25:33 +00:00
Darren Burns
5cf1be1cbc Adding test for HeaderSelected event in DataTable 2023-02-14 15:16:22 +00:00
Darren Burns
92087784df Testing DataTable.get_column_at with invalid index 2023-02-14 13:28:48 +00:00
Darren Burns
3b7d24f9c0 Testing DataTable.get_column_at 2023-02-14 13:25:01 +00:00
Darren Burns
6d888af723 Testing DataTable.get_column with invalid column key 2023-02-14 13:22:07 +00:00
Darren Burns
af694ecb97 Testing DataTable.get_column 2023-02-14 13:18:19 +00:00
Darren Burns
fcdff48f0a Testing invalid index and keys in DataTable.get_row* 2023-02-14 12:47:49 +00:00
Darren Burns
8d22ad6ff9 Adding a test for DataTable.get_row_at 2023-02-14 11:52:03 +00:00
Darren Burns
c37061cf18 Adding an explanatory comment to a test 2023-02-14 11:45:27 +00:00
Darren Burns
091adc9d8e Testing get_row (by key) in DataTable 2023-02-14 11:44:35 +00:00
Darren Burns
8a6e44b010 Make DataTable.data private (it's now _data) 2023-02-14 11:00:43 +00:00
Darren Burns
12a58f838f Exception on duplicate row and column keys 2023-02-13 14:09:33 +00:00
Darren Burns
84141630bc Some renaming of API methods 2023-02-09 16:20:17 +00:00
Darren Burns
7ebc95fb54 Updating tests for DataTable 2023-02-09 11:16:14 +00:00
Darren Burns
a6f382660c Fix imports in data table tests 2023-02-08 16:07:17 +00:00
Darren Burns
e4d2cde9cd Unit test to ensure column cursor events posted correctly 2023-02-08 14:20:28 +00:00
Darren Burns
6ffeb5cd8a Unit test to ensure event emission from row cursor correct in DataTable 2023-02-08 14:13:37 +00:00
Darren Burns
2fe73c0c28 Testing highlighted events via keyboard cursor movement 2023-02-08 14:01:42 +00:00
Darren Burns
64840daa0e PEP8 in tests for data table 2023-02-08 13:36:42 +00:00
Darren Burns
54a29dd664 Fix attribute error with emit being remove, check ordered_rows is correct after sort 2023-02-08 13:20:53 +00:00
Darren Burns
10c3deb9d2 Testing reverse sort 2023-02-08 12:49:59 +00:00
Darren Burns
0949211ab6 Unit testing for sorting method 2023-02-08 12:44:02 +00:00
Darren Burns
3cf010ebe7 Testing to ensure the hover coordinate is updated 2023-02-07 11:23:02 +00:00
Darren Burns
0afcc8cd47 Add comment to a test 2023-02-07 11:09:51 +00:00
Darren Burns
3e451e8416 Testing that data inside DataTable events correct on click 2023-02-07 11:09:21 +00:00
Darren Burns
76d2ff2999 Testing clicks in DataTable 2023-02-07 10:49:01 +00:00
Darren Burns
998ee9b8a2 Test to ensure correct exception raised when converting to cell key from coordinate in DataTable 2023-02-02 15:44:25 +00:00
Darren Burns
62fb9d58bd Testing conversion of coordinate to cell_key 2023-02-02 15:40:24 +00:00
Darren Burns
87808c63b2 Tidying some tests 2023-02-02 15:29:26 +00:00
Darren Burns
134ceffd11 Testing to ensure column size calculated correctly 2023-02-02 14:20:33 +00:00
Darren Burns
7748b69e95 Initial unit tests around column width updates 2023-02-02 14:12:14 +00:00
Darren Burns
990a6311bc Extract common coordinate validation logic into method in DataTable 2023-02-02 13:09:11 +00:00
Darren Burns
77b94b005c Testing case where you try to update cells which dont exist 2023-02-01 17:34:03 +00:00
Darren Burns
23a34030cd Measuring string cells correctly 2023-02-01 17:10:59 +00:00
Darren Burns
fd4e13c988 Add tests for DataTable.get_cell_value 2023-02-01 15:43:36 +00:00
Darren Burns
3f463cb0ef Store strings as strings 2023-02-01 14:54:33 +00:00
Darren Burns
abd35436fb Some refactoring, and add cell_key to DataTable.CellSelected 2023-01-31 13:34:13 +00:00