remove unneded dep and add kana to stdout

This commit is contained in:
leca 2024-04-02 16:15:26 +03:00
parent 8e38dad6d0
commit 005da0d8c9
2 changed files with 1 additions and 2 deletions

View File

@ -6,7 +6,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
dirs = "5.0.1"
gtk = { version = "0.8.1", package = "gtk4", features = ["v4_12"] } gtk = { version = "0.8.1", package = "gtk4", features = ["v4_12"] }
rand = "0.8.5" rand = "0.8.5"

View File

@ -88,7 +88,7 @@ impl ObjectImpl for GuessingScene {
@strong answer_entry_binding as answer_entry, @strong answer_entry_binding as answer_entry,
@strong stats_label_binding as stats_label => move |_entry: &Entry| { @strong stats_label_binding as stats_label => move |_entry: &Entry| {
let answer: &String = &answer_entry.text().to_string(); let answer: &String = &answer_entry.text().to_string();
println!("{} <-> {}? = {}", answer, correct_answer.borrow().to_string(), *answer == correct_answer.borrow().to_string()); println!("{} <-> {}({})? = {}", answer, correct_answer.borrow().to_string(), question.borrow(), *answer == correct_answer.borrow().to_string());
*stats.borrow_mut() = if *answer == correct_answer.borrow().to_string() { (stats.borrow().0 + 1, stats.borrow().1) } else {(stats.borrow().0, stats.borrow().1 + 1)}; *stats.borrow_mut() = if *answer == correct_answer.borrow().to_string() { (stats.borrow().0 + 1, stats.borrow().1) } else {(stats.borrow().0, stats.borrow().1 + 1)};
stats_label.set_label(format!("Correct|Incorrect: {}|{} ({:.2}%)", stats.borrow().0, stats.borrow().1, 100.0 * f64::from(stats.borrow().0) / f64::from(stats.borrow().0 + stats.borrow().1)).as_str()); stats_label.set_label(format!("Correct|Incorrect: {}|{} ({:.2}%)", stats.borrow().0, stats.borrow().1, 100.0 * f64::from(stats.borrow().0) / f64::from(stats.borrow().0 + stats.borrow().1)).as_str());
*question.borrow_mut() = ask(ktr, rtk, hiragana, katakana); *question.borrow_mut() = ask(ktr, rtk, hiragana, katakana);