better docs

This commit is contained in:
Will McGugan
2024-07-30 15:34:28 +01:00
committed by Angelo Mottola
parent dc1049b838
commit 0425746ca3
2 changed files with 5 additions and 6 deletions

View File

@@ -46,9 +46,6 @@ CursorType = Literal["cell", "row", "column", "none"]
CellType = TypeVar("CellType")
"""Type used for cells in the DataTable."""
_DEFAULT_CELL_X_PADDING = 1
"""Default padding to use on each side of a column in the data table."""
_EMPTY_TEXT = Text(no_wrap=True, end="")
@@ -381,7 +378,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
show_cursor = Reactive(True)
cursor_type: Reactive[CursorType] = Reactive[CursorType]("cell")
"""The type of the cursor of the `DataTable`."""
cell_padding = Reactive(_DEFAULT_CELL_X_PADDING)
cell_padding = Reactive(1)
"""Horizontal padding between cells, applied on each side of each cell."""
cursor_coordinate: Reactive[Coordinate] = Reactive(
@@ -658,7 +655,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
cursor_foreground_priority: Literal["renderable", "css"] = "css",
cursor_background_priority: Literal["renderable", "css"] = "renderable",
cursor_type: CursorType = "cell",
cell_padding: int = _DEFAULT_CELL_X_PADDING,
cell_padding: int = 1,
name: str | None = None,
id: str | None = None,
classes: str | None = None,

View File

@@ -11,7 +11,6 @@ from textual.coordinate import Coordinate
from textual.geometry import Offset
from textual.message import Message
from textual.widgets import DataTable
from textual.widgets._data_table import _DEFAULT_CELL_X_PADDING
from textual.widgets.data_table import (
CellDoesNotExist,
CellKey,
@@ -26,6 +25,9 @@ from textual.widgets.data_table import (
ROWS = [["0/0", "0/1"], ["1/0", "1/1"], ["2/0", "2/1"]]
_DEFAULT_CELL_X_PADDING = 1
class DataTableApp(App):
messages_to_record = {
"CellHighlighted",