Add game titles and footer component to home view
This commit is contained in:
parent
da88ae71fe
commit
5611d31bd6
@ -1,3 +0,0 @@
|
||||
+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|
||||
|K|i|n|g| |o|f| |F|i|g|h|t|e|r|s|
|
||||
+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|
||||
@ -1,3 +0,0 @@
|
||||
+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+
|
||||
|M|a|r|v|e|l| |v|s| |C|a|p|c|o|m|
|
||||
+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+
|
||||
@ -1,3 +0,0 @@
|
||||
+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
|
||||
|S|a|m|u|r|a|i| |S|h|o|w|d|o|w|n|
|
||||
+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+
|
||||
@ -1,3 +0,0 @@
|
||||
+-+-+-+-+-+-+ +-+-+-+-+-+-+-+ +-+-+-+
|
||||
|S|t|r|e|e|t| |F|i|g|h|t|e|r| |I|I|I|
|
||||
+-+-+-+-+-+-+ +-+-+-+-+-+-+-+ +-+-+-+
|
||||
@ -1,3 +0,0 @@
|
||||
+-+-+-+-+ +-+-+-+-+-+-+-+
|
||||
|S|o|u|l| |C|a|l|i|b|u|r|
|
||||
+-+-+-+-+ +-+-+-+-+-+-+-+
|
||||
@ -1,3 +0,0 @@
|
||||
+-+-+-+-+-+-+ +-+-+-+-+-+-+ +-+
|
||||
|M|o|r|t|a|l| |K|o|m|b|a|t| |3|
|
||||
+-+-+-+-+-+-+ +-+-+-+-+-+-+ +-+
|
||||
@ -1,3 +0,0 @@
|
||||
+-+-+-+-+-+-+ +-+-+-+-+-+-+ +-+
|
||||
|M|o|r|t|a|l| |K|o|m|b|a|t| |3|
|
||||
+-+-+-+-+-+-+ +-+-+-+-+-+-+ +-+
|
||||
@ -1,3 +1,4 @@
|
||||
+-+-+-+-+ +-+-+ +-+-+-+-+-+ +-+-+
|
||||
|D|E|A|D| |O|R| |A|L|I|V|E| |+|+|
|
||||
+-+-+-+-+ +-+-+ +-+-+-+-+-+ +-+-+
|
||||
|
||||
3
agentm/assets/game_titles/kof98umh.txt
Normal file
3
agentm/assets/game_titles/kof98umh.txt
Normal file
@ -0,0 +1,3 @@
|
||||
+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|
||||
|K|I|N|G| |O|F| |F|I|G|H|T|E|R|S|
|
||||
+-+-+-+-+ +-+-+ +-+-+-+-+-+-+-+-+
|
||||
4
agentm/assets/game_titles/mvsc.txt
Normal file
4
agentm/assets/game_titles/mvsc.txt
Normal file
@ -0,0 +1,4 @@
|
||||
+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+
|
||||
|M|A|R|V|E|L| |V|S| |C|A|P|C|O|M|
|
||||
+-+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+
|
||||
|
||||
3
agentm/assets/game_titles/samsh5sp.txt
Normal file
3
agentm/assets/game_titles/samsh5sp.txt
Normal file
@ -0,0 +1,3 @@
|
||||
+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+ +-+
|
||||
|S|A|M|U|R|A|I| |S|H|O|D|O|W|N| |V|
|
||||
+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+ +-+
|
||||
4
agentm/assets/game_titles/sfiii3n.txt
Normal file
4
agentm/assets/game_titles/sfiii3n.txt
Normal file
@ -0,0 +1,4 @@
|
||||
+-+-+-+-+-+-+ +-+-+-+-+-+-+-+ +-+-+-+
|
||||
|S|T|R|E|E|T| |F|I|G|H|T|E|R| |I|I|I|
|
||||
+-+-+-+-+-+-+ +-+-+-+-+-+-+-+ +-+-+-+
|
||||
|
||||
4
agentm/assets/game_titles/soulclbr.txt
Normal file
4
agentm/assets/game_titles/soulclbr.txt
Normal file
@ -0,0 +1,4 @@
|
||||
+-+-+-+-+ +-+-+-+-+-+-+-+
|
||||
|S|O|U|L| |C|A|L|I|B|U|R|
|
||||
+-+-+-+-+ +-+-+-+-+-+-+-+
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
+-+-+-+-+-+-+ +-+-+-+
|
||||
|T|e|k|k|e|n| |T|a|g|
|
||||
|T|E|K|K|E|N| |T|A|G|
|
||||
+-+-+-+-+-+-+ +-+-+-+
|
||||
4
agentm/assets/game_titles/umk3.txt
Normal file
4
agentm/assets/game_titles/umk3.txt
Normal file
@ -0,0 +1,4 @@
|
||||
+-+-+-+-+-+-+ +-+-+-+-+-+-+ +-+
|
||||
|M|O|R|T|A|L| |K|O|M|B|A|T| |3|
|
||||
+-+-+-+-+-+-+ +-+-+-+-+-+-+ +-+
|
||||
|
||||
4
agentm/assets/game_titles/xmvsf.txt
Normal file
4
agentm/assets/game_titles/xmvsf.txt
Normal file
@ -0,0 +1,4 @@
|
||||
+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+ +-+-+-+-+-+-+-+
|
||||
|X|-|M|E|N| |V|S| |S|T|R|E|E|T| |F|I|G|H|T|E|R|
|
||||
+-+-+-+-+-+ +-+-+ +-+-+-+-+-+-+ +-+-+-+-+-+-+-+
|
||||
|
||||
42
agentm/components/footer.py
Normal file
42
agentm/components/footer.py
Normal file
@ -0,0 +1,42 @@
|
||||
# agentm/components/footer.py
|
||||
|
||||
from textual.widgets import Footer
|
||||
from textual.reactive import reactive
|
||||
from textual.binding import Binding
|
||||
from textual.app import RenderResult
|
||||
from rich.text import Text
|
||||
|
||||
|
||||
class AgentMFooter(Footer):
|
||||
compact: reactive[bool] = reactive(False)
|
||||
show_command_palette: reactive[bool] = reactive(True)
|
||||
view_label: reactive[str] = reactive("Simple View")
|
||||
|
||||
BINDINGS = [
|
||||
Binding("s", "toggle_simple_view", description="Toggle View"),
|
||||
]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*children, # ← Accept children to prevent positional arg errors
|
||||
compact: bool = False,
|
||||
show_command_palette: bool = True,
|
||||
view_label: str = "Simple View",
|
||||
id: str | None = None,
|
||||
classes: str | None = None,
|
||||
name: str | None = None,
|
||||
disabled: bool = False,
|
||||
) -> None:
|
||||
super().__init__(
|
||||
*children,
|
||||
id=id,
|
||||
classes=classes,
|
||||
name=name,
|
||||
disabled=disabled
|
||||
)
|
||||
self.compact = compact
|
||||
self.show_command_palette = show_command_palette
|
||||
self.view_label = view_label
|
||||
|
||||
def render_right(self) -> RenderResult:
|
||||
return Text(f"{self.view_label} • Agent M (dev)", style="dim italic")
|
||||
@ -18,6 +18,7 @@ from rich_pixels._renderer import HalfcellRenderer
|
||||
from agentm.utils.logger import log_with_caller
|
||||
from agentm.logic.roms import get_verified_roms, GAME_FILES
|
||||
from agentm.theme.palette import get_theme
|
||||
from agentm.components.footer import AgentMFooter
|
||||
|
||||
palette = get_theme()
|
||||
|
||||
@ -46,19 +47,16 @@ class GameAccordion(Static):
|
||||
|
||||
image_path = os.path.abspath(self.metadata.get("image_path", ""))
|
||||
self.image_renderable = self.load_image_scaled(image_path)
|
||||
self.ascii_title = self.load_ascii_art()
|
||||
|
||||
# Title
|
||||
self.title_label = Static(
|
||||
f"[b {palette.ACCENT}]{escape(self.title.upper())}[/]\n",
|
||||
classes="game_title",
|
||||
markup=True
|
||||
)
|
||||
|
||||
super().__init__(id=f"accordion_{self.safe_id}", classes="game_card")
|
||||
|
||||
def load_ascii_art(self) -> Static:
|
||||
game_id = self.metadata.get("game_id", "").lower()
|
||||
ascii_path = os.path.join("agentm", "assets", "game_titles", f"{game_id}.txt")
|
||||
try:
|
||||
with open(ascii_path, "r", encoding="utf-8") as f:
|
||||
return Static(f"[bold {palette.ACCENT}]{f.read()}[/]", markup=True)
|
||||
except FileNotFoundError:
|
||||
return Static(f"[bold {palette.ACCENT}]{self.title.upper()}[/]", markup=True)
|
||||
|
||||
def load_image_scaled(self, path: str):
|
||||
try:
|
||||
with Image.open(path) as img:
|
||||
@ -84,8 +82,8 @@ class GameAccordion(Static):
|
||||
return f"[red]Failed to load image[/red]\n[dim]{e}]"
|
||||
|
||||
def compose(self):
|
||||
yield self.title_label
|
||||
yield Static(self.image_renderable)
|
||||
yield self.ascii_title
|
||||
|
||||
async def on_click(self):
|
||||
await self.display_info()
|
||||
@ -156,6 +154,7 @@ class HomeView(Screen):
|
||||
self.logo,
|
||||
self.welcome_text,
|
||||
self.dynamic_container,
|
||||
AgentMFooter(compact=True),
|
||||
id="home_screen_container",
|
||||
classes="centered_layout"
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user