2026-07-27 20:51:13 +10:00
|
|
|
from textual.widgets import Static, Rule
|
|
|
|
|
from textual.containers import Vertical, Horizontal, Center
|
|
|
|
|
from textual import on
|
|
|
|
|
|
|
|
|
|
from textualeffects.widgets import EffectLabel
|
|
|
|
|
from terminaltexteffects.utils.graphics import Color
|
|
|
|
|
|
|
|
|
|
import pyfiglet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class HomePage(Vertical):
|
|
|
|
|
DEFAULT_CSS = """
|
|
|
|
|
HomePage {
|
|
|
|
|
content-align: center top;
|
|
|
|
|
|
|
|
|
|
Static {
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#banner {
|
2026-07-28 15:05:57 +10:00
|
|
|
height: 7; # probs will need to be updated
|
2026-07-27 20:51:13 +10:00
|
|
|
margin-bottom: 1;
|
|
|
|
|
|
|
|
|
|
Rule {
|
|
|
|
|
color: $surface-lighten-2;
|
|
|
|
|
height: 100%;
|
|
|
|
|
content-align: center middle;
|
|
|
|
|
margin: 0 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EffectLabel {
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#bindings {
|
|
|
|
|
Horizontal {
|
|
|
|
|
max-width: 50;
|
|
|
|
|
|
|
|
|
|
width: 50%;
|
|
|
|
|
margin-top: 1;
|
|
|
|
|
height: 1;
|
|
|
|
|
|
|
|
|
|
.bind-name {
|
|
|
|
|
width: 75%;
|
|
|
|
|
}
|
|
|
|
|
.bind-keys {
|
|
|
|
|
width: 25%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Static {
|
|
|
|
|
text-align: left;
|
|
|
|
|
link-background: transparent;
|
|
|
|
|
link-color: $primary;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def compose(self):
|
|
|
|
|
with Horizontal(id="banner"):
|
|
|
|
|
yield Rule()
|
|
|
|
|
self.banner_label = EffectLabel(pyfiglet.figlet_format("berry", font="sub-zero"), effect="Highlight", config={
|
|
|
|
|
"final_gradient_stops": [Color("#f263ff"), Color("#946ff2")],
|
|
|
|
|
"cycles": 0
|
|
|
|
|
})
|
|
|
|
|
yield self.banner_label
|
|
|
|
|
yield Rule()
|
|
|
|
|
|
|
|
|
|
yield Static("[dim]The text editor that no one asked for and didn't need.[/]")
|
|
|
|
|
|
|
|
|
|
# bindings
|
|
|
|
|
with Center(id="bindings"):
|
|
|
|
|
binds = self.app.bind_keys
|
|
|
|
|
|
|
|
|
|
with Horizontal():
|
|
|
|
|
yield Static("[b] New file[/]", classes="bind-name")
|
|
|
|
|
yield Static(f"[@click=app.new]{binds["new"]}[/]", classes="bind-keys")
|
|
|
|
|
|
|
|
|
|
with Horizontal():
|
|
|
|
|
yield Static("[b] Open file[/]", classes="bind-name")
|
|
|
|
|
yield Static(f"[@click=app.open]{binds["open"]}[/]", classes="bind-keys")
|
|
|
|
|
|
|
|
|
|
with Horizontal():
|
|
|
|
|
yield Static("[b] Open Folder[/]", classes="bind-name")
|
|
|
|
|
yield Static(f"[@click=app.open_folder]{binds["open-folder"]}[/]", classes="bind-keys")
|
|
|
|
|
|
|
|
|
|
with Horizontal():
|
|
|
|
|
yield Static("[b] Settings[/]", classes="bind-name")
|
|
|
|
|
yield Static(f"[@click=app.settings]{binds["settings"]}[/]", classes="bind-keys")
|
|
|
|
|
|