small fixes

This commit is contained in:
Scott Pruett 2022-05-25 21:35:56 -04:00
parent c4d9cf341a
commit 33d4024d2c
1 changed files with 8 additions and 7 deletions

View File

@ -13,7 +13,7 @@ use std::{
ops::DerefMut, ops::DerefMut,
sync::{Arc, Mutex}, sync::{Arc, Mutex},
thread, thread,
time::Duration, time::Duration, path::PathBuf,
}; };
use config::{Config, LearnedConfig}; use config::{Config, LearnedConfig};
@ -43,8 +43,9 @@ fn main() -> anyhow::Result<()> {
} }
let options = eframe::NativeOptions::default(); let options = eframe::NativeOptions::default();
let exe = std::env::current_exe().unwrap_or_else(|_| PathBuf::from("supper.exe"));
eframe::run_native( eframe::run_native(
"Supper OCR", &format!("Supper OCR ({:?})", exe),
options, options,
Box::new(|_cc| Box::new(AppUi::new(state))), Box::new(|_cc| Box::new(AppUi::new(state))),
); );
@ -89,14 +90,14 @@ fn label_time_delta(ui: &mut Ui, time: Duration, old: Option<Duration>) {
); );
} }
std::cmp::Ordering::Equal => { std::cmp::Ordering::Equal => {
ui.label("--");
}
std::cmp::Ordering::Greater => {
ui.colored_label( ui.colored_label(
Color32::LIGHT_RED, Color32::LIGHT_RED,
"+".to_owned() + &format_time(time - old), "+".to_owned() + &format_time(time - old),
); );
} }
std::cmp::Ordering::Greater => {
ui.label("--");
}
} }
} else { } else {
ui.label("--"); ui.label("--");
@ -401,10 +402,10 @@ impl eframe::App for AppUi {
img.show_max_size(ui, Vec2::new(600.0, 500.0)); img.show_max_size(ui, Vec2::new(600.0, 500.0));
} }
if !race.exported { if !race.exported {
show_combo_box(ui, "car-combo", "Car", &self.data.cars, &mut race.car); show_combo_box(ui, &format!("car-combo {}", i), "Car", &self.data.cars, &mut race.car);
show_combo_box( show_combo_box(
ui, ui,
"track-combo", &format!("track-combo {}", i),
"Track", "Track",
&self.data.tracks, &self.data.tracks,
&mut race.track, &mut race.track,