Commit Graph

1149 Commits

Author SHA1 Message Date
Will McGugan
8f0f0d8c12 refactor 2023-01-13 10:44:13 +00:00
Will McGugan
027635b978 merge 2023-01-12 17:45:36 +00:00
Rodrigo Girão Serrão
feb8591e72 Fix test: await widget mount before focusing
Follow-up to #1548
2023-01-12 16:11:36 +00:00
Rodrigo Girão Serrão
510df0c375 Merge branch 'main' into fix-1399 2023-01-12 15:50:06 +00:00
Rodrigo Girão Serrão
a3e54323d9 Make methods private. 2023-01-12 15:48:49 +00:00
Rodrigo Girão Serrão
ab0d9d569e Merge pull request #1548 from Textualize/fix-1477
Improve `Input` view position calculation
2023-01-12 15:13:03 +00:00
Rodrigo Girão Serrão
dd478dd249 Make list_view snapshot test pass more reliably 2023-01-12 15:00:56 +00:00
Rodrigo Girão Serrão
dc318b8c93 Update tests. 2023-01-12 14:39:05 +00:00
Rodrigo Girão Serrão
c2f289e472 Add failing test. 2023-01-12 10:58:14 +00:00
Rodrigo Girão Serrão
0bc10f0ec4 Add regression tests. 2023-01-11 19:15:10 +00:00
Rodrigo Girão Serrão
d966665345 Address review comments. 2023-01-11 16:05:44 +00:00
Rodrigo Girão Serrão
f5d8de4194 Add test for COMPONENT_CLASSES inheritance. 2023-01-11 15:09:14 +00:00
Dave Pearson
d0ea967aa4 Merge branch 'get-treenode-by-id' of github.com:davep/textual into get-treenode-by-id 2023-01-10 15:30:12 +00:00
Dave Pearson
494c63a72b Tweak the unknown node ID exception
See https://github.com/Textualize/textual/pull/1535#discussion_r1065904713
and https://github.com/Textualize/textual/pull/1535#discussion_r1065909144
2023-01-10 15:28:17 +00:00
Dave Pearson
c027a06ee2 Merge branch 'main' into get-treenode-by-id 2023-01-10 14:59:36 +00:00
Dave Pearson
728acc27c0 Introduce an exception specific to handling an unknown node ID
See https://github.com/Textualize/textual/pull/1535#discussion_r1065873649
2023-01-10 14:57:35 +00:00
Dave Pearson
4c75d1cb48 Merge pull request #1528 from davep/tree-node-highlighted-message
Add `Tree.NodeHighlighted` message
2023-01-10 14:44:03 +00:00
Rodrigo Girão Serrão
0f3aff6fb1 Merge pull request #1408 from Textualize/review-styles-reference
Review styles reference
2023-01-10 14:20:11 +00:00
Dave Pearson
6ea68cc112 Add Tree.get_node_by_id
The thinking here is that a user of a Tree may want to relate notes to other
parts of their UI, or other data in their application. While this could be
done by keeping a reference to the node itself, it could also be beneficial
to just track the ID. Given that ID is a public property of a TreeNode, but
given it doesn't currently have any other (public) purpose, this seems to
add some useful symmetry.
2023-01-10 10:42:07 +00:00
Rodrigo Girão Serrão
d9a0c343d7 Update snapshot tests. 2023-01-09 16:42:15 +00:00
Rodrigo Girão Serrão
e5375d0a2f Reset color cycle before tests.
We need to reset the color cycle for placeholders before each CSS property test because we need to ensure consistent colouring of the placeholders as tests are added/removed/reordered.
2023-01-09 16:26:33 +00:00
Rodrigo Girão Serrão
5cad93220e Merge branch 'main' into review-styles-reference 2023-01-09 16:19:24 +00:00
Dave Pearson
5a09831c5e Run black over path tests 2023-01-09 14:00:52 +00:00
Dave Pearson
c84a5dc413 Run black over widget removing tests 2023-01-09 13:59:59 +00:00
Dave Pearson
3f6ec10311 Run black over widget mounting tests 2023-01-09 13:59:15 +00:00
Dave Pearson
8872956b29 Run black over arrange tests 2023-01-09 13:58:25 +00:00
Dave Pearson
afc7ba2a37 Run black over unmount tests 2023-01-09 13:57:49 +00:00
Dave Pearson
5df5f12906 Run black over node tests 2023-01-09 13:57:13 +00:00
Dave Pearson
06ab4f4d70 Run black over child focus tests 2023-01-09 13:56:35 +00:00
Dave Pearson
04ef895626 Run black over child widget moving tests 2023-01-09 13:55:53 +00:00
Dave Pearson
489ba10c8a Sprinkle some pauses into the node message tests 2023-01-09 13:36:29 +00:00
Dave Pearson
346659f47f Move typing of the tree into its own class 2023-01-09 13:28:25 +00:00
Dave Pearson
c00a6da90d Check if I need to import from the future for Python 3.8 2023-01-09 13:13:54 +00:00
Dave Pearson
151673cd53 Remove empty docstring 2023-01-09 13:12:57 +00:00
Dave Pearson
0cf299540f Add a message for when a node is highlighted
This is sort of different from selected. Selected is when someone mashes the
enter button or clicks on a node. Highlighted is when the cursor moves into
a new node.

