Skip to content

Commit

Permalink
Better update status line
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Mar 23, 2024
1 parent 4c2d153 commit 847848a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "KiteViewers"
uuid = "2e593061-95e7-45e4-95f4-df0491f2e601"
authors = ["Uwe Fechner <[email protected]> and contributors"]
version = "0.4.0"
version = "0.4.1"

[deps]
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
Expand Down
18 changes: 16 additions & 2 deletions src/viewer3D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ SOFTWARE. =#
# the orientation of the segments
end

last_status::String=""

"""
abstract type AbstractKiteViewer
Expand Down Expand Up @@ -87,23 +89,29 @@ mutable struct Viewer3D <: AKV
end

function clear_viewer(kv::AKV)
kv.stop = false
kv.step = 1
kv.energy = 0
status[] = "Running..."
stop(kv)
end

function stop(kv::AKV)
kv.stop = true
status[]="Stopped"
running[]=false
end

function pause(kv::AKV)
global last_status
kv.stop = true
last_status=status[]
status[]="Paused"
end

function set_status(kv::AKV, status_text)
global last_status
if status_tex == "Paused"
last_status = status[]
end
status[] = status_text
end

Expand Down Expand Up @@ -185,6 +193,12 @@ function Viewer3D(show_kite=true, autolabel="Autopilot"; precompile=false)
end
on(s.btn_PLAY.clicks) do c
running[] = ! running[]
viewer.stop = ! KiteViewers.running[]
if ! running[]
set_status(s, "Paused")
else
set_status(s, last_status)
end
end
status[] = "Stopped"
s
Expand Down

0 comments on commit 847848a

Please sign in to comment.