From 9d5f7d2fb2e76b74f5c4daddf01649369f48cf0b Mon Sep 17 00:00:00 2001 From: Pcornat Date: Mon, 15 Sep 2025 18:49:52 +0200 Subject: [PATCH 1/5] Up-to-date function usage --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index a64ee48..4eeaf40 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,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::menu::bar(ui, |ui| { - egui::widgets::global_dark_light_mode_buttons(ui); + egui::MenuBar::new().ui(ui, |ui| { + egui::widgets::global_theme_preference_buttons(ui); ui.menu_button("File", |ui| { if ui.button("Open (Ctrl + O)").clicked() { if let Some(path) = rfd::FileDialog::new() From ef751e5cb8b192ede136548cedab2793fd5352b9 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Mon, 15 Sep 2025 19:42:49 +0200 Subject: [PATCH 2/5] Using version number instead of * --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b8e8ae4..4d8bed7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -eframe = { version = "*" } +eframe = { version = "0.32.3" } rfd = "*" json = "*" serde = { version = "*", features = ["derive"] } From 7f8c215227505beabcaa45fa24dc1b526c63ac32 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Mon, 15 Sep 2025 19:43:16 +0200 Subject: [PATCH 3/5] Adding egui directly and log --- Cargo.toml | 3 +++ src/main.rs | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4d8bed7..c334859 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,10 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +egui = {version = "0.32.3", features = ["log"]} eframe = { version = "0.32.3" } +log = "0.4.28" +colog = "1.4.0" rfd = "*" json = "*" serde = { version = "*", features = ["derive"] } diff --git a/src/main.rs b/src/main.rs index 4eeaf40..0c905d7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,10 +2,12 @@ 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() @@ -54,7 +56,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) { - println!("{error}"); + error!("{error}"); } } }); @@ -99,7 +101,19 @@ impl eframe::App for Gui { } }); if let Some(file_path) = &self.picked_path { - println!("{}", file_path.to_str().unwrap_or_default()); + 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."); + } self.picked_path = None; } } From ccd90390803b55990cb30915cc0b75ccb9893058 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Mon, 15 Sep 2025 19:51:46 +0200 Subject: [PATCH 4/5] Simplified code --- src/sheet.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sheet.rs b/src/sheet.rs index 0021891..ac177f8 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 { From 0e65343712e16e742fa83ee62f1674f2ba93e30d Mon Sep 17 00:00:00 2001 From: Pcornat Date: Wed, 4 Feb 2026 16:09:35 +0100 Subject: [PATCH 5/5] Update dependencies --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c334859..48e4aa6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -egui = {version = "0.32.3", features = ["log"]} -eframe = { version = "0.32.3" } +egui = { version = "0.33.3" } +eframe = { version = "0.33.3" } log = "0.4.28" colog = "1.4.0" rfd = "*"