See #1400.
2023-01-09 12:54:57 +00:00
Dave Pearson
6f10c63bb0 Perform tests on all recorded tree events 2023-01-09 12:54:26 +00:00
Dave Pearson
34ff6bf260 Add some unit tests for Tree messages/event handling
I'm about to work on #1400 and it seems like a good idea to put some tests
in place first to ensure nothing gets disturbed.
2023-01-09 11:47:40 +00:00
Will McGugan
86e8738882 Merge pull request #1517 from Textualize/call-in-thread
Call from thread method
2023-01-09 02:47:50 -08:00
Rodrigo Girão Serrão
b3495c6e92 Merge pull request #1509 from Textualize/fix-1508
Simplify Placeholder implementation
2023-01-08 11:19:29 +00:00
Will McGugan
467953b1c4 Merge pull request #1503 from Textualize/cursor-blink-bug
Converting cell position to index
2023-01-07 07:43:32 -08:00
Will McGugan
702640fd2e Merge pull request #1514 from davep/blackify-isv-test
Run black over recent immutable sequence view tests
2023-01-07 07:43:14 -08:00
Will McGugan
e11f563123 docstrings 2023-01-07 14:24:17 +00:00
Will McGugan
fd9c1de3e2 Call from thread method 2023-01-07 14:04:52 +00:00
Rodrigo Girão Serrão
4c3eb3e021 Update placeholder snapshot test.
Although there was no visual difference in the output, the snapshot tool was complaining because there are now less things to draw on the screen, thus the snapshots looked different. Hence, the placeholder snapshot needed to be updated.
2023-01-07 09:35:41 +00:00
Dave Pearson
53df47b401 Rename ImmutableSequence to ImmutableSequenceView
Also, in doing so, drop support for unrolling iterators and making them into
indexable sequences.

See the following feedback:

  https://github.com/Textualize/textual/pull/1495#pullrequestreview-1238616797
  https://github.com/Textualize/textual/pull/1495#issuecomment-1373553580
2023-01-07 09:35:41 +00:00
Dave Pearson
12c6129150 Tweak the unit tests for ImmutableSequence
Make it 100% clear that the tests that are about wrapping iterators actually
are wrapping iterators.
2023-01-07 09:35:41 +00:00
Dave Pearson
274bb634ca Only convert to an indexable sequence if absolutely necessary 2023-01-07 09:35:41 +00:00
Dave Pearson
0029470b4b Add read-only access to the children of a TreeNode
See #1398.
2023-01-07 09:35:39 +00:00
Dave Pearson
2c827e18d0 Add a generic immutable sequence wrapper class
In anticipation of satisfying #1398, this adds a generic immutable sequence
wrapper class. The idea being that it can be used to wrap up a list or
similar, that you don't want the caller to modify.

This commit aims to get the basics down for this, and also adds a minimal
set of unit tests.
2023-01-07 09:35:00 +00:00
Dave Pearson
af56d88a6d Add a public read-only parent property to TreeNode
See #1397.
2023-01-07 09:34:56 +00:00