mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge branch 'main' into promote-disabled
This commit is contained in:
@@ -66,6 +66,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- `DOMNode.tree` now displays simple DOM structure only https://github.com/Textualize/textual/pull/1778
|
- `DOMNode.tree` now displays simple DOM structure only https://github.com/Textualize/textual/pull/1778
|
||||||
- `App.install_screen` now returns None rather than AwaitMount https://github.com/Textualize/textual/pull/1778
|
- `App.install_screen` now returns None rather than AwaitMount https://github.com/Textualize/textual/pull/1778
|
||||||
- `DOMNode.children` is now a simple sequence, the NodesList is exposed as `DOMNode._nodes` https://github.com/Textualize/textual/pull/1778
|
- `DOMNode.children` is now a simple sequence, the NodesList is exposed as `DOMNode._nodes` https://github.com/Textualize/textual/pull/1778
|
||||||
|
- `DataTable` cursor can now enter fixed columns https://github.com/Textualize/textual/pull/1799
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from textual.app import App, ComposeResult
|
from textual.app import App, ComposeResult
|
||||||
from textual.reactive import var
|
from textual.reactive import var
|
||||||
from textual.widgets import Footer, MarkdownViewer
|
from textual.widgets import Footer, MarkdownViewer
|
||||||
@@ -10,7 +12,7 @@ class MarkdownApp(App):
|
|||||||
("f", "forward", "Forward"),
|
("f", "forward", "Forward"),
|
||||||
]
|
]
|
||||||
|
|
||||||
path = var("demo.md")
|
path = var(Path(__file__).parent / "demo.md")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def markdown_viewer(self) -> MarkdownViewer:
|
def markdown_viewer(self) -> MarkdownViewer:
|
||||||
|
|||||||
@@ -877,7 +877,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
|
|||||||
"""Clamp a coordinate such that it falls within the boundaries of the table."""
|
"""Clamp a coordinate such that it falls within the boundaries of the table."""
|
||||||
row, column = coordinate
|
row, column = coordinate
|
||||||
row = clamp(row, 0, self.row_count - 1)
|
row = clamp(row, 0, self.row_count - 1)
|
||||||
column = clamp(column, self.fixed_columns, len(self.columns) - 1)
|
column = clamp(column, 0, len(self.columns) - 1)
|
||||||
return Coordinate(row, column)
|
return Coordinate(row, column)
|
||||||
|
|
||||||
def watch_cursor_type(self, old: str, new: str) -> None:
|
def watch_cursor_type(self, old: str, new: str) -> None:
|
||||||
@@ -1590,11 +1590,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
|
|||||||
that is occupied by fixed rows and columns respectively. Fixed rows and columns
|
that is occupied by fixed rows and columns respectively. Fixed rows and columns
|
||||||
are rows and columns that do not participate in scrolling."""
|
are rows and columns that do not participate in scrolling."""
|
||||||
top = self.header_height if self.show_header else 0
|
top = self.header_height if self.show_header else 0
|
||||||
top += sum(
|
top += sum(row.height for row in self.ordered_rows[: self.fixed_rows])
|
||||||
self.rows[self._row_locations.get_key(row_index)].height
|
|
||||||
for row_index in range(self.fixed_rows)
|
|
||||||
if row_index in self.rows
|
|
||||||
)
|
|
||||||
left = sum(
|
left = sum(
|
||||||
column.render_width for column in self.ordered_columns[: self.fixed_columns]
|
column.render_width for column in self.ordered_columns[: self.fixed_columns]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path, PurePath
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
|
|
||||||
from markdown_it import MarkdownIt
|
from markdown_it import MarkdownIt
|
||||||
@@ -37,7 +37,7 @@ class Navigator:
|
|||||||
return Path(".")
|
return Path(".")
|
||||||
return self.stack[self.index]
|
return self.stack[self.index]
|
||||||
|
|
||||||
def go(self, path: str) -> Path:
|
def go(self, path: str | PurePath) -> Path:
|
||||||
"""Go to a new document.
|
"""Go to a new document.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@@ -749,7 +749,7 @@ class MarkdownViewer(Vertical, can_focus=True, can_focus_children=True):
|
|||||||
if self._markdown is not None:
|
if self._markdown is not None:
|
||||||
await self.document.update(self._markdown)
|
await self.document.update(self._markdown)
|
||||||
|
|
||||||
async def go(self, location: str) -> bool:
|
async def go(self, location: str | PurePath) -> bool:
|
||||||
"""Navigate to a new document path."""
|
"""Navigate to a new document path."""
|
||||||
return await self.document.load(self.navigator.go(location))
|
return await self.document.load(self.navigator.go(location))
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user