Commit a9052e90 authored by erwan's avatar erwan
Browse files

New: add a "restart with new seed" button to rdbgui4sasa

parent d9301991
......@@ -79,7 +79,8 @@ let (make_do: string array -> 'v SimuState.t -> RdbgPlugin.t) =
let sasa_config = ref st.config in
let reset () =
pre_enable_processes_opt := None;
sasa_config := st.config
sasa_config :=
(Sasacore.SimuState.make false argv).config (* to take seed changes into account *)
in
(* Do the same job as SasaSimuState.simustep *)
let (step_custom: RdbgPlugin.sl -> RdbgPlugin.sl) =
......
(* Time-stamp: <modified the 19/05/2021 (at 17:04) by Erwan Jahier> *)
(* Time-stamp: <modified the 22/05/2021 (at 21:21) by Erwan Jahier> *)
#thread
#require "lablgtk3"
......@@ -91,7 +91,12 @@ let init_rdbg_hook () =
if sl = [] then
(* when called first (salut), its activation output will be
ignored, so we can give fake values for Enab ans state values *)
let res = List.map (fun (n,t) -> n, fake_val_of_type t) (snd !rdbg_mv) in
let res = List.map (fun (n,t) ->
let v = fake_val_of_type t in
(* Printf.printf "tossing a value for %s -> %s \n%!" n *)
(* (Data.val_to_string string_of_float v); *)
n, v) (snd !rdbg_mv)
in
Some res
else
let sl = List.filter (fun (n,v) -> String.length n > 5 && String.sub n 0 5 = "Enab_") sl in
......@@ -243,7 +248,7 @@ let custom_daemon p gtext vbox step_button round_button =
ignore(pushbox#event#connect#button_press
~callback: (fun _ ->
update_rdbg_hook name true;
goto_hook_call ();
goto_hook_exit ();
goto_hook_call ();
refresh ();
false));
......@@ -560,20 +565,40 @@ let main () =
let _ = make_button `REFRESH "Restar_t" "Restart from the beginning"
(button_cb
(fun ()->
let seed = Seed.get dotfile in
Seed.set seed;
p (Printf.sprintf "Restarting using the seed %d" seed);
r();
if args.salut_mode then
(* in this mode, the hook plays first to provide fake values to sasa
but the hook does not need input at this first step
*)
goto_hook_call ();
goto_hook_exit ();
goto_hook_call ();
d()))
in
let _ = make_button `REFRESH "_New Seed" "Restart from the beginning using a New Seed"
(button_cb
(fun ()->
Seed.reset();
Seed.replay_seed := false;
let seed = Seed.get dotfile in
Seed.set (seed);
p (Printf.sprintf "Restarting using the seed %d" seed);
r();
if args.salut_mode then
(* in this mode, the hook plays first to provide fake values to sasa
but the hook does not need input at this first step
*)
goto_hook_exit ();
goto_hook_call ();
d()))
in
let _ = make_button `MEDIA_PLAY "_Sim2chro" "Launch sim2chro on the generated data (so far)"
(button_cb (fun ()->sim2chro ()))
(button_cb sim2chro)
in
let _ = make_button `MEDIA_PLAY "_Gnuplot" "Launch gnuplot-rif on the generated data (so far)"
(button_cb (fun ()->gnuplot ()))
(button_cb gnuplot)
in
let _ = make_button `INFO "_Info" "Get information about the current session"
(button_cb_string info_string)
......@@ -654,7 +679,8 @@ let main () =
quit (); (* quit rdbg, this will stop the readloop below *)
Main.quit () (* terminate gtk *)
));
Seed.replay_seed := true;
ignore(Seed.get dotfile);
refresh ()
let gui = main
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment