css fixes

This commit is contained in:
Will McGugan
2022-02-04 19:25:42 +00:00
parent a4b9776113
commit bb254bda76
5 changed files with 14 additions and 4 deletions

View File

@@ -18,5 +18,7 @@ class BasicApp(App):
sidebar=Widget(),
)
self.app.panic(repr(self.view.styles))
BasicApp.run(css_file="basic.css", watch_css=True, log="textual.log")

View File

@@ -1,6 +1,7 @@
from __future__ import annotations
from rich.console import Console, ConsoleOptions, RenderResult, RenderableType
import rich.repr
from rich.segment import Segment, SegmentLines
from rich.style import Style, StyleType
@@ -22,6 +23,7 @@ BORDER_STYLES: dict[str, tuple[str, str, str]] = {
}
@rich.repr.auto
class Border:
def __init__(
self,

View File

@@ -7,6 +7,7 @@ import warnings
from asyncio import AbstractEventLoop
from typing import Any, Callable, Iterable, Type, TypeVar, TYPE_CHECKING
import rich
import rich.repr
from rich.console import Console, RenderableType
from rich.control import Control
@@ -367,8 +368,14 @@ class App(DOMNode):
"""
if not 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.close_messages_no_wait()

View File

@@ -170,7 +170,6 @@ class BoxProperty:
class Edges(NamedTuple):
"""Stores edges for border / outline."""
css_name: str
top: tuple[BoxType, Style]
right: tuple[BoxType, Style]
bottom: tuple[BoxType, Style]
@@ -227,7 +226,6 @@ class BorderProperty:
top, right, bottom, left = self._properties
border = Edges(
self.name,
getattr(obj, top),
getattr(obj, right),
getattr(obj, bottom),

View File

@@ -49,7 +49,6 @@ class View(Widget):
Returns: The Layout associated with this view
"""
assert self.styles.layout
return self.styles.layout
# @layout.setter
@@ -180,6 +179,8 @@ class View(Widget):
watch(self.app, "background", watch_background)
async def on_idle(self, event: events.Idle) -> None:
if self.layout is None:
return
if self.layout.check_update():
self.layout.reset_update()
await self.refresh_layout()