Horloges v1.1
This commit is contained in:
@@ -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
@@ -9,17 +9,31 @@ use std::time::Duration;
|
||||
use std::path::Path;
|
||||
|
||||
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() {
|
||||
match image::open("clock.png") {
|
||||
Ok(img) => {
|
||||
let rgba = img.to_rgba8();
|
||||
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 {
|
||||
println!("Attention : le fichier clock.png est introuvable dans le répertoire courant !");
|
||||
None
|
||||
};
|
||||
|
||||
@@ -32,6 +46,10 @@ pub fn main() -> iced::Result {
|
||||
.window(iced::window::Settings {
|
||||
size: iced::Size { width: 1700.0, height: 320.0 },
|
||||
icon,
|
||||
platform_specific: iced::window::settings::PlatformSpecific {
|
||||
application_id: "horloge-bourses-mondiales".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.run_with(WorldClocksApp::new)
|
||||
@@ -87,7 +105,6 @@ impl WorldClocksApp {
|
||||
.size(13)
|
||||
.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));
|
||||
} else {
|
||||
col = col.push(text(exchange.city.clone()).size(13));
|
||||
|
||||
Reference in New Issue
Block a user