mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Support multiple CSS files (#1079)
* Support multiple CSS paths * Update a type to match docstring * Ensure the demo app still works * Use absolute paths in tests to (hopefully) appease Windows * Notes about CSS changes in guide/docstrings, small grammar/typos fixes * Move snapshot apps into snapshot_tests dir, improve messaging in snapshot output, add test for multiple css files interacting with classvar CSS * Ensure consistent snapshot naming cross-platform * Use rpartition instead of partition in import_app * Fix handling of import_app when colon in arg * Support paths containing Windows drive names in import_app * Add note on new relative paths in snap_compare * Update docs/guide/CSS.md Co-authored-by: Will McGugan <willmcgugan@gmail.com> * Fix formatting * Update CHANGELOG to mention CSS_PATH supporting a list Co-authored-by: Will McGugan <willmcgugan@gmail.com>
This commit is contained in:
55
tests/snapshot_tests/snapshot_apps/fr_units.py
Normal file
55
tests/snapshot_tests/snapshot_apps/fr_units.py
Normal file
@@ -0,0 +1,55 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Horizontal, Vertical
|
||||
from textual.widgets import Static
|
||||
|
||||
|
||||
class StaticText(Static):
|
||||
pass
|
||||
|
||||
|
||||
class FRApp(App):
|
||||
|
||||
CSS = """
|
||||
StaticText {
|
||||
height: 1fr;
|
||||
background: $boost;
|
||||
border: heavy white;
|
||||
}
|
||||
#foo {
|
||||
width: 10;
|
||||
}
|
||||
#bar {
|
||||
width: 1fr;
|
||||
}
|
||||
#baz {
|
||||
width: 8;
|
||||
}
|
||||
#header {
|
||||
height: 1fr
|
||||
}
|
||||
|
||||
Horizontal {
|
||||
height: 2fr;
|
||||
}
|
||||
|
||||
#footer {
|
||||
height: 4;
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Vertical(
|
||||
StaticText("HEADER", id="header"),
|
||||
Horizontal(
|
||||
StaticText("foo", id="foo"),
|
||||
StaticText("bar", id="bar"),
|
||||
StaticText("baz", id="baz"),
|
||||
),
|
||||
StaticText("FOOTER", id="footer"),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = FRApp()
|
||||
app.run()
|
||||
Reference in New Issue
Block a user