Horloges v1.1

This commit is contained in:
2026-08-30 16:34:39 +02:00
parent c5cc3e1f17
commit 8bc9cf6132
2 changed files with 29 additions and 4 deletions
+8
View File
@@ -0,0 +1,8 @@
[Desktop Entry]
Name=Horloges Boursières Mondiales
Exec=/home/jfgiraud/Rust/horloge-bourses-mondiales/target/debug/horloge-bourses-mondiales-gui
Icon=/home/jfgiraud/Rust/horloge-bourses-mondiales/clock.png
Type=Application
Categories=Utility;
StartupWMClass=horloge-bourses-mondiales
+21 -4
View File
@@ -9,17 +9,31 @@ use std::time::Duration;
use std::path::Path; use std::path::Path;
pub fn main() -> iced::Result { pub fn main() -> iced::Result {
// Chargement propre de l'icône avec la crate `image` // Chargement de l'icône avec logs de diagnostic pour identifier le souci
let icon = if Path::new("clock.png").exists() { let icon = if Path::new("clock.png").exists() {
match image::open("clock.png") { match image::open("clock.png") {
Ok(img) => { Ok(img) => {
let rgba = img.to_rgba8(); let rgba = img.to_rgba8();
let (width, height) = rgba.dimensions(); let (width, height) = rgba.dimensions();
iced::window::icon::from_rgba(rgba.into_raw(), width, height).ok() println!("Image clock.png chargée : {}x{} pixels", width, height);
match iced::window::icon::from_rgba(rgba.into_raw(), width, height) {
Ok(ico) => {
println!("Icône Iced créée avec succès !");
Some(ico)
}
Err(e) => {
println!("Erreur Iced icon::from_rgba : {:?}", e);
None
}
}
}
Err(e) => {
println!("Erreur lors du décodage de l'image clock.png : {}", e);
None
} }
Err(_) => None,
} }
} else { } else {
println!("Attention : le fichier clock.png est introuvable dans le répertoire courant !");
None None
}; };
@@ -32,6 +46,10 @@ pub fn main() -> iced::Result {
.window(iced::window::Settings { .window(iced::window::Settings {
size: iced::Size { width: 1700.0, height: 320.0 }, size: iced::Size { width: 1700.0, height: 320.0 },
icon, icon,
platform_specific: iced::window::settings::PlatformSpecific {
application_id: "horloge-bourses-mondiales".to_string(),
..Default::default()
},
..Default::default() ..Default::default()
}) })
.run_with(WorldClocksApp::new) .run_with(WorldClocksApp::new)
@@ -87,7 +105,6 @@ impl WorldClocksApp {
.size(13) .size(13)
.style(|_theme: &Theme| text::Style { color: Some(Color::from_rgb(0.0, 0.8, 0.8)) }) .style(|_theme: &Theme| text::Style { color: Some(Color::from_rgb(0.0, 0.8, 0.8)) })
); );
// Espace vide invisible pour garder exactement la même hauteur que les lignes "ville + statut" des autres bourses
col = col.push(text(" ").size(11)); col = col.push(text(" ").size(11));
} else { } else {
col = col.push(text(exchange.city.clone()).size(13)); col = col.push(text(exchange.city.clone()).size(13));