Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions src/AdA_VizPickTool_V1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function start_AdA_Picker(;data=nothing)
############################################################
# LOAD PROFILE DATA
@async begin
fn = fetch(Threads.@spawn PICK_FILE[](""))
fn = PICK_FILE[]("")

data = load(fn,"Profile") # we need to make this more foolproof, I don't think we can rely on people calling hteir profile structure Profile
println(fn*" loaded")
Expand Down Expand Up @@ -362,7 +362,7 @@ function start_AdA_Picker(;data=nothing)
elseif s == "Load Picks..."
# load picks from a text file, these will be modifyable
@async begin
fn = fetch(Threads.@spawn PICK_FILE[](""))
fn = PICK_FILE[]("")
println(fn)


Expand Down Expand Up @@ -410,7 +410,7 @@ function start_AdA_Picker(;data=nothing)
elseif s == "Load Picks (not modifyable)..."
# load the picks as point data, these will be treated in a similar way as e.g. the seismicity data
@async begin
fn = fetch(Threads.@spawn PICK_FILE[](""))
fn = PICK_FILE[]("")

# test plot in ax1
#lines!(ax1, [0,100],[0,-200], color = :red,linewidth = 3)
Expand Down Expand Up @@ -482,7 +482,7 @@ function start_AdA_Picker(;data=nothing)
profile_info = (start_lonlat = data.start_lonlat, end_lonlat = data.end_lonlat)

@async begin
fn_save = fetch(Threads.@spawn SAVE_FILE[]("")) # open native file dialog and choose a filename
fn_save = SAVE_FILE[]("") # open native file dialog and choose a filename
filetype = split(fn_save,".")[end] # get the ending
# save depending on file ending
if filetype == "jld2"
Expand All @@ -504,7 +504,7 @@ function start_AdA_Picker(;data=nothing)
elseif s == "Save Screenshot..."
# save a screen shot of the makie window
@async begin
fn_screen = fetch(Threads.@spawn SAVE_FILE[](""))
fn_screen = SAVE_FILE[]("")
save(fn_screen, fig, px_per_unit = 2)
println(fn_screen*" saved")
end
Expand Down
5 changes: 4 additions & 1 deletion src/FileIO/fileIO_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ using JLD2
# replace them by functions that return a fixed filename (there is no user on CI)
const PICK_FILE = Ref{Function}(pick_file)
const SAVE_FILE = Ref{Function}(save_file)
# The dialogs are called directly, on the main thread: macOS only allows windows to be created
# on the main thread and aborts Julia otherwise (NSWindow should only be instantiated on the main
# thread!). Opening them with `Threads.@spawn` did exactly that as soon as Julia had >1 thread.

# function for fileIO menu response
function menu_fileIO_response(s)
if s == "Load Profile..."
@async begin
filename = fetch(Threads.@spawn PICK_FILE[](""))
filename = PICK_FILE[]("")
println(filename)
#data = load_GMG(filename) # load the profile data, this did not work properly
data = load(filename,"Profile")
Expand Down
Loading