From 224ff13cb932faa8981530cf352a5c7a87ddf5d4 Mon Sep 17 00:00:00 2001 From: anilbey Date: Tue, 14 Mar 2023 20:12:32 +0100 Subject: [PATCH] Release nwbview 0.2.4 (#35) * add back static/icon to include directive in Cargo.toml * version 0.2.4 * remove extra call to eframe::run_native --- Cargo.lock | 2 +- Cargo.toml | 5 +++-- src/main.rs | 38 +++++++++++++++----------------------- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 69be3ff..872891b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1696,7 +1696,7 @@ dependencies = [ [[package]] name = "nwbview" -version = "0.2.3" +version = "0.2.4" dependencies = [ "eframe", "egui_extras", diff --git a/Cargo.toml b/Cargo.toml index 575a69c..7ca14d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Anıl Tuncel "] categories = ["science", "visualization", "science::neuroscience"] description = "Neurodata Without Borders viewer" name = "nwbview" -version = "0.2.3" +version = "0.2.4" edition = "2021" repository = "https://github.com/brainhack-ch/nwbview" license = "Apache-2.0" @@ -14,7 +14,8 @@ include = [ "Cargo.lock", "Cargo.toml", "LICENSE", - "src/**/*" + "src/**/*", + "static/icon.png", ] [[bin]] diff --git a/src/main.rs b/src/main.rs index bf08f08..6736880 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,11 +10,18 @@ use image::GenericImageView; fn main() { const ICON: &[u8] = include_bytes!("../static/icon.png"); + let mut options = eframe::NativeOptions { + drag_and_drop_support: true, + ..Default::default() + }; match image::load_from_memory(ICON) { + Err(error) => { + println!("Error raised while loading icon: {}", error); + println!("Launching NWBView without the icon..."); + } Ok(icon) => { let (icon_width, icon_height) = icon.dimensions(); - - let options = eframe::NativeOptions { + options = eframe::NativeOptions { icon_data: Some(eframe::IconData { rgba: icon.into_rgba8().to_vec(), width: icon_width, @@ -23,27 +30,12 @@ fn main() { drag_and_drop_support: true, ..Default::default() }; - - eframe::run_native( - "NWB View", - options, - Box::new(|_cc| Box::::default()), - ) - .ok(); - } - Err(error) => { - println!("Error raised while loading icon: {}", error); - println!("Launching without icon..."); - let options = eframe::NativeOptions { - drag_and_drop_support: true, - ..Default::default() - }; - eframe::run_native( - "NWB View", - options, - Box::new(|_cc| Box::::default()), - ) - .ok(); } } + eframe::run_native( + "NWB View", + options, + Box::new(|_cc| Box::::default()), + ) + .ok(); }