Commit 5a4d9867 authored by Benoit Barbot's avatar Benoit Barbot
Browse files

progress

parent c6b21e36
Pipeline #1689 passed with stages
in 32 seconds
......@@ -4,18 +4,24 @@ open Js_of_ocaml
let build_interface_elem up (opt,x,help) =
let open Arguments in
let input = match x with
| Bool f -> checkbox_input ~on_change:(fun x -> f:= x;up ()) false
| Set_int a -> text_input ~_type:"number" ~on_change:(fun x -> a:= Some (int_of_string x);up ()) ("")
| Int (f,df) -> text_input ~_type:"number" ~on_change:(fun x -> f:= (int_of_string x);up ()) (string_of_int df)
| Set_float (a) -> text_input ~_type:"text" ~on_change:(fun x -> a := Some (float_of_string x);up ()) ""
| Float (f,df) -> text_input ~_type:"text" ~on_change:(fun x -> f:= (float_of_string x);up ()) (string_of_float df)
| Set_string f -> text_input ~_type:"text" ~on_change:(fun x -> f := Some x;up ()) ""
| String (a,ds) -> text_input ~_type:"text" ~on_change:(fun x -> a:= x;up ()) ds
| Bool f -> [checkbox_input ~on_change:(fun x -> f:= x;up ()) false ]
| Set_int a -> [text_input ~_type:"number" ~on_change:(fun x -> a:= int_of_string_opt x; up ()) ("")]
| Int (f,df) -> [text_input ~_type:"number" ~on_change:(fun x ->
(match int_of_string_opt x with
None -> f := df
| Some v -> f:= v);up ()) (string_of_int df)]
| Set_float (a) -> [text_input ~_type:"text" ~on_change:(fun x -> a := float_of_string_opt x;up ()) ""]
| Float (f,df) -> [text_input ~_type:"text" ~on_change:(fun x ->
(match float_of_string_opt x with
None -> f := df
| Some v -> f :=v);up ()) (string_of_float df)]
| Set_string f -> [text_input ~_type:"text" ~on_change:(fun x -> f := if x = "" then None else Some x;up ()) ""]
| String (a,ds) -> [text_input ~_type:"text" ~on_change:(fun x -> a:= x;up ()) ds]
| Symbol s ->
let module S = (val s : SYM) in
select S.list ~on_change:(fun x -> S.content := S.of_string x;up ())
[select S.list ~on_change:(fun x -> S.content := S.of_string x;up ())]
in
div ~class_:"cmdelem" ~title:help [text opt; text " : "; input ]
div ~class_:"cmdelem" ~title:help ([text opt; text " : " ] @ input )
let build_cmd_elem (opt,x,help) =
let open Arguments in
......@@ -102,18 +108,16 @@ let _ = run @@ fun () ->
let g2 = Scanf.unescaped g in
Js.Unsafe.fun_call (Js.Unsafe.js_expr "loadVis")
[|Js.Unsafe.inject container; Js.Unsafe.inject (Js.string g2) |]
| Error (Failure s) ->
| Error (err) ->
let eerr = Scanf.unescaped err in
outfile_up "";
sig_up [];
alert_up [text "Failure : "; text s]
| Error exn ->
outfile_up "";
sig_up [];
alert_up [text "Not Parsing : "; text (Printexc.to_string exn)]
alert_up [text eerr]
| ParseOK ->
sig_up [text "Parsing OK"];
alert_up [];
| Finish ->
sig_up [text "Computation Finished"];
(match OutFormat.plot_of_style !out_style !store_traj "myData.dat" with
Some plot ->
Js.Unsafe.fun_call (Js.Unsafe.js_expr "compute_gnuplot") [|
......@@ -155,6 +159,14 @@ let _ = run @@ fun () ->
build_interface ~class_:"" ~stop:(fun () -> worker##postMessage (Worker_sync.Stop)) launch_compt spec_short;];
div ~class_:"" [div ~class_:"output" [ txin; container]];
br ();
(* a ~on_click:(fun () ->
let open Js_of_ocaml.Url in
let link = Current.path_string in
match url_of_string "google.fr" with
Some x -> Current.set x
| None -> ()
;
) [text "direct link"];*)
alert; sigt;
(div ~class_:"output" [
......
......@@ -119,5 +119,5 @@ let _ =
Js_of_ocaml.Worker.post_message (Finish)
with
Interrupted -> ()
| x -> Js_of_ocaml.Worker.post_message (Error x)
| x -> Js_of_ocaml.Worker.post_message (Error (String.escaped (Printexc.to_string x)))
)
......@@ -23,4 +23,4 @@ type result_type =
| Finish
| ParseOK
| Graph of string
| Error of exn
| Error of string
Markdown is supported
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