@@ -88,11 +88,13 @@ set_maybe!(obs::Observable, ::NotSpecified) = nothing
88
88
Set the solution of the current appstate to `sol`.
89
89
"""
90
90
function set_sol! (sol)
91
+ wait_for ()
91
92
if isnothing (APPSTATE[])
92
93
APPSTATE[] = AppState (sol)
93
94
else
94
95
APPSTATE[]. sol[] = sol
95
96
end
97
+ wait_for ()
96
98
nothing
97
99
end
98
100
@@ -107,10 +109,12 @@ function set_state!(; sol = NotSpecified(),
107
109
t = NotSpecified (),
108
110
tmin = NotSpecified (),
109
111
tmax = NotSpecified ())
112
+ wait_for ()
110
113
sol != NotSpecified () && set_sol! (sol)
111
114
set_maybe! (appstate (). t, t)
112
115
set_maybe! (appstate (). tmin, tmin)
113
116
set_maybe! (appstate (). tmax, tmax)
117
+ wait_for ()
114
118
nothing
115
119
end
116
120
@@ -127,13 +131,15 @@ function set_graphplot!(; nstate = NotSpecified(),
127
131
estate_rel = NotSpecified (),
128
132
ncolorrange = NotSpecified (),
129
133
ecolorrange = NotSpecified ())
134
+ wait_for ()
130
135
gp = appstate (). graphplot
131
136
set_maybe! (gp. nstate, nstate)
132
137
set_maybe! (gp. estate, estate)
133
138
set_maybe! (gp. nstate_rel, nstate_rel)
134
139
set_maybe! (gp. estate_rel, estate_rel)
135
140
set_maybe! (gp. ncolorrange, ncolorrange)
136
141
set_maybe! (gp. ecolorrange, ecolorrange)
142
+ wait_for ()
137
143
nothing
138
144
end
139
145
@@ -147,13 +153,15 @@ To automaticially create commands see [`dump_app_state()`](@ref).
147
153
function set_timeseries! (key; selcomp = NotSpecified (),
148
154
states = NotSpecified (),
149
155
rel = NotSpecified ())
156
+ wait_for ()
150
157
if ! haskey (appstate (). tsplots[], key)
151
158
appstate (). tsplots[][key] = TimeseriesPlot ()
152
159
end
153
160
tsplot = appstate (). tsplots[][key]
154
161
set_maybe! (tsplot. selcomp, selcomp)
155
162
set_maybe! (tsplot. states, states)
156
163
set_maybe! (tsplot. rel, rel)
164
+ wait_for ()
157
165
nothing
158
166
end
159
167
@@ -166,8 +174,8 @@ Defines timeseries, where `tsarray` is an array of timeseries keyword arguments
166
174
To automaticially create commands see [`dump_app_state()`](@ref).
167
175
"""
168
176
function define_timeseries! (tsarray)
177
+ wait_for ()
169
178
if length (tsarray) != length (appstate (). tsplots[])
170
- @warn " Due to current limitations, you need to reload the page if the number of timeseries plots changes"
171
179
empty! (appstate (). tsplots[])
172
180
tskeys = [gendomid (" ts" ) for _ in tsarray]
173
181
else
@@ -176,6 +184,8 @@ function define_timeseries!(tsarray)
176
184
for (key, tsargs) in zip (tskeys, tsarray)
177
185
set_timeseries! (key; tsargs... )
178
186
end
187
+ notify (appstate (). tsplots)
188
+ wait_for ()
179
189
nothing
180
190
end
181
191
@@ -186,18 +196,18 @@ Generate a list of [`set_sol!`](@ref), [`set_state!`](@ref), [`set_graphplot!`](
186
196
commands to recreate the current appstate.
187
197
The intended usecase is to quickly recreate "starting points" for interactive exploration.
188
198
"""
189
- function dump_app_state ()
190
- appstate ()
191
- println (" To recreate the current state, run the following commands:\n " )
192
- println (styled " set_sol!({red:sol}) # optional if after inspect(sol)" )
193
- println (" set_state!(; t=$(appstate (). t[]) , tmin=$(appstate (). tmin[]) , tmax=$(appstate (). tmax[]) )" )
199
+ function dump_app_state (io = stdout )
200
+ wait_for ()
201
+ println (io, " # To recreate the current state, run the following commands:\n " )
202
+ println (io, styled " set_sol!({red:sol}) # optional if after inspect(sol)" )
203
+ println (io, " set_state!(; t=$(appstate (). t[]) , tmin=$(appstate (). tmin[]) , tmax=$(appstate (). tmax[]) )" )
194
204
gp = appstate (). graphplot
195
- println (" set_graphplot!(; nstate=$(gp. nstate[]) , estate=$(gp. estate[]) , nstate_rel=$(gp. nstate_rel[]) , estate_rel=$(gp. estate_rel[]) , ncolorrange=$(gp. ncolorrange[]) , ecolorrange=$(gp. ecolorrange[]) )" )
196
- println (" define_timeseries!([" )
205
+ println (io, " set_graphplot!(; nstate=$(gp. nstate[]) , estate=$(gp. estate[]) , nstate_rel=$(gp. nstate_rel[]) , estate_rel=$(gp. estate_rel[]) , ncolorrange=$(gp. ncolorrange[]) , ecolorrange=$(gp. ecolorrange[]) )" )
206
+ println (io, " define_timeseries!([" )
197
207
for ts in values (appstate (). tsplots[])
198
208
selstr = replace (repr (ts. selcomp[]), r" ^.*\[ " => " [" )
199
- println (" (; selcomp=$(selstr) , states=$(ts. states[]) , rel=$(ts. rel[]) )," )
209
+ println (io, " (; selcomp=$(selstr) , states=$(ts. states[]) , rel=$(ts. rel[]) )," )
200
210
end
201
- println (" ])" )
211
+ println (io, " ])" )
202
212
nothing
203
213
end
0 commit comments