mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
css fixes
This commit is contained in:
@@ -18,5 +18,7 @@ class BasicApp(App):
|
|||||||
sidebar=Widget(),
|
sidebar=Widget(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self.app.panic(repr(self.view.styles))
|
||||||
|
|
||||||
|
|
||||||
BasicApp.run(css_file="basic.css", watch_css=True, log="textual.log")
|
BasicApp.run(css_file="basic.css", watch_css=True, log="textual.log")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from rich.console import Console, ConsoleOptions, RenderResult, RenderableType
|
from rich.console import Console, ConsoleOptions, RenderResult, RenderableType
|
||||||
|
import rich.repr
|
||||||
from rich.segment import Segment, SegmentLines
|
from rich.segment import Segment, SegmentLines
|
||||||
from rich.style import Style, StyleType
|
from rich.style import Style, StyleType
|
||||||
|
|
||||||
@@ -22,6 +23,7 @@ BORDER_STYLES: dict[str, tuple[str, str, str]] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@rich.repr.auto
|
||||||
class Border:
|
class Border:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import warnings
|
|||||||
from asyncio import AbstractEventLoop
|
from asyncio import AbstractEventLoop
|
||||||
from typing import Any, Callable, Iterable, Type, TypeVar, TYPE_CHECKING
|
from typing import Any, Callable, Iterable, Type, TypeVar, TYPE_CHECKING
|
||||||
|
|
||||||
|
import rich
|
||||||
import rich.repr
|
import rich.repr
|
||||||
from rich.console import Console, RenderableType
|
from rich.console import Console, RenderableType
|
||||||
from rich.control import Control
|
from rich.control import Control
|
||||||
@@ -367,8 +368,14 @@ class App(DOMNode):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if not renderables:
|
if not renderables:
|
||||||
|
|
||||||
renderables = (
|
renderables = (
|
||||||
Traceback(show_locals=True, width=None, locals_max_length=5),
|
Traceback(
|
||||||
|
show_locals=True,
|
||||||
|
width=None,
|
||||||
|
locals_max_length=5,
|
||||||
|
suppress=[rich],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
self._exit_renderables.extend(renderables)
|
self._exit_renderables.extend(renderables)
|
||||||
self.close_messages_no_wait()
|
self.close_messages_no_wait()
|
||||||
|
|||||||
@@ -170,7 +170,6 @@ class BoxProperty:
|
|||||||
class Edges(NamedTuple):
|
class Edges(NamedTuple):
|
||||||
"""Stores edges for border / outline."""
|
"""Stores edges for border / outline."""
|
||||||
|
|
||||||
css_name: str
|
|
||||||
top: tuple[BoxType, Style]
|
top: tuple[BoxType, Style]
|
||||||
right: tuple[BoxType, Style]
|
right: tuple[BoxType, Style]
|
||||||
bottom: tuple[BoxType, Style]
|
bottom: tuple[BoxType, Style]
|
||||||
@@ -227,7 +226,6 @@ class BorderProperty:
|
|||||||
top, right, bottom, left = self._properties
|
top, right, bottom, left = self._properties
|
||||||
|
|
||||||
border = Edges(
|
border = Edges(
|
||||||
self.name,
|
|
||||||
getattr(obj, top),
|
getattr(obj, top),
|
||||||
getattr(obj, right),
|
getattr(obj, right),
|
||||||
getattr(obj, bottom),
|
getattr(obj, bottom),
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ class View(Widget):
|
|||||||
Returns: The Layout associated with this view
|
Returns: The Layout associated with this view
|
||||||
"""
|
"""
|
||||||
|
|
||||||
assert self.styles.layout
|
|
||||||
return self.styles.layout
|
return self.styles.layout
|
||||||
|
|
||||||
# @layout.setter
|
# @layout.setter
|
||||||
@@ -180,6 +179,8 @@ class View(Widget):
|
|||||||
watch(self.app, "background", watch_background)
|
watch(self.app, "background", watch_background)
|
||||||
|
|
||||||
async def on_idle(self, event: events.Idle) -> None:
|
async def on_idle(self, event: events.Idle) -> None:
|
||||||
|
if self.layout is None:
|
||||||
|
return
|
||||||
if self.layout.check_update():
|
if self.layout.check_update():
|
||||||
self.layout.reset_update()
|
self.layout.reset_update()
|
||||||
await self.refresh_layout()
|
await self.refresh_layout()
|
||||||
|
|||||||
Reference in New Issue
Block a user