Commit Graph

657 Commits

Author SHA1 Message Date
Will McGugan
23c2c3edd3 fix for visiblity 2022-12-07 14:41:30 +00:00
Rodrigo Girão Serrão
ba5ec6b34b Merge branch 'main' of https://github.com/Textualize/Textual into placeholder 2022-12-05 15:08:01 +00:00
Dave Pearson
cd4b421b74 Update snapshots to take into account new default Label width 2022-12-05 07:40:28 +00:00
Will McGugan
962b7d64b4 pause 2022-12-04 17:25:09 +07:00
Will McGugan
eab69a7739 snapshots 2022-12-04 17:18:42 +07:00
Will McGugan
0a8b001c62 fix for layer ordering 2022-12-04 17:17:27 +07:00
Rodrigo Girão Serrão
40fd3e8f78 Add box model test for empty container. 2022-12-03 14:26:42 +00:00
Rodrigo Girão Serrão
1def555a76 Add tests for dimensions of empty containers. 2022-12-02 15:43:24 +00:00
Darren Burns
f0c4023c47 Merge branch 'main' of github.com:Textualize/textual into list-view 2022-11-30 12:15:08 +00:00
Rodrigo Girão Serrão
9654748dd7 Update example and test files. 2022-11-25 18:23:24 +00:00
Dave Pearson
ab760dbe80 Add a test for numbers within a type query name
Add a failing test due to #1253.
2022-11-24 21:04:36 +00:00
Darren Burns
01cbd7bdd0 Update snapshot for ListView - keys no longer shown in footer 2022-11-23 11:08:44 +00:00
Darren Burns
eb8c078306 Merge branch 'main' of github.com:willmcgugan/textual into list-view 2022-11-23 11:03:40 +00:00
Darren Burns
afafc054f5 Update snapshot 2022-11-21 15:31:58 +00:00
Darren Burns
b21eb0659b Adding list view snapshot test with key presses 2022-11-21 15:15:55 +00:00
Will McGugan
f7dade5a26 new tree control 2022-11-20 15:42:35 +00:00
darrenburns
e968ca0e50 Various tests for reactivity (#1223) 2022-11-18 19:40:30 +00:00
Rodrigo Girão Serrão
0b30c3a1d5 Fix snapshot test by resetting colour cycle. 2022-11-18 15:54:32 +00:00
Rodrigo Girão Serrão
54b85399e7 Merge branch 'main' into placeholder 2022-11-18 15:21:40 +00:00
Rodrigo Girão Serrão
a87c9ca916 Add tests for placeholder widget. 2022-11-18 15:14:56 +00:00
darrenburns
36664ef7ae Sensible default key displays + allow users to override key displays at the App level (#1213)
* Get rid of string split key display

* Include screen level bindings when no widget is focused

* Add default key display mappings

* Allow user to customise key display at app level

* Better docstring

* Update CHANGELOG.md
2022-11-18 14:05:45 +00:00
darrenburns
e32e094b92 Support callables in App.SCREENS (#1185)
* Support Type[Screen] in App.SCREENS (lazy screens)

* Update CHANGELOG

* Remove redundant isinstance
2022-11-16 15:47:48 +00:00
darrenburns
df37a9b90a Add get_child_by_id and get_widget_by_id (#1146)
* Add get_child_by_id and get_widget_by_id

* Remove redundant code

* Add unit tests for app-level get_child_by_id and get_widget_by_id

* Remove redundant test fixture injection

* Update CHANGELOG

* Enforce uniqueness of ID amongst widget children

* Enforce unique widget IDs amongst widgets mounted together

* Update CHANGELOG.md

* Ensuring unique IDs in a more logical place

* Add docstring to NodeList._get_by_id

* Dont use duplicate IDs in tests, dont mount 2000 widgets

* Mounting less widgets in a unit test

* Reword error message

* Use lower-level depth first search in get_widget_by_id to break out early
2022-11-16 15:29:59 +00:00
darrenburns
a465f5c236 Horizontal width auto (#1155)
* Improvements to width:auto HorizontalLayout

* Fix HorizontalLayout.get_content_width

* Horizontal width auto improvement

* Removing some printxz

* Update snapshot for horizontal layout width auto dock
2022-11-16 14:49:52 +00:00
Will McGugan
e79cad6cb5 Merge pull request #1173 from davep/move-child
Add Widget.move_child
2022-11-15 13:46:22 +00:00
Dave Pearson
af1168b4ee Don't take transparent to imply not visible
This seeks to address #1175, where a containing widget with a transparent
background, but with a border, won't show the border. It seems that at the
heart of the Compositor it's taking `is_transparent` (of the widget) as one
of the indicators that mean that it won't be visible. This wouldn't normally
be the case, in that a widget could be transparent (in the background) but
could have visible content.

Note that some snapshot tests failed with this change, but no material
difference was found in those failing snapshot tests.
2022-11-15 11:59:01 +00:00
Dave Pearson
48e5f5e026 Add Widget.move_child
Adds a method to Widget that allows moving a child of that widget within its
list of children. Options are to move before or after a specific location,
or a sibling widget.

Seeks to implement #1121.
2022-11-14 12:22:24 +00:00
Will McGugan
0a45ff374f update to greater than or equals 2022-11-12 12:24:36 +00:00
Will McGugan
e9489f194f tweak to anim test 2022-11-12 12:22:31 +00:00
Will McGugan
46d12fcfe0 win fix 2022-11-12 12:17:01 +00:00
Will McGugan
2605785288 use per_counter 2022-11-12 12:12:23 +00:00
Will McGugan
949745a08a add sleep to test 2022-11-12 12:05:59 +00:00
Will McGugan
b752ab5a04 more tests 2022-11-12 12:00:49 +00:00
Will McGugan
a0ab6c99f1 test for animation 2022-11-12 11:47:14 +00:00
Dave Pearson
4418cbab78 Merge branch 'main' into awaitable-remove 2022-11-10 20:43:25 +00:00
Dave Pearson
32e6f71856 Be 100% sure all removals take place 2022-11-10 20:41:11 +00:00
Dave Pearson
d3e7f5ad99 Add a unit test for removal ordering via DOMQuery.remove 2022-11-10 20:36:57 +00:00
Dave Pearson
9748850657 Add a unit test for removal ordering via Widget.remove 2022-11-10 20:34:51 +00:00
Dave Pearson
4dbb1f8e20 AwaitRemove work-in-progress
Initial work on #1094 -- this implements the core idea; lots of tidying up
to do but saving for the end of the week.
2022-11-10 16:54:44 +00:00
Will McGugan
1b61a95c70 table tests 2022-11-10 16:22:52 +00:00
Will McGugan
97eab5fd6e Merge branch 'main' into call-later 2022-11-10 15:24:31 +00:00
Dave Pearson
d73d4e898f Add unit tests for App._on_remove
These tests are designed to give 100% coverage to the App._on_remove method,
which is the heart of the widget removal system. This is done in
anticipation to some reworking as part of #1094.

Note that, for the moment, there's a bit of a hack in here. These tests need
the pilot. The pilot would need that we await changes to the DOM. Removing
things from the DOM changes the DOM. Remove can't be awaited (see above
change that's coming). So... until such a time as we can await a remove, we
go with a simple await of asyncio.sleep to get things started.

Once #1094 has been done these tests should all still work fine *and* we
should be able to await the removes rather than use the sleeps.
2022-11-10 13:13:15 +00:00
Will McGugan
39a764f49f call later 2022-11-09 17:23:28 +00:00
Dave Pearson
57a2b77e26 Merge branch 'main' into remove-refresh 2022-11-09 16:23:01 +00:00
Dave Pearson
5d6daf2a00 Extend the on_unmount unit tests
Because some changes are going to be made to the way that removal of widgets
happens, and because this will affect the linkage between parents and
children, and because we don't want the current way of working to change...
extend to the tests to be sure that when an unmount happens a widget has no
children any more, but still knows about its parent.
2022-11-09 14:59:13 +00:00
Will McGugan
dd5c0e612a make watchers instant 2022-11-09 12:06:14 +00:00
Dave Pearson
4e8c10b7f4 Merge pull request #1138 from davep/no-self-own
Raise an error if a widget tries to be its own parent
2022-11-08 14:03:25 +00:00
Dave Pearson
0324fb90d1 Hoist WidgetError and MountError to the top level of widget.py 2022-11-08 13:53:22 +00:00
Dave Pearson
73cc6021ee Add the final TooManyMatches mounting unit test
This was waiting for the update to query_one that would raise an exception
if the result had more than one match. That's in Textual now so we can
finally add this test.
2022-11-08 13:21:56 +00:00
Dave Pearson
fbbd8a2678 Raise an error if a widget tries to be its own parent
See #1062
2022-11-08 12:07:06 +00:00