fix: update Score trait implementation and TUI initialization

Update the `Score` trait implementations to return a `Box<dyn Interpret>` instead of concrete types or clones where necessary. Additionally, refactor the initialization and cleanup in `HarmonyTUI` to use utility functions provided by `ratatui`.
This commit is contained in:
2025-01-25 12:36:22 -05:00
parent 4bbe8e84d8
commit 651266d71c
19 changed files with 57 additions and 62 deletions

View File

@@ -1,7 +1,7 @@
use std::io;
use crossterm::event::{self, Event};
use harmony::maestro::Maestro;
use ratatui::{self, layout::Position, prelude::CrosstermBackend, Frame, Terminal};
use std::io;
pub mod tui {
// Export any necessary modules or types from the internal tui module
@@ -43,8 +43,7 @@ impl HarmonyTUI {
pub async fn init(self) -> Result<(), Box<dyn std::error::Error>> {
color_eyre::install()?;
let backend = CrosstermBackend::new(io::stdout());
let mut terminal = Terminal::new(backend)?;
let mut terminal = ratatui::init();
loop {
terminal.draw(|f| self.render(f))?;
@@ -53,6 +52,8 @@ impl HarmonyTUI {
}
}
ratatui::restore();
Ok(())
}