auto table (#2123)

* auto table

* ws

* debug
This commit is contained in:
Will McGugan
2023-03-23 15:47:14 +00:00
committed by GitHub
parent 700481129e
commit a4252a5760
5 changed files with 67 additions and 62 deletions

View File

@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed ### Changed
- DataTable now has height: auto by default. https://github.com/Textualize/textual/issues/2117
- Textual will now render strings within renderables (such as tables) as Console Markup by default. You can wrap your text with rich.Text() if you want the original behavior. https://github.com/Textualize/textual/issues/2120 - Textual will now render strings within renderables (such as tables) as Console Markup by default. You can wrap your text with rich.Text() if you want the original behavior. https://github.com/Textualize/textual/issues/2120
- Some widget methods now return `self` instead of `None` https://github.com/Textualize/textual/pull/2102: - Some widget methods now return `self` instead of `None` https://github.com/Textualize/textual/pull/2102:
- `Widget`: `refresh`, `focus`, `reset_focus` - `Widget`: `refresh`, `focus`, `reset_focus`
@@ -21,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `TreeNode`: `expand`, `expand_all`, `collapse`, `collapse_all`, `toggle`, `toggle_all` - `TreeNode`: `expand`, `expand_all`, `collapse`, `collapse_all`, `toggle`, `toggle_all`
- `Tree`: `clear`, `reset` - `Tree`: `clear`, `reset`
## [0.16.0] - 2023-03-22 ## [0.16.0] - 2023-03-22
### Added ### Added

View File

@@ -247,6 +247,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
DataTable { DataTable {
background: $surface ; background: $surface ;
color: $text; color: $text;
height: auto;
} }
DataTable > .datatable--header { DataTable > .datatable--header {
text-style: bold; text-style: bold;

File diff suppressed because one or more lines are too long

View File

@@ -69,6 +69,7 @@ class Status(LabeledBox):
Status StatusTable { Status StatusTable {
width: auto; width: auto;
height: 100%;
margin-top: 1; margin-top: 1;
scrollbar-gutter: stable; scrollbar-gutter: stable;
overflow-x: hidden; overflow-x: hidden;

View File

@@ -646,6 +646,7 @@ async def test_hover_coordinate():
table.add_column("ABC") table.add_column("ABC")
table.add_row("123") table.add_row("123")
table.add_row("456") table.add_row("456")
await pilot.pause()
assert table.hover_coordinate == Coordinate(0, 0) assert table.hover_coordinate == Coordinate(0, 0)
await pilot.hover(DataTable, offset=Offset(2, 2)) await pilot.hover(DataTable, offset=Offset(2, 2))
assert table.hover_coordinate == Coordinate(1, 0) assert table.hover_coordinate == Coordinate(1, 0)