retest: 7e, 1f

This commit is contained in:
i do not exist 2026-07-01 16:35:20 +03:00
parent 383e534692
commit c53c5bf377
4 changed files with 29 additions and 21 deletions

View file

@ -59,11 +59,11 @@ impl App {
/// Create a new application instance from a backend, project, config, and mode /// Create a new application instance from a backend, project, config, and mode
/// ///
/// ``` /// ```
/// let jack = tek::tengri::Jack::new(&"test_tek").expect("failed to connect to jack"); /// let jack = tek::tengri::sing::Jack::new(&"test_tek").expect("failed to connect to jack");
/// let proj = tek::Arrangement::default(); /// let proj = tek::Arrangement::default();
/// let mut conf = tek::Config::default(); /// let mut conf = tek::Config::default();
/// conf.add("(mode hello)"); /// conf.add("(mode hello)");
/// let tek = tek::tek(&jack, proj, conf, "hello"); /// let tek = tek::App::new(&jack, proj, conf, "hello");
/// ``` /// ```
pub fn new ( pub fn new (
jack: &Jack<'static>, project: Arrangement, config: Config, mode: impl AsRef<str> jack: &Jack<'static>, project: Arrangement, config: Config, mode: impl AsRef<str>
@ -523,15 +523,7 @@ fn tek_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usually<XYWH<u
}))) })))
}.draw(to), }.draw(to),
Some(":sessions") => h_exact(Some(6), w_min(Some(30), thunk(|to: &mut Tui|{ Some(":sessions") => view_sessions().draw(to),
let f = Rgb(224, 192, 128);
for (index, name) in ["session1", "session2", "session3"].iter().enumerate() {
let b = if index == 0 { Rgb(50,50,50) } else { Rgb(40,40,40) };
y_push((2 * index) as u16,
&h_exact(2, w_full(bg(b, origin_w(fg(f, name)))))).draw(to);
}
Ok(to.area().into())
}))).draw(to),
Some(":browse/title") => w_full(origin_w(field_v(ItemTheme::default(), Some(":browse/title") => w_full(origin_w(field_v(ItemTheme::default(),
match state.dialog.browser_target().unwrap() { match state.dialog.browser_target().unwrap() {
@ -562,7 +554,7 @@ fn tek_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usually<XYWH<u
if let Some(dsl) = views.get(dsl.src()?.unwrap()) { if let Some(dsl) = views.get(dsl.src()?.unwrap()) {
let dsl = dsl.clone(); let dsl = dsl.clone();
std::mem::drop(views); std::mem::drop(views);
state.interpret(to, &dsl)? state.interpret(to, &dsl)
} else { } else {
unimplemented!("{dsl:?}"); unimplemented!("{dsl:?}");
} }

View file

@ -20,7 +20,7 @@ pub(crate) fn load_bind (binds: &Binds, name: &impl AsRef<str>, body: &impl Lang
/// ///
/// ``` /// ```
/// let lang = "(@x (nop)) (@y (nop) (nop))"; /// let lang = "(@x (nop)) (@y (nop) (nop))";
/// let bind = tek::Bind::<tek::tengri::TuiEvent, std::sync::Arc<str>>::load(&lang).unwrap(); /// let bind = tek::Bind::<tek::tengri::term::TuiEvent, std::sync::Arc<str>>::load(&lang).unwrap();
/// assert_eq!(bind.query(&'x'.into()).map(|x|x.len()), Some(1)); /// assert_eq!(bind.query(&'x'.into()).map(|x|x.len()), Some(1));
/// //assert_eq!(bind.query(&'y'.into()).map(|x|x.len()), Some(2)); /// //assert_eq!(bind.query(&'y'.into()).map(|x|x.len()), Some(2));
/// ``` /// ```

View file

@ -98,7 +98,7 @@ impl Action {
} => { } => {
let name = name.as_ref().map_or("tek", |x|x.as_str()); let name = name.as_ref().map_or("tek", |x|x.as_str());
let jack = Jack::new(&name)?; let jack = Jack::new(&name)?;
let proj = tek_project_new( let mut proj = tek_project_new(
&jack, Clock::new(&jack, *bpm)?, &lf, &lt, &rf, &rt, &mf, &mt, &mfr, &mtr &jack, Clock::new(&jack, *bpm)?, &lf, &lt, &rf, &rt, &mf, &mt, &mfr, &mtr
)?; )?;
proj.tracks_add(tracks.unwrap_or(0), None, &[], &[])?; proj.tracks_add(tracks.unwrap_or(0), None, &[], &[])?;
@ -135,7 +135,8 @@ impl Action {
//// FIXME: They don't work properly. //// FIXME: They don't work properly.
//Ok(app) //Ok(app)
//})?)?; //})?)?;
} },
_ => todo!()
} }
Ok(()) Ok(())
} }

View file

@ -23,9 +23,9 @@ pub fn view_logo () -> impl Draw<Tui> {
} }
/// ``` /// ```
/// let x = std::sync::Arc::<std::sync::RwLock<String>>::default(); /// let x = "";
/// let _ = tek::view_transport(true, x.clone(), x.clone(), x.clone()); /// let _ = tek::view_transport(true, x.as_ref(), x.as_ref(), x.as_ref());
/// let _ = tek::view_transport(false, x.clone(), x.clone(), x.clone()); /// let _ = tek::view_transport(false, x.as_ref(), x.as_ref(), x.as_ref());
/// ``` /// ```
pub fn view_transport (play: bool, bpm: &str, beat: &str, time: &str) -> impl Draw<Tui> { pub fn view_transport (play: bool, bpm: &str, beat: &str, time: &str) -> impl Draw<Tui> {
let theme = ItemTheme::G[96]; let theme = ItemTheme::G[96];
@ -40,9 +40,9 @@ pub fn view_transport (play: bool, bpm: &str, beat: &str, time: &str) -> impl Dr
} }
/// ``` /// ```
/// let x = std::sync::Arc::<std::sync::RwLock<String>>::default(); /// let x = "";
/// let _ = tek::view_status(None, x.clone(), x.clone(), x.clone()); /// let _ = tek::view_status(None, x.as_ref(), x.as_ref(), x.as_ref());
/// let _ = tek::view_status(Some("".into()), x.clone(), x.clone(), x.clone()); /// let _ = tek::view_status(Some("".into()), x.as_ref(), x.as_ref(), x.as_ref());
/// ``` /// ```
pub fn view_status (sel: Option<&str>, sr: &str, buf: &str, lat: &str) -> impl Draw<Tui> { pub fn view_status (sel: Option<&str>, sr: &str, buf: &str, lat: &str) -> impl Draw<Tui> {
let theme = ItemTheme::G[96]; let theme = ItemTheme::G[96];
@ -569,3 +569,18 @@ pub fn field_h <T: Screen> (theme: ItemTheme, head: impl Draw<T>, body: impl Dra
pub fn field_v <T: Screen> (theme: ItemTheme, head: impl Draw<T>, body: impl Draw<T>) -> impl Draw<T> { pub fn field_v <T: Screen> (theme: ItemTheme, head: impl Draw<T>, body: impl Draw<T>) -> impl Draw<T> {
} }
pub fn view_sessions () -> impl Draw<Tui> {
let h = 6;
let w = Some(30);
let f = Rgb(224, 192, 128);
h_exact(h, w_min(w, thunk(move |to: &mut Tui|{
for (index, name) in ["session1", "session2", "session3"].iter().enumerate() {
let b = if index == 0 { Rgb(50,50,50) } else { Rgb(40,40,40) };
let y = (2 * index) as u16;
let h = 2;
y_push(y, &h_exact(h, w_full(bg(b, origin_w(fg(f, name)))))).draw(to);
}
Ok(to.area().into())
})))
}