Commit Graph

6284 Commits

Author SHA1 Message Date
Rodrigo Girão Serrão
8059e5c1a7 Merge branch 'main' into messages-control 2023-05-08 11:18:43 +01:00
Rodrigo Girão Serrão
9c9829eb0f Add 'control' alias to Tabs messages. (#2483)
* Add 'control' alias to Tabs messages.

Related issues: #2478.

* Changelog.
2023-05-08 11:15:19 +01: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
c2a19bd632 Merge pull request #2510 from davep/chainsaw
Add the ability to remove nodes from a `Tree`
2023-05-08 10:51:44 +01:00
Dave Pearson
0bb0f4d179 Merge pull request #2508 from davep/add-options
Add `add_options` to `OptionList`
2023-05-08 10:51:15 +01:00
Rodrigo Girão Serrão
1e2f632fc6 Fix TabbedContent __init__ signature. (#2497) 2023-05-08 10:47:15 +01:00
Willi Ballenthin
483aa54bd6 Catch OSError when source code is not available (#2469)
* Catch OSError when source code is not available

* update changelog with reference to fixed bug
2023-05-08 10:45:56 +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
Dave Pearson
c9d7bb84e2 Update the CHANGELOG 2023-05-08 10:18:34 +01:00
Dave Pearson
6bb2b21091 Update the CHANGELOG 2023-05-08 10:17:36 +01:00
Dave Pearson
745d595d4a Add unit tests for the new node removal methods
See #2462.
2023-05-08 09:55:32 +01:00
Dave Pearson
64d9455d94 Add support for removing the children of a node
Sometimes the user may wish to delete a given node, other times it might be
a requirement to just remove the children (this will be especially useful
for #2448 where we'll want to keep the directory entry itself, but remove
and recreate its contents).

See #2462.
2023-05-08 09:33:21 +01:00
Dave Pearson
f34e738ddd Ensure the cursor node is set to None when the tree goes empty
Up until now there wasn't really a way for the tree to go empty, outside of
clear/reset. Now that we can remove nodes on the fly, that is possible. This
takes that into account.

See #2462.
2023-05-08 09:16:58 +01:00
Dave Pearson
2c39f50150 Ensure the Tree's internal tracker gets updated on node delete
See #2462.
2023-05-08 09:15:28 +01:00
Dave Pearson
1d985abf26 Add TreeNode.remove
This is for removing an individual node, via the node. Note that attempting
to remove the root node of a Tree is an error and will case
TreeNode.RemoveRootError to be raised.

See #2462.
2023-05-08 08:44:29 +01:00
Dave Pearson
4c0d3766a8 Add TreeNode.is_root 2023-05-08 08:44:12 +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
Dave Pearson
b3b98f1089 Simplify the adding of genuine options
Extending a list with an empty list is petty much a no-op so don't bother to
faff around testing for what Python will be testing for anyway.
2023-05-07 18:11:14 +01:00
Dave Pearson
e526a32220 Update the CHANGELOG 2023-05-07 18:07:31 +01:00
Dave Pearson
8be87d5931 Merge branch 'main' into add-options 2023-05-07 18:06:57 +01:00
Dave Pearson
010356a23e Allow zero items to be passed to add_options and do zero work 2023-05-07 18:01:56 +01:00
Dave Pearson
b44983e8d4 Add an add_options method to the OptionList
In doing so, pretty much make the add_option code into the add_options code,
and then just have add_option call add_options.

See #2507.
2023-05-07 17:56:02 +01:00
Dave Pearson
630f59dbd4 Remove unnecessary imports from example in docs
Perhaps a hangover from a previous take on this, or just a copy/paste-o.
Either way I just noticed this so thought I'd roll it in here.
2023-05-07 17:52:55 +01:00
Dave Pearson
14850d54a3 Merge pull request #2485 from davep/testing-testing-123-testing 2023-05-05 11:31:40 +01:00
Rodrigo Girão Serrão
73e4d5c6a7 Fix docs link. 2023-05-04 19:09:31 +01:00
Rodrigo Girão Serrão
a30cd159c4 Add control to TabbedContent message. 2023-05-04 19:04:10 +01:00
Rodrigo Girão Serrão
9d1f0283b2 Add control to RadioSet message. 2023-05-04 19:02:01 +01:00
Rodrigo Girão Serrão
8bf5316d65 Added control to markdown messages. 2023-05-04 19:01:31 +01:00
Rodrigo Girão Serrão
a10d2d9f98 Reference container markdown document.
Adding these references to the sub-widgets that make up a markdown document is necessary in order for the blocks to be able to post messages with a reference to the original document, which in turn is needed for the Message.control property to work.
2023-05-04 19:00:11 +01:00
Rodrigo Girão Serrão
2187a1d4a3 Add control to list view messages. 2023-05-04 18:55:51 +01:00
Rodrigo Girão Serrão
55e2e5d7e3 Add control to tree/dir tree messages. 2023-05-04 18:55:12 +01:00
Rodrigo Girão Serrão
14b70b0819 Add control to option list messages. 2023-05-04 18:53:29 +01:00
Dave Pearson
32fbdbd203 Merge pull request #2482 from davep/tree-lines-fix 2023-05-04 18:30:28 +01:00
Dave Pearson
6139c95f3a Test that the event aliases are actually the same reference
I thought I thought I wanted what I thought but now I think about it I think
I thought wrong and now I think better.
2023-05-04 16:43:20 +01:00
Dave Pearson
8b36d29e74 Add a test for a radio set getting focus when a button gets clicked 2023-05-04 16:22:39 +01:00
Dave Pearson
19f4f64d96 Add tests for selection navigation in a radioset with no buttons pressed 2023-05-04 15:39:33 +01:00
Dave Pearson
e7d3b94334 Test that radioset wraps around when going off the bottom 2023-05-04 15:25:33 +01:00
Dave Pearson
b1443c0162 Test that radioset wraps around when going off the top 2023-05-04 15:22:30 +01:00
Dave Pearson
2113f415a0 Add a test that toggling a pressed radio button has no effect 2023-05-04 15:17:52 +01:00
Dave Pearson
b7cdbb0baa Test to ensure that Changed.control is Control.checkbox 2023-05-04 15:12:15 +01:00
Dave Pearson
0b4d7fb091 Test to ensure that Changed.control is Control.radio_button 2023-05-04 15:10:45 +01:00
Rodrigo Girão Serrão
c4eda48a0a Tweaks to DataTable docs. (#2481)
* Tweaks to DataTable docs.

Related PRs: #2479.

* Fix link.
2023-05-04 14:55:14 +01:00
Dave Pearson
bba694e93a Update the ChangeLog 2023-05-04 14:30:20 +01:00
Dave Pearson
47f52f7692 Merge branch 'main' into tree-lines-fix 2023-05-04 14:27:46 +01:00
Dave Pearson
10e61987e3 Add always_update as a parameter for a var reactive
Redux. I managed to commit the wrong thing last time; although it was using
this and this was done for that.
2023-05-04 14:17:20 +01:00
Dave Pearson
f6da3e9fb2 Add always_update as a parameter for a var reactive 2023-05-04 14:16:34 +01:00
Will McGugan
04083a73f8 exclusive false (#2470)
* exclusive false

* changelog
2023-05-04 11:46:20 +01:00
Rodrigo Girão Serrão
cbd68b20df Datatable scrolling faq (#2477)
* Add FAQ about DataTable scrolling.

Related issues: #2458

* Write concisely.

* Update questions/datatable-doesnt-scroll.question.md

Co-authored-by: Will McGugan <willmcgugan@gmail.com>

* Remove example.

* Add recommendation.

---------

Co-authored-by: Will McGugan <willmcgugan@gmail.com>
2023-05-04 11:42:19 +01:00
Rodrigo Girão Serrão
38592c34bd Add FAQ about DataTable scrolling. (#2466)
Related issues: #2458
2023-05-04 10:35:39 +01:00
Dave Pearson
805970193b Merge branch 'main' into tree-lines-fix 2023-05-04 09:03:59 +01:00