mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add easing example app, restructure dirs a little
This commit is contained in:
@@ -172,6 +172,14 @@ def run_app(import_name: str, dev: bool, press: str) -> None:
|
||||
@run.command("borders")
|
||||
def borders():
|
||||
"""Explore the border styles available in Textual."""
|
||||
from ..devtools import borders
|
||||
from textual.cli.previews import borders
|
||||
|
||||
borders.app.run()
|
||||
|
||||
|
||||
@run.command("easing")
|
||||
def easing():
|
||||
"""Explore the animation easing functions available in Textual."""
|
||||
from textual.cli.previews import easing
|
||||
|
||||
easing.app.run()
|
||||
|
||||
0
src/textual/cli/previews/__init__.py
Normal file
0
src/textual/cli/previews/__init__.py
Normal file
8
src/textual/cli/previews/easing.css
Normal file
8
src/textual/cli/previews/easing.css
Normal file
@@ -0,0 +1,8 @@
|
||||
EasingButtons > Button {
|
||||
width: 100%;
|
||||
}
|
||||
EasingButtons {
|
||||
dock: left;
|
||||
width: 20;
|
||||
overflow: auto auto;
|
||||
}
|
||||
22
src/textual/cli/previews/easing.py
Normal file
22
src/textual/cli/previews/easing.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from textual._easing import EASING
|
||||
from textual.app import ComposeResult, App
|
||||
from textual.widget import Widget
|
||||
from textual.widgets import Button, Static
|
||||
|
||||
|
||||
class EasingButtons(Widget):
|
||||
def compose(self) -> ComposeResult:
|
||||
for easing in EASING:
|
||||
yield Button(easing)
|
||||
|
||||
|
||||
class EasingApp(App):
|
||||
def compose(self) -> ComposeResult:
|
||||
yield EasingButtons()
|
||||
self.text = Static("Easing examples")
|
||||
yield self.text
|
||||
|
||||
|
||||
app = EasingApp(css_path="easing.css", watch_css=True)
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
Reference in New Issue
Block a user