Commit Graph

6165 Commits

Author SHA1 Message Date
Rodrigo Girão Serrão
d65daf81c0 Address review comments. 2023-05-18 15:07:52 +01:00
Rodrigo Girão Serrão
a058fe53eb Make test clearer. 2023-05-17 11:15:56 +01:00
Rodrigo Girão Serrão
634789ae93 Add tests to screen modes. 2023-05-16 17:40:09 +01:00
Rodrigo Girão Serrão
4d287837a2 Refactor screen stack modes. 2023-05-11 16:42:49 +01:00
Rodrigo Girão Serrão
6e19772563 Add ability to switch between modes. 2023-05-10 16:06:16 +01:00
Rodrigo Girão Serrão
9f3f2033b5 Add default mode. 2023-05-10 14:59:00 +01:00
Dave Pearson
2d75ca0d77 Merge pull request #2536 from davep/expand-tree-expand-messages
Ensure that `TreeNode` messages are posted when via-API changes are made
2023-05-10 14:18:24 +01:00
Rodrigo Girão Serrão
70e97c6703 Merge pull request #2532 from Textualize/sub-title-str
Allow setting (sub)title of any type.
2023-05-10 13:20:47 +01:00
Rodrigo Girão Serrão
8dd627b0f4 Merge branch 'main' into sub-title-str 2023-05-10 13:10:48 +01:00
Dave Pearson
28be54d10d Merge branch 'main' into expand-tree-expand-messages 2023-05-10 10:12:58 +01:00
Dave Pearson
f19f46bba0 Merge pull request #2519 from davep/cygnus-x-1
Fix for `resolve_fraction_unit` zero division error (#2502)
2023-05-10 10:10:55 +01:00
Dave Pearson
c7fc66fa6c Ensure that TreeNode messages are posted when via-API changes are made
Until now the Tree.NodeExpanded and Tree.NodeCollapsed messages were only
sent out when changes were made to the tree by user interaction. This meant
that if any changes were made with the TreeNode expand, expand_all,
collapse, collapse_all, toggle or toggle_all API calls no messages would be
sent.

This PR corrects this.

The work here is, in part, required for #2456 (DirectoryTree lazy-loads
directory information on node expansion so if someone is expanding nodes
under code control the DirectoryTree never gets to know that it should load
a directory's content) and will build on #1644, essentially adding a missing
aspect to the latter PR.
2023-05-10 09:24:07 +01:00
Dave Pearson
0eeadf9ae9 Update the CHANGELOG 2023-05-09 21:01:31 +01:00
Rodrigo Girão Serrão
41466be007 Add docstrings. 2023-05-09 17:10:08 +01:00
Rodrigo Girão Serrão
e8baf52bdd Allow setting (sub)title of any type.
Related issues: #2521.
2023-05-09 16:56:56 +01:00
Dave Pearson
8855471125 Merge pull request #2522 from davep/move-widget-enhanced-testing
Make the widget moving tests more granular and add more tests
2023-05-09 15:07:59 +01:00
Dave Pearson
a0558e87d8 Merge branch 'main' into cygnus-x-1 2023-05-09 13:38:16 +01:00
Dave Pearson
8d7ae4d1fb Ensure that remaining fraction is always above zero 2023-05-09 13:36:32 +01:00
Dave Pearson
ee70713002 Simplify the resolver zero division bug unit test 2023-05-09 13:35:55 +01:00
Dave Pearson
d3de6d1587 Make the widget moving tests more granular and add more tests
Adds two (currently xfail) tests to illustrate #1743
2023-05-09 11:19:00 +01:00
Dave Pearson
a77dbf4bee Tentative fix for resolve_fraction_unit ZeroDivision error
I'll admit to not really following what the code does, so will really need
someone with a better understanding of the aim of this code to look over the
proposed fix; but based on a bunch of runs and hand-debugging, this seems to
do the job.

This passes all existing tests and also removes the reported error.

On the other hand I'm not confident that I'm *not* just masking an
underlying issue with this function.
2023-05-09 10:38:09 +01:00
Dave Pearson
a5cc96cbc7 Make a pass of the #2502 test a fail
If/when I get this actually passing, I want the test to appear to fail so I
know things have changed for the better.

This makes sense, trust me.
2023-05-09 09:44:51 +01:00
Dave Pearson
052ec83b7a Make the test as small as possible 2023-05-09 09:44:30 +01:00
Dave Pearson
089dce1b41 Add a unit test for #2502
Currently marked as xfail, but this gets it down to the most basic level.
2023-05-09 09:39:12 +01:00
Kim van Wyk
dea21a00ca minor typo (#2515) 2023-05-08 20:01:45 +01:00
Will McGugan
e3115c50bf fix for code browser type error (#2514) v0.24.1 2023-05-08 18:42:10 +01:00
Will McGugan
cf7e8a9cb1 update roadmap 2023-05-08 18:10:40 +01:00
Will McGugan
dc102563e9 changelog and release post (#2513)
* changelog and release post

* fix version

* link Select

* remove superfluous css

* Update docs/blog/posts/release2-24-0.md

Co-authored-by: darrenburns <darrenburns@users.noreply.github.com>

* Update docs/blog/posts/release2-24-0.md

Co-authored-by: darrenburns <darrenburns@users.noreply.github.com>

---------

Co-authored-by: darrenburns <darrenburns@users.noreply.github.com>
v0.24.0
2023-05-08 17:45:06 +01:00
Rodrigo Girão Serrão
855c90d4f0 Extend @on decorator to filter matchable attributes (#2498)
* Add tests for #2484.

* Implement @on extension.

[skip ci]
Related issues: #2484.

* Changelog.

* Add missing @on test.

* Remove debug prints.

* Document changes.

* Update tests.

Test now fully works, as of #2490.

* Cache parsed selectors.

* Streamline exit condition.

* Fix typing.

* More succint wording.

* Document 'on' kwargs.

* Update src/textual/_on.py

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

* Update docs/guide/events.md

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

* Change 'on' API.

* Remove example code.

* Address feedback.

* Update src/textual/_on.py

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

* Address review feedback.

* Fix #2499.

* don't require control to be manually specified

* update docstring

* deleted words

---------

Co-authored-by: Will McGugan <willmcgugan@gmail.com>
2023-05-08 17:30:07 +01:00
Will McGugan
dd7e768887 merged changelog sections 2023-05-08 12:51:50 +01:00
Rodrigo Girão Serrão
a31e086a2e Merge pull request #2490 from Textualize/messages-control
Add control to widget messages.
2023-05-08 11:26:31 +01:00
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