mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
docstrings and fixes
This commit is contained in:
@@ -10,19 +10,19 @@ Creating a TUI can be challenging. It may be easier to create a GUI or web appli
|
||||
|
||||
Textual seeks to lower the difficulty level of building a TUI by borrowing developments from the web world and to a lesser extent desktop applications. The goal is for it to be as easy to develop a TUI for your project as it would be to add a command line interface.XX
|
||||
|
||||
=== "Python"
|
||||
=== "simple.py"
|
||||
|
||||
```python
|
||||
--8<-- "docs/examples/simple.py"
|
||||
```
|
||||
|
||||
=== "CSS"
|
||||
=== "simple.css"
|
||||
|
||||
```python
|
||||
```scss
|
||||
--8<-- "docs/examples/simple.css"
|
||||
```
|
||||
|
||||
=== "Terminal"
|
||||
=== "Result"
|
||||
|
||||
```{.textual path="docs/examples/simple.py" columns="80" lines="24"}
|
||||
```
|
||||
|
||||
6
poetry.lock
generated
6
poetry.lock
generated
@@ -650,7 +650,7 @@ pyyaml = "*"
|
||||
|
||||
[[package]]
|
||||
name = "rich"
|
||||
version = "12.4.3"
|
||||
version = "12.4.4"
|
||||
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
|
||||
category = "main"
|
||||
optional = false
|
||||
@@ -1360,8 +1360,8 @@ pyyaml-env-tag = [
|
||||
{file = "pyyaml_env_tag-0.1.tar.gz", hash = "sha256:70092675bda14fdec33b31ba77e7543de9ddc88f2e5b99160396572d11525bdb"},
|
||||
]
|
||||
rich = [
|
||||
{file = "rich-12.4.3-py3-none-any.whl", hash = "sha256:26ef784599a9ab905ade34ff28904e4fbe9bce16e02c33c78b0229551104c146"},
|
||||
{file = "rich-12.4.3.tar.gz", hash = "sha256:e7550ca19aec51b216ae4c34bfce82e94a0c79bdbf95cafbf42f343d0fb3f45a"},
|
||||
{file = "rich-12.4.4-py3-none-any.whl", hash = "sha256:d2bbd99c320a2532ac71ff6a3164867884357da3e3301f0240090c5d2fdac7ec"},
|
||||
{file = "rich-12.4.4.tar.gz", hash = "sha256:4c586de507202505346f3e32d1363eb9ed6932f0c2f63184dea88983ff4971e2"},
|
||||
]
|
||||
six = [
|
||||
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
|
||||
|
||||
@@ -763,6 +763,11 @@ class App(Generic[ReturnType], DOMNode):
|
||||
self._log_console = None
|
||||
|
||||
async def _ready(self) -> None:
|
||||
"""Called immediately prior to processing messages.
|
||||
|
||||
May be used as a hook for any operations that should run first.
|
||||
|
||||
"""
|
||||
try:
|
||||
screenshot_timer = float(os.environ.get("TEXTUAL_SCREENSHOT", "0"))
|
||||
except ValueError:
|
||||
@@ -772,8 +777,9 @@ class App(Generic[ReturnType], DOMNode):
|
||||
return
|
||||
|
||||
async def on_screenshot():
|
||||
"""Used by docs plugin."""
|
||||
svg = self.export_screenshot()
|
||||
self._screenshot = svg
|
||||
self._screenshot = svg # type: ignore
|
||||
await self.shutdown()
|
||||
|
||||
self.set_timer(screenshot_timer, on_screenshot)
|
||||
@@ -880,7 +886,7 @@ class App(Generic[ReturnType], DOMNode):
|
||||
Args:
|
||||
renderable (RenderableType): A Rich renderable.
|
||||
"""
|
||||
if self._running and not self._closed:
|
||||
if self._running and not self._closed and not self.is_headless:
|
||||
console = self.console
|
||||
if self._sync_available:
|
||||
console.file.write("\x1bP=1s\x1b\\")
|
||||
|
||||
@@ -399,6 +399,8 @@ class Widget(DOMNode):
|
||||
scrolled_x = scrolled_y = False
|
||||
if animate:
|
||||
# TODO: configure animation speed
|
||||
if duration is None and speed is None:
|
||||
speed = 50
|
||||
if x is not None:
|
||||
self.scroll_target_x = x
|
||||
if x != self.scroll_x:
|
||||
|
||||
Reference in New Issue
Block a user