diff --git a/Cargo.toml b/Cargo.toml index 48e4aa6..b8e8ae4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,10 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -egui = { version = "0.33.3" } -eframe = { version = "0.33.3" } -log = "0.4.28" -colog = "1.4.0" +eframe = { version = "*" } rfd = "*" json = "*" serde = { version = "*", features = ["derive"] } diff --git a/src/main.rs b/src/main.rs index 0c905d7..a64ee48 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,12 +2,10 @@ use std::path::PathBuf; use eframe::egui; use eframe::egui::KeyboardShortcut; -use log::{info, warn, error}; use billy_sheet::gui::SheetGui; fn main() -> eframe::Result { - colog::init(); let options = eframe::NativeOptions { viewport: egui::ViewportBuilder::default().with_drag_and_drop(true), ..Default::default() @@ -38,8 +36,8 @@ impl Default for Gui { impl eframe::App for Gui { fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { egui::TopBottomPanel::top("menu").show(ctx, |ui| { - egui::MenuBar::new().ui(ui, |ui| { - egui::widgets::global_theme_preference_buttons(ui); + egui::menu::bar(ui, |ui| { + egui::widgets::global_dark_light_mode_buttons(ui); ui.menu_button("File", |ui| { if ui.button("Open (Ctrl + O)").clicked() { if let Some(path) = rfd::FileDialog::new() @@ -56,7 +54,7 @@ impl eframe::App for Gui { if ui.button("Save in json").clicked() { let path = std::path::Path::new("./sheet.json"); if let Err(error) = billy_sheet::sheet::write_sheet(path, &self.sheet) { - error!("{error}"); + println!("{error}"); } } }); @@ -101,19 +99,7 @@ impl eframe::App for Gui { } }); if let Some(file_path) = &self.picked_path { - if let Some(extension) = file_path.extension() { - info!("File selected : {}", file_path.display()); - if extension == "json" { - info!("File has json extension"); - } else { - warn!( - "File has not .json: {}", - extension.to_str().unwrap_or_default() - ); - } - } else { - error!("No extension for the file."); - } + println!("{}", file_path.to_str().unwrap_or_default()); self.picked_path = None; } } diff --git a/src/sheet.rs b/src/sheet.rs index ac177f8..0021891 100644 --- a/src/sheet.rs +++ b/src/sheet.rs @@ -40,7 +40,7 @@ pub struct CharacterSheet { pub fn write_sheet(path: &std::path::Path, sheet: &CharacterSheet) -> std::io::Result<()> { let sheet_str = serde_json::to_string_pretty(&sheet)?; let mut file = std::fs::File::create(path)?; - write!(file, "{sheet_str}") + write!(file, "{}", sheet_str) } impl CharacterSheet {