Reorganize project structure

This commit is contained in:
zv
2026-03-06 18:20:43 +01:00
parent 04c209ae23
commit 7e0c0afddf
26 changed files with 1520 additions and 1311 deletions

View File

@@ -0,0 +1,4 @@
from .github_repo import GithubRepositoryScreen
from .help import HelpScreen
__all__ = ["HelpScreen", "GithubRepositoryScreen"]

View File

@@ -0,0 +1,40 @@
from __future__ import annotations
from typing import Optional
from textual import on
from textual.app import ComposeResult
from textual.containers import Container, Horizontal
from textual.screen import ModalScreen
from textual.widgets import Button, Static
class GithubRepositoryScreen(ModalScreen[Optional[str]]):
def __init__(self, repository_url: str) -> None:
super().__init__()
self.repository_url = repository_url
def compose(self) -> ComposeResult:
with Container(id="github-dialog"):
yield Static("Open Github repository", id="github-title")
yield Static("Choose what to do with the repository URL:", id="github-body")
yield Static(self.repository_url, id="github-url")
with Horizontal(id="github-buttons"):
yield Button("Open in browser", id="github-open", variant="primary")
yield Button("Copy to clipboard", id="github-copy")
yield Button("Cancel", id="github-cancel")
def on_mount(self) -> None:
self.query_one("#github-open", Button).focus()
@on(Button.Pressed, "#github-open")
def handle_open(self) -> None:
self.dismiss("open")
@on(Button.Pressed, "#github-copy")
def handle_copy(self) -> None:
self.dismiss("copy")
@on(Button.Pressed, "#github-cancel")
def handle_cancel(self) -> None:
self.dismiss(None)

View File

@@ -0,0 +1,37 @@
from __future__ import annotations
from textual import on
from textual.app import ComposeResult
from textual.containers import Container
from textual.screen import ModalScreen
from textual.widgets import Button, Static
class HelpScreen(ModalScreen[None]):
def compose(self) -> ComposeResult:
with Container(id="help-dialog"):
yield Static("Keyboard shortcuts", id="help-title")
yield Static(
"Enter runs validation and lookup\n"
"Tab / Shift+Tab moves focus through controls\n"
"Ctrl+L clears the form\n"
"Ctrl+J toggles the JSON panel\n"
"Ctrl+O opens explorer for current result\n"
"Ctrl+G opens repository actions\n"
"Ctrl+1/2/3 focuses network/address/lookup\n"
"Alt+B / Alt+T selects previous / next network\n"
"Ctrl+Left / Ctrl+Right also cycles network\n"
"Ctrl+P opens command palette\n"
"F1 opens help\n"
"Q or Ctrl+C exits\n\n"
"Only public addresses are supported. Never paste private keys or seed phrases.",
id="help-body",
)
yield Button("Close", id="help-close", variant="primary")
def on_mount(self) -> None:
self.query_one("#help-close", Button).focus()
@on(Button.Pressed, "#help-close")
def handle_close(self) -> None:
self.dismiss(None)