mirror of
https://github.com/CrispyPin/julia-fractal-renderer.git
synced 2025-06-07 22:55:31 +02:00
add file dialog for selecting output path
This commit is contained in:
parent
bbfb3e053c
commit
723d875d95
3 changed files with 135 additions and 13 deletions
14
src/main.rs
14
src/main.rs
|
@ -8,6 +8,7 @@ use eframe::{
|
|||
};
|
||||
use generate::{render, FillStyle, RenderOptions};
|
||||
use image::EncodableLayout;
|
||||
use native_dialog::FileDialog;
|
||||
|
||||
mod generate;
|
||||
|
||||
|
@ -171,8 +172,17 @@ impl eframe::App for JuliaGUI {
|
|||
self.export_res_multiplier * self.render_options.height
|
||||
));
|
||||
|
||||
let render_button = ui.button(format!("Render to '{}'", &self.export_name));
|
||||
if render_button.clicked() {
|
||||
if ui.button("Select file").clicked() {
|
||||
if let Ok(Some(path)) = FileDialog::new()
|
||||
.set_filename(&self.export_name)
|
||||
.add_filter("PNG file", &["png"])
|
||||
.show_save_single_file()
|
||||
{
|
||||
self.export_name = path.to_string_lossy().to_string();
|
||||
}
|
||||
}
|
||||
ui.label(format!("selected path: {}", &self.export_name));
|
||||
if ui.button("Render").clicked() {
|
||||
self.export_render();
|
||||
}
|
||||
ui.label(format!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue