Merge branch 'main' into promote-disabled

This commit is contained in:
Dave Pearson
2023-02-15 11:10:45 +00:00
5 changed files with 67 additions and 68 deletions

View File

@@ -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
- `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
- `DataTable` cursor can now enter fixed columns https://github.com/Textualize/textual/pull/1799
### Fixed

View File

@@ -1,3 +1,5 @@
from pathlib import Path
from textual.app import App, ComposeResult
from textual.reactive import var
from textual.widgets import Footer, MarkdownViewer
@@ -10,7 +12,7 @@ class MarkdownApp(App):
("f", "forward", "Forward"),
]
path = var("demo.md")
path = var(Path(__file__).parent / "demo.md")
@property
def markdown_viewer(self) -> MarkdownViewer:

View File

@@ -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."""
row, column = coordinate
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)
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
are rows and columns that do not participate in scrolling."""
top = self.header_height if self.show_header else 0
top += sum(
self.rows[self._row_locations.get_key(row_index)].height
for row_index in range(self.fixed_rows)
if row_index in self.rows
)
top += sum(row.height for row in self.ordered_rows[: self.fixed_rows])
left = sum(
column.render_width for column in self.ordered_columns[: self.fixed_columns]
)

View File

@@ -1,6 +1,6 @@
from __future__ import annotations
from pathlib import Path
from pathlib import Path, PurePath
from typing import Iterable
from markdown_it import MarkdownIt
@@ -37,7 +37,7 @@ class Navigator:
return Path(".")
return self.stack[self.index]
def go(self, path: str) -> Path:
def go(self, path: str | PurePath) -> Path:
"""Go to a new document.
Args:
@@ -749,7 +749,7 @@ class MarkdownViewer(Vertical, can_focus=True, can_focus_children=True):
if self._markdown is not None:
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."""
return await self.document.load(self.navigator.go(location))

File diff suppressed because one or more lines are too long