Merge branch 'css' into inline-styles-view

This commit is contained in:
Will McGugan
2022-02-07 11:44:45 +00:00
committed by GitHub
11 changed files with 96 additions and 147 deletions

View File

@@ -1,4 +1,4 @@
/* CSS file for dev_sandbox.py */
/* CSS file for basic.py */
App > View {
docks: side=left/1;
@@ -36,11 +36,6 @@ Widget:hover {
#content {
text: white on #20639b;
border-bottom: hkey #0f2b41;
offset-y: -3;
}
#content.-content-visible {
visibility: hidden;
}
#footer {

View File

@@ -1,32 +1,23 @@
from rich.console import RenderableType
from rich.panel import Panel
from textual.app import App
from textual.widget import Widget
class PanelWidget(Widget):
def render(self) -> RenderableType:
return Panel("hello world!", title="Title")
class BasicApp(App):
"""Sandbox application used for testing/development by Textual developers"""
"""A basic app demonstrating CSS"""
def on_load(self):
"""Bind keys here."""
self.bind("tab", "toggle_class('#sidebar', '-active')")
self.bind("a", "toggle_class('#header', '-visible')")
self.bind("c", "toggle_class('#content', '-content-visible')")
def on_mount(self):
"""Build layout here."""
self.mount(
header=Widget(),
content=PanelWidget(),
content=Widget(),
footer=Widget(),
sidebar=Widget(),
)
BasicApp.run(css_file="test_app.css", watch_css=True, log="textual.log")
BasicApp.run(css_file="dev_sandbox.css", watch_css=True, log="textual.log")