From 847848ab014ea729efd4240b058132bed0fb2634 Mon Sep 17 00:00:00 2001 From: Uwe Fechner Date: Sat, 23 Mar 2024 13:31:06 +0100 Subject: [PATCH] Better update status line --- Project.toml | 2 +- src/viewer3D.jl | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 3a98606..9f6086b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "KiteViewers" uuid = "2e593061-95e7-45e4-95f4-df0491f2e601" authors = ["Uwe Fechner and contributors"] -version = "0.4.0" +version = "0.4.1" [deps] FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" diff --git a/src/viewer3D.jl b/src/viewer3D.jl index 48b3a35..88d6e36 100644 --- a/src/viewer3D.jl +++ b/src/viewer3D.jl @@ -53,6 +53,8 @@ SOFTWARE. =# # the orientation of the segments end +last_status::String="" + """ abstract type AbstractKiteViewer @@ -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 @@ -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