-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,35 @@ | ||
# Facet | ||
::: mininterface.facet.Facet | ||
::: mininterface.facet.Facet | ||
|
||
## Layout | ||
|
||
!!! Experimental | ||
Share your thoughs about how the layout method should work! | ||
|
||
Should you need represent more information, Facet has a hidden method `_layout` that you may call with a list of `LayoutElements`: | ||
|
||
* `str` | ||
* `pathlib.Path` | ||
* `facet.Image` | ||
|
||
```python | ||
from dataclasses import dataclass | ||
from pathlib import Path | ||
from mininterface import run | ||
from mininterface.facet import Image | ||
|
||
@dataclass | ||
class Env: | ||
my_str: str = "Hello" | ||
|
||
m = run(Env) | ||
# Image object has currently single 'src' attribute | ||
m.facet._layout(["My text", Image("dog1.jpg"), Path("dog1.jpg")]) | ||
m.form() | ||
``` | ||
|
||
As you see, the program displays "My text", then the image and than the path info. | ||
![Layout GUI](asset/layout-gui.avif) | ||
|
||
Even in the TUI, the images are visible. (And mouse-zoomable.) | ||
![Layout TUI](asset/layout-tui.avif) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters