Skip to content
Snippets Groups Projects
Commit c498c953 authored by erwan's avatar erwan
Browse files

Refactoring

parent 749a8ea6
No related branches found
No related tags found
1 merge request!14A new rdbgui4sasa with automatic daemons
Pipeline #66594 failed
(* Time-stamp: <modified the 07/05/2021 (at 17:08) by Erwan Jahier> *) (* Time-stamp: <modified the 07/05/2021 (at 17:21) by Erwan Jahier> *)
#thread #thread
#require "lablgtk3" #require "lablgtk3"
...@@ -100,9 +100,6 @@ let custom_daemon p gtext vbox step_button round_button = ...@@ -100,9 +100,6 @@ let custom_daemon p gtext vbox step_button round_button =
let dk_sd = make_but (!daemon_kind=Synchronous) "Synchronous" in let dk_sd = make_but (!daemon_kind=Synchronous) "Synchronous" in
let dk_manual = make_but (!daemon_kind=Manual) "Manual" in let dk_manual = make_but (!daemon_kind=Manual) "Manual" in
let dk_manual_central = make_but (!daemon_kind=ManualCentral) "Manual Central" in let dk_manual_central = make_but (!daemon_kind=ManualCentral) "Manual Central" in
(* let _scrolled = GBin.scrolled_window ~border_width:10 *)
(* ~shadow_type:`OUT ~height:150 ~packing:vbox#add () *)
(* in *)
dk_dd#misc#set_tooltip_text (Printf.sprintf "Set the automatic distributed mode"); dk_dd#misc#set_tooltip_text (Printf.sprintf "Set the automatic distributed mode");
dk_sd#misc#set_tooltip_text (Printf.sprintf "Set the automatic synchronous mode"); dk_sd#misc#set_tooltip_text (Printf.sprintf "Set the automatic synchronous mode");
dk_cd#misc#set_tooltip_text (Printf.sprintf "Set the automatic central mode"); dk_cd#misc#set_tooltip_text (Printf.sprintf "Set the automatic central mode");
...@@ -244,43 +241,30 @@ let custom_daemon p gtext vbox step_button round_button = ...@@ -244,43 +241,30 @@ let custom_daemon p gtext vbox step_button round_button =
) )
nodes_enabled; nodes_enabled;
let hide b = b#misc#hide() in
let show b = b#misc#show() in
let update_checkbox node enabled = let update_checkbox node enabled =
match !daemon_kind with match !daemon_kind with
| Manual -> | Manual ->
step_button#misc#show(); show step_button; show checkbox_grid;
round_button#misc#hide(); hide round_button; hide pushbox_grid; hide counter_grid;
checkbox_grid#misc#show();
pushbox_grid#misc#hide();
counter_grid#misc#hide();
let checkbox = Hashtbl.find checkbox_map node in let checkbox = Hashtbl.find checkbox_map node in
if enabled then if enabled then
checkbox#misc#show () show checkbox
else ( else (
checkbox#set_active false; (* on decoche *) checkbox#set_active false; (* on decoche *)
checkbox#misc#hide () hide checkbox
); );
checkbox#set_sensitive enabled checkbox#set_sensitive enabled
| ManualCentral -> | ManualCentral ->
step_button#misc#hide(); hide step_button; hide round_button; hide checkbox_grid; hide counter_grid;
round_button#misc#hide(); show pushbox_grid;
checkbox_grid#misc#hide();
pushbox_grid#misc#show();
counter_grid#misc#hide();
let pushbox = Hashtbl.find pushbox_map node in let pushbox = Hashtbl.find pushbox_map node in
if enabled then if enabled then show pushbox else hide pushbox;
pushbox#misc#show ()
else
pushbox#misc#hide ();
pushbox#set_sensitive enabled pushbox#set_sensitive enabled
| Distributed | Synchronous | Central | LocCentral -> | Distributed | Synchronous | Central | LocCentral ->
step_button#misc#show(); show step_button; show round_button; show counter_grid;
round_button#misc#show(); hide checkbox_grid; hide pushbox_grid;
checkbox_grid#misc#hide();
pushbox_grid#misc#hide();
counter_grid#misc#show()
in in
let update_all_checkboxes () = let update_all_checkboxes () =
let nodes_enabled = rdbg_nodes_enabled !e in let nodes_enabled = rdbg_nodes_enabled !e in
...@@ -612,9 +596,6 @@ let main () = ...@@ -612,9 +596,6 @@ let main () =
Main.quit () (* terminate gtk *) Main.quit () (* terminate gtk *)
)); ));
(* Affichage d'informations *)
(* let gtext_content = ref "" in *)
refresh () refresh ()
let gui = main let gui = main
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment