mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
refactor of compositor
This commit is contained in:
@@ -19,6 +19,7 @@ class BasicApp(App):
|
||||
self.bind("a", "toggle_class('#header', '-visible')")
|
||||
self.bind("c", "toggle_class('#content', '-content-visible')")
|
||||
self.bind("d", "toggle_class('#footer', 'dim')")
|
||||
self.bind("x", "dump")
|
||||
|
||||
def on_mount(self):
|
||||
"""Build layout here."""
|
||||
@@ -29,5 +30,8 @@ class BasicApp(App):
|
||||
sidebar=Widget(),
|
||||
)
|
||||
|
||||
def action_dump(self):
|
||||
self.panic(self.tree)
|
||||
|
||||
|
||||
BasicApp.run(css_file="dev_sandbox.scss", watch_css=True, log="textual.log")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
$text: #f0f0f0;
|
||||
$primary: #021720;
|
||||
$secondary:#95d52a;
|
||||
$secondary: #95d52a;
|
||||
$background: #262626;
|
||||
|
||||
$primary-style: $text on $background;
|
||||
|
||||
@@ -1,4 +1,24 @@
|
||||
#uber {
|
||||
border: heavy green;
|
||||
margin: 5;
|
||||
/* border: heavy green; */
|
||||
margin: 2;
|
||||
layout: dock;
|
||||
docks: panels=top;
|
||||
}
|
||||
|
||||
#child1 {
|
||||
dock: panels;
|
||||
}
|
||||
|
||||
#child2 {
|
||||
dock: panels;
|
||||
}
|
||||
|
||||
#child3 {
|
||||
dock: panels;
|
||||
}
|
||||
|
||||
#uber2 {
|
||||
margin: 3;
|
||||
layout: dock;
|
||||
docks: _default=left;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from tkinter import Place
|
||||
from textual.app import App
|
||||
from textual import events
|
||||
from textual.widgets import Placeholder
|
||||
@@ -9,7 +10,22 @@ class BasicApp(App):
|
||||
|
||||
def on_mount(self):
|
||||
"""Build layout here."""
|
||||
self.mount(uber=Placeholder())
|
||||
|
||||
uber2 = Widget()
|
||||
uber2.add_children(
|
||||
Placeholder(id="uber2-child1"),
|
||||
Placeholder(id="uber2-child2"),
|
||||
)
|
||||
|
||||
self.mount(
|
||||
uber=Widget(
|
||||
Placeholder(id="child1"),
|
||||
Placeholder(id="child2"),
|
||||
Placeholder(id="child3"),
|
||||
),
|
||||
uber2=uber2,
|
||||
)
|
||||
# self.panic(self.tree)
|
||||
|
||||
async def on_key(self, event: events.Key) -> None:
|
||||
await self.dispatch_key(event)
|
||||
|
||||
Reference in New Issue
Block a user