Skip to content

Commit

Permalink
add option to disable the loading of the file dialog for headless nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiq committed Nov 12, 2024
1 parent 319157b commit a68891f
Showing 1 changed file with 15 additions and 8 deletions.
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

0 comments on commit a68891f

Please sign in to comment.