refactor of compositor

This commit is contained in:
Will McGugan
2022-03-02 15:39:26 +00:00
parent 7c64c7813c
commit 237c556673
50 changed files with 429 additions and 342 deletions

View File

@@ -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")

View File

@@ -2,7 +2,7 @@
$text: #f0f0f0;
$primary: #021720;
$secondary:#95d52a;
$secondary: #95d52a;
$background: #262626;
$primary-style: $text on $background;

View File

@@ -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;
}

View File

@@ -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)