diff --git a/poetry.lock b/poetry.lock index 6aa1ed18d..0285e2e4d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -35,7 +35,7 @@ frozenlist = ">=1.1.0" name = "astunparse" version = "1.6.3" description = "An AST unparser for Python" -category = "main" +category = "dev" optional = false python-versions = "*" @@ -110,7 +110,7 @@ uvloop = ["uvloop (>=0.15.2)"] name = "cached-property" version = "1.5.2" description = "A decorator for caching properties in classes." -category = "main" +category = "dev" optional = false python-versions = "*" @@ -207,7 +207,7 @@ python-versions = ">=3.7" name = "ghp-import" version = "2.1.0" description = "Copy your docs directly to the gh-pages branch." -category = "main" +category = "dev" optional = false python-versions = "*" @@ -221,7 +221,7 @@ dev = ["twine", "markdown", "flake8", "wheel"] name = "griffe" version = "0.19.2" description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API." -category = "main" +category = "dev" optional = false python-versions = ">=3.7" @@ -279,7 +279,7 @@ python-versions = "*" name = "jinja2" version = "3.0.3" description = "A very fast and expressive template engine." -category = "main" +category = "dev" optional = false python-versions = ">=3.6" @@ -293,7 +293,7 @@ i18n = ["Babel (>=2.7)"] name = "markdown" version = "3.3.7" description = "Python implementation of Markdown." -category = "main" +category = "dev" optional = false python-versions = ">=3.6" @@ -307,7 +307,7 @@ testing = ["coverage", "pyyaml"] name = "markupsafe" version = "2.1.1" description = "Safely add untrusted strings to HTML/XML markup." -category = "main" +category = "dev" optional = false python-versions = ">=3.7" @@ -315,7 +315,7 @@ python-versions = ">=3.7" name = "mergedeep" version = "1.3.4" description = "A deep merge function for 🐍." -category = "main" +category = "dev" optional = false python-versions = ">=3.6" @@ -323,7 +323,7 @@ python-versions = ">=3.6" name = "mkdocs" version = "1.3.0" description = "Project documentation with Markdown." -category = "main" +category = "dev" optional = false python-versions = ">=3.6" @@ -346,7 +346,7 @@ i18n = ["babel (>=2.9.0)"] name = "mkdocs-autorefs" version = "0.4.1" description = "Automatically link across pages in MkDocs." -category = "main" +category = "dev" optional = false python-versions = ">=3.7" @@ -356,19 +356,19 @@ mkdocs = ">=1.1" [[package]] name = "mkdocs-material" -version = "7.3.6" -description = "A Material Design theme for MkDocs" +version = "8.2.15" +description = "Documentation that simply works" category = "dev" optional = false -python-versions = "*" +python-versions = ">=3.7" [package.dependencies] jinja2 = ">=2.11.1" markdown = ">=3.2" -mkdocs = ">=1.2.3" -mkdocs-material-extensions = ">=1.0" -pygments = ">=2.10" -pymdown-extensions = ">=9.0" +mkdocs = ">=1.3.0" +mkdocs-material-extensions = ">=1.0.3" +pygments = ">=2.12" +pymdown-extensions = ">=9.4" [[package]] name = "mkdocs-material-extensions" @@ -382,7 +382,7 @@ python-versions = ">=3.6" name = "mkdocstrings" version = "0.18.1" description = "Automatic documentation from sources, for MkDocs." -category = "main" +category = "dev" optional = false python-versions = ">=3.7" @@ -405,7 +405,7 @@ python-legacy = ["mkdocstrings-python-legacy (>=0.2.1)"] name = "mkdocstrings-python" version = "0.6.6" description = "A Python handler for mkdocstrings." -category = "main" +category = "dev" optional = false python-versions = ">=3.7" @@ -417,7 +417,7 @@ mkdocstrings = ">=0.18" name = "mkdocstrings-python-legacy" version = "0.2.2" description = "A legacy Python handler for mkdocstrings." -category = "main" +category = "dev" optional = false python-versions = ">=3.7" @@ -480,7 +480,7 @@ python-versions = "*" name = "packaging" version = "21.3" description = "Core utilities for Python packages" -category = "main" +category = "dev" optional = false python-versions = ">=3.6" @@ -559,7 +559,7 @@ python-versions = ">=3.6" name = "pymdown-extensions" version = "9.4" description = "Extension pack for Python Markdown." -category = "main" +category = "dev" optional = false python-versions = ">=3.7" @@ -570,7 +570,7 @@ markdown = ">=3.2" name = "pyparsing" version = "3.0.9" description = "pyparsing module - Classes and methods to define and execute parsing grammars" -category = "main" +category = "dev" optional = false python-versions = ">=3.6.8" @@ -650,7 +650,7 @@ testing = ["fields", "hunter", "process-tests", "six", "pytest-xdist", "virtuale name = "python-dateutil" version = "2.8.2" description = "Extensions to the standard Python datetime module" -category = "main" +category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" @@ -661,7 +661,7 @@ six = ">=1.5" name = "pytkdocs" version = "0.16.1" description = "Load Python objects documentation." -category = "main" +category = "dev" optional = false python-versions = ">=3.7" @@ -677,7 +677,7 @@ numpy-style = ["docstring_parser (>=0.7)"] name = "pyyaml" version = "6.0" description = "YAML parser and emitter for Python" -category = "main" +category = "dev" optional = false python-versions = ">=3.6" @@ -685,7 +685,7 @@ python-versions = ">=3.6" name = "pyyaml-env-tag" version = "0.1" description = "A custom YAML tag for referencing environment variables in YAML files. " -category = "main" +category = "dev" optional = false python-versions = ">=3.6" @@ -712,7 +712,7 @@ jupyter = ["ipywidgets (>=7.5.1,<8.0.0)"] name = "six" version = "1.16.0" description = "Python 2 and 3 compatibility utilities" -category = "main" +category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" @@ -782,7 +782,7 @@ testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", name = "watchdog" version = "2.1.8" description = "Filesystem events monitoring" -category = "main" +category = "dev" optional = false python-versions = ">=3.6" @@ -817,7 +817,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "f32bca17ffa867133de5437f87390b1122fb84ee9c0b6eafab03f8c518fe6c15" +content-hash = "bfa71851a0d29adf2bf6de97054967e2122355bdefe859439bca5ec4377c9992" [metadata.files] aiohttp = [ @@ -1166,8 +1166,8 @@ mkdocs-autorefs = [ {file = "mkdocs_autorefs-0.4.1-py3-none-any.whl", hash = "sha256:a2248a9501b29dc0cc8ba4c09f4f47ff121945f6ce33d760f145d6f89d313f5b"}, ] mkdocs-material = [ - {file = "mkdocs-material-7.3.6.tar.gz", hash = "sha256:1b1dbd8ef2508b358d93af55a5c5db3f141c95667fad802301ec621c40c7c217"}, - {file = "mkdocs_material-7.3.6-py2.py3-none-any.whl", hash = "sha256:1b6b3e9e09f922c2d7f1160fe15c8f43d4adc0d6fb81aa6ff0cbc7ef5b78ec75"}, + {file = "mkdocs-material-8.2.15.tar.gz", hash = "sha256:93b57e53733051431cc83216446e774bdf08bf516a6251ff2f24974f45f98149"}, + {file = "mkdocs_material-8.2.15-py2.py3-none-any.whl", hash = "sha256:9d6c4ca1ceecc00b2e38c214665ed7605d275321dcaa22f38b9d1175edc58955"}, ] mkdocs-material-extensions = [ {file = "mkdocs-material-extensions-1.0.3.tar.gz", hash = "sha256:bfd24dfdef7b41c312ede42648f9eb83476ea168ec163b613f9abd12bbfddba2"}, diff --git a/pyproject.toml b/pyproject.toml index cf50856ac..b4222f52e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,6 @@ click = "8.1.2" importlib-metadata = "^4.11.3" typing-extensions = { version = "^4.0.0", python = "<3.8" } msgpack = "^1.0.3" -mkdocstrings = {extras = ["python"], version = "^0.18.1"} [tool.poetry.dev-dependencies] pytest = "^6.2.3" @@ -36,8 +35,8 @@ black = "^22.3.0" mypy = "^0.950" pytest-cov = "^2.12.1" mkdocs = "^1.3.0" -mkdocstrings = "^0.18.1" -mkdocs-material = "^7.3.6" +mkdocstrings = {extras = ["python"], version = "^0.18.1"} +mkdocs-material = "^8.2.15" pre-commit = "^2.13.0" pytest-aiohttp = "^1.0.4" time-machine = "^2.6.0" diff --git a/src/textual/app.py b/src/textual/app.py index 136d440d3..366d733f0 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -32,7 +32,7 @@ import rich.repr from rich.console import Console, RenderableType from rich.measure import Measurement from rich.protocol import is_renderable -from rich.segment import Segments +from rich.segment import Segments, SegmentLines from rich.traceback import Traceback from . import actions @@ -441,7 +441,9 @@ class App(Generic[ReturnType], DOMNode): color_system="truecolor", record=True, ) - console.print(self.screen._compositor.render(full=True)) + lines = self.screen._compositor.render(full=True).lines + + console.print(SegmentLines(lines, new_lines=True)) return console.export_svg(title=self.title) def save_screenshot(self, path: str | None = None) -> str: @@ -524,7 +526,7 @@ class App(Generic[ReturnType], DOMNode): self.screen.refresh(layout=True) def render(self) -> RenderableType: - return Blank() + return "" def query(self, selector: str | None = None) -> DOMQuery: """Get a DOM query in the current screen. diff --git a/src/textual/css/_style_properties.py b/src/textual/css/_style_properties.py index 1b891355c..061a4bd75 100644 --- a/src/textual/css/_style_properties.py +++ b/src/textual/css/_style_properties.py @@ -938,6 +938,8 @@ class FractionalProperty: class AlignProperty: + """Combines the horizontal and vertical alignment properties in to a single property.""" + def __set_name__(self, owner: StylesBase, name: str) -> None: self.horizontal = f"{name}_horizontal" self.vertical = f"{name}_vertical" diff --git a/src/textual/screen.py b/src/textual/screen.py index 6fa8947de..12b8565e8 100644 --- a/src/textual/screen.py +++ b/src/textual/screen.py @@ -28,7 +28,12 @@ class Screen(Widget): """A widget for the root of the app.""" CSS = """ - + Screen { + layout: vertical; + overflow-y: auto; + background: $surface; + color: $text-surface; + } """ dark = Reactive(False)