Skip to content

Commit

Permalink
Release nwbview 0.2.4 (#35)
Browse files Browse the repository at this point in the history
* add back static/icon to include directive in Cargo.toml

* version 0.2.4

* remove extra call to eframe::run_native
  • Loading branch information
anilbey authored Mar 14, 2023
1 parent ca5c8d3 commit 224ff13
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ authors = ["Anıl Tuncel <[email protected]>"]
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"
Expand All @@ -14,7 +14,8 @@ include = [
"Cargo.lock",
"Cargo.toml",
"LICENSE",
"src/**/*"
"src/**/*",
"static/icon.png",
]

[[bin]]
Expand Down
38 changes: 15 additions & 23 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -23,27 +30,12 @@ fn main() {
drag_and_drop_support: true,
..Default::default()
};

eframe::run_native(
"NWB View",
options,
Box::new(|_cc| Box::<NWBView>::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::<NWBView>::default()),
)
.ok();
}
}
eframe::run_native(
"NWB View",
options,
Box::new(|_cc| Box::<NWBView>::default()),
)
.ok();
}

0 comments on commit 224ff13

Please sign in to comment.