mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
layout_map refactor
This commit is contained in:
@@ -26,11 +26,12 @@ class SmoothApp(App):
|
||||
"""Build layout here."""
|
||||
footer = Footer()
|
||||
self.bar = Placeholder(name="left")
|
||||
self.bar.layout_offset_x = -40
|
||||
|
||||
await self.view.dock(footer, edge="bottom")
|
||||
await self.view.dock(Placeholder(), Placeholder(), edge="top")
|
||||
await self.view.dock(self.bar, edge="left", size=40, z=1)
|
||||
|
||||
self.bar.layout_offset_x = -40
|
||||
|
||||
SmoothApp.run()
|
||||
|
||||
SmoothApp.run(log="textual.log")
|
||||
|
||||
@@ -42,6 +42,7 @@ class MyApp(App):
|
||||
)
|
||||
self.app.sub_title = os.path.basename(message.path)
|
||||
await self.body.update(syntax)
|
||||
# self.body.layout_offset_y = -5
|
||||
self.body.home()
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ class GridTest(App):
|
||||
|
||||
async def on_mount(self, event: events.Mount) -> None:
|
||||
|
||||
grid = await self.view.dock_grid()
|
||||
grid = await self.view.dock_grid(edge="left", size=70, name="left")
|
||||
left = self.view["left"]
|
||||
|
||||
grid.add_column(fraction=1, name="left", min_size=20)
|
||||
grid.add_column(size=30, name="center")
|
||||
@@ -26,11 +27,17 @@ class GridTest(App):
|
||||
area4="right,top-start|middle-end",
|
||||
)
|
||||
|
||||
def make_placeholder(name: str) -> Placeholder:
|
||||
p = Placeholder(name=name)
|
||||
p.layout_offset_x = 10
|
||||
p.layout_offset_y = 0
|
||||
return p
|
||||
|
||||
grid.place(
|
||||
area1=Placeholder(name="area1"),
|
||||
area2=Placeholder(name="area2"),
|
||||
area3=Placeholder(name="area3"),
|
||||
area4=Placeholder(name="area4"),
|
||||
area1=make_placeholder(name="area1"),
|
||||
area2=make_placeholder(name="area2"),
|
||||
area3=make_placeholder(name="area3"),
|
||||
area4=make_placeholder(name="area4"),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user