adding ron to slide serializing...
It's possible I could use this as a method of creating slides in text form. It's vastly easier to implement.
This commit is contained in:
parent
66c37775d1
commit
2408404ff4
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3132,6 +3132,7 @@ dependencies = [
|
|||
"libcosmic",
|
||||
"miette",
|
||||
"pretty_assertions",
|
||||
"ron",
|
||||
"serde",
|
||||
"serde-lexpr",
|
||||
"strum",
|
||||
|
|
|
@ -19,3 +19,4 @@ tracing-subscriber = { version = "0.3.18", features = ["fmt", "std", "chrono", "
|
|||
iced_video_player = { git = "https://github.com/jackpot51/iced_video_player", branch = "cosmic", features = ["wgpu"] }
|
||||
strum = "0.26.3"
|
||||
strum_macros = "0.26.4"
|
||||
ron = "0.8.1"
|
||||
|
|
|
@ -27,9 +27,10 @@ pub(crate) enum Keyword {
|
|||
ImageFit(ImageFit),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumString)]
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq, EnumString)]
|
||||
pub(crate) enum ImageFit {
|
||||
#[strum(ascii_case_insensitive)]
|
||||
#[default]
|
||||
Cover,
|
||||
#[strum(ascii_case_insensitive)]
|
||||
Fill,
|
||||
|
|
|
@ -316,25 +316,25 @@ fn build_image_bg(atom: &Value, image_map: &mut HashMap<String, String>, map_ind
|
|||
}
|
||||
}
|
||||
|
||||
fn build_slide(exp: Value) -> Result<Slide> {
|
||||
let mut slide_builder = SlideBuilder::new();
|
||||
let mut keyword = "idk";
|
||||
for value in exp.as_cons().unwrap().to_vec().0 {
|
||||
let mut vecs = vec![vec![]];
|
||||
match value {
|
||||
Value::Symbol(symbol) => {}
|
||||
Value::Keyword(keyword) => {}
|
||||
Value::String(string) => {}
|
||||
Value::Number(num) => {}
|
||||
Value::Cons(cons) => {
|
||||
vecs.push(get_lists(&value));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
// fn build_slide(exp: Value) -> Result<Slide> {
|
||||
// let mut slide_builder = SlideBuilder::new();
|
||||
// let mut keyword = "idk";
|
||||
// for value in exp.as_cons().unwrap().to_vec().0 {
|
||||
// let mut vecs = vec![vec![]];
|
||||
// match value {
|
||||
// Value::Symbol(symbol) => {}
|
||||
// Value::Keyword(keyword) => {}
|
||||
// Value::String(string) => {}
|
||||
// Value::Number(num) => {}
|
||||
// Value::Cons(cons) => {
|
||||
// vecs.push(get_lists(&value));
|
||||
// }
|
||||
// _ => {}
|
||||
// }
|
||||
// }
|
||||
|
||||
todo!()
|
||||
}
|
||||
// todo!()
|
||||
// }
|
||||
|
||||
fn build_slides(
|
||||
cons: &lexpr::Cons,
|
||||
|
@ -429,4 +429,19 @@ mod test {
|
|||
let test_slide = test_slide();
|
||||
assert_eq!(slide, test_slide)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ron_deserialize() {
|
||||
let slide = read_to_string("./test_presentation.ron").expect("Problem getting file read");
|
||||
match ron::from_str::<Vec<Slide>>(&slide) {
|
||||
Ok(s) => {
|
||||
dbg!(s);
|
||||
assert!(true)
|
||||
}
|
||||
Err(e) => {
|
||||
dbg!(e);
|
||||
assert!(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
31
test_presentation.ron
Normal file
31
test_presentation.ron
Normal file
|
@ -0,0 +1,31 @@
|
|||
[
|
||||
(
|
||||
id: 0,
|
||||
background: Background(
|
||||
path: "~/pics/frodo.jpg",
|
||||
kind: Image
|
||||
),
|
||||
text: "This is Frodo",
|
||||
font: "Quicksand",
|
||||
font_size: 50,
|
||||
text_alignment: MiddleCenter,
|
||||
video_loop: false,
|
||||
video_start_time: 0.0,
|
||||
video_end_time: 0.0,
|
||||
),
|
||||
|
||||
(
|
||||
id: 0,
|
||||
background: Background(
|
||||
path: "~/vids/test/chosensmol.mp4",
|
||||
kind: Video
|
||||
),
|
||||
text: "This is Frodo",
|
||||
font: "Quicksand",
|
||||
font_size: 50,
|
||||
text_alignment: MiddleCenter,
|
||||
video_loop: false,
|
||||
video_start_time: 0.0,
|
||||
video_end_time: 0.0,
|
||||
)
|
||||
]
|
Loading…
Reference in a new issue