Skip to content

Commit

Permalink
Update to rfd 0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Feb 1, 2024
1 parent 7df3f9e commit ff2d25b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 37 deletions.
53 changes: 21 additions & 32 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/egui_demo_app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ env_logger = { version = "0.10", default-features = false, features = [
"auto-color",
"humantime",
] }
rfd = { version = "0.11", optional = true }
rfd = { version = "0.13", optional = true }

# web:
[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion examples/file_dialog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ env_logger = { version = "0.10", default-features = false, features = [
"auto-color",
"humantime",
] }
rfd = "0.11"
rfd = "0.13"
6 changes: 4 additions & 2 deletions examples/file_dialog/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release

use eframe::egui;
use eframe::egui::{self, KeyboardShortcut};

fn main() -> Result<(), eframe::Error> {
env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).
Expand Down Expand Up @@ -28,7 +28,9 @@ impl eframe::App for MyApp {
egui::CentralPanel::default().show(ctx, |ui| {
ui.label("Drag-and-drop files onto the window!");

if ui.button("Open file…").clicked() {
let cmd_o = KeyboardShortcut::new(egui::Modifiers::COMMAND, egui::Key::O);

if ui.button("Open file…").clicked() || ui.input_mut(|i| i.consume_shortcut(&cmd_o)) {
if let Some(path) = rfd::FileDialog::new().pick_file() {
self.picked_path = Some(path.display().to_string());
}
Expand Down
2 changes: 1 addition & 1 deletion examples/save_plot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ eframe = { path = "../../crates/eframe", features = [
] }
egui_plot = { path = "../../crates/egui_plot" }
image = { version = "0.24", default-features = false, features = ["png"] }
rfd = "0.11.0"
rfd = "0.13.0"
env_logger = { version = "0.10", default-features = false, features = [
"auto-color",
"humantime",
Expand Down

0 comments on commit ff2d25b

Please sign in to comment.