remove stop button, and replace with start/pause combined into one button
parent
1e9885bd4b
commit
951f9281a5
|
|
@ -88,12 +88,11 @@ hm = Makie.heatmap!(ax, heat_obs, colormap=:viridis)
|
||||||
ax.aspect = DataAspect()
|
ax.aspect = DataAspect()
|
||||||
|
|
||||||
# # Controls
|
# # Controls
|
||||||
|
run_label = Observable("Run")
|
||||||
fig[2, 1] = buttongrid = GridLayout(tellwidth=false)
|
fig[2, 1] = buttongrid = GridLayout(tellwidth=false)
|
||||||
btn_step = Button(buttongrid[1, 1], label="Step")
|
btn_step = Button(buttongrid[1, 1], label="Step")
|
||||||
btn_start = Button(buttongrid[1, 2], label="Start")
|
btn_start = Button(buttongrid[1, 2], width=50, label=run_label)
|
||||||
btn_stop = Button(buttongrid[1, 3], label="Stop")
|
btn_reset = Button(buttongrid[1, 3], label="Reset")
|
||||||
btn_reset = Button(buttongrid[1, 4], label="Reset")
|
|
||||||
|
|
||||||
gh[1, 2] = textboxgrid = GridLayout(tellwidth=false)
|
gh[1, 2] = textboxgrid = GridLayout(tellwidth=false)
|
||||||
rowsize!(gh, 1, Relative(1.0))
|
rowsize!(gh, 1, Relative(1.0))
|
||||||
|
|
@ -134,29 +133,24 @@ function animation_loop()
|
||||||
sleep(0.05) # ~20 FPS
|
sleep(0.05) # ~20 FPS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
on(box_u.stored_string) do s
|
|
||||||
try
|
on(running) do r
|
||||||
Du[] = parse(Float64, s)
|
run_label[] = r ? "Pause" : "Run"
|
||||||
println("Change Du ", Du[])
|
|
||||||
catch
|
|
||||||
@warn "Invalid input for Du: $s"
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
on(btn_step.clicks) do _
|
on(btn_step.clicks) do _
|
||||||
multi_step!((U, V), 30)
|
multi_step!((U, V), 30)
|
||||||
end
|
end
|
||||||
|
|
||||||
on(btn_start.clicks) do _
|
on(btn_start.clicks) do _
|
||||||
if !running[]
|
running[] = !running[]
|
||||||
running[] = true
|
end
|
||||||
@async animation_loop()
|
on(btn_start.clicks) do _
|
||||||
|
@async while running[]
|
||||||
|
animation_loop()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on(btn_stop.clicks) do _
|
|
||||||
running[] = false
|
|
||||||
end
|
|
||||||
|
|
||||||
on(btn_reset.clicks) do _
|
on(btn_reset.clicks) do _
|
||||||
running[] = false
|
running[] = false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue