diff options
Diffstat (limited to 'src/ui.rs')
| -rw-r--r-- | src/ui.rs | 2585 |
1 files changed, 16 insertions, 2569 deletions
@@ -6,7 +6,7 @@ use crossterm::{ use std::{ error::Error, io, - path::Path, + path::{Path, PathBuf}, thread::sleep, time::{Duration, Instant}, }; @@ -74,2576 +74,23 @@ impl<T> StatefulList<T> { /// /// Check the event handling at the bottom to see how to change the state on incoming events. /// Check the drawing logic for items on how to specify the highlighting style for selected items. -pub struct App<'a> { - pub items: StatefulList<(&'a str, &'a Path)>, +pub struct App { + pub items: StatefulList<(String, PathBuf)>, pub flag_cur: bool, pub layout: Layout, pub cur_gen: Gen, } -impl<'a> App<'a> { - pub fn new() -> App<'a> { +impl App { + pub fn new() -> App { + let mut v = vec![]; + for i in 1..=513 { + let name = format!("pattern{}", i); + let p = format!("./presets/patterns/pattern{}.txt", i); + v.push((name.to_owned(), Path::new(p.as_str()).to_owned())); + } App { - items: StatefulList::with_items(vec