Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if PACKMOL_GUI="false" does not load the FileDialog #10

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/packmol_runner.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Packmol_jll
import NativeFileDialog

packmol_runner = Packmol_jll.packmol()

Expand Down Expand Up @@ -51,12 +50,6 @@ function run_packmol(input_file::String)
return nothing
end

@doc (@doc run_packmol)
function run_packmol()
input_file = NativeFileDialog.pick_file()
run_packmol(input_file)
end

@testitem "run_packmol" begin
using Packmol
test_dir = Packmol.src_dir*"/../test/run_packmol"
Expand All @@ -70,4 +63,18 @@ end
@test isfile("water_box.pdb")
end


@static if haskey(ENV, "PACKMOL_GUI") && ENV["PACKMOL_GUI"] == "false"
function run_packmol()
throw(ArgumentError("""\n
Environment variable PACKMOL_GUI is set to false. Set it to true to use the file dialog.

"""))
end
else
import NativeFileDialog
@doc (@doc run_packmol)
function run_packmol()
input_file = NativeFileDialog.pick_file()
run_packmol(input_file)
end
end
Loading