Buttons disabling after action

This commit is contained in:
Pascal Brisset
2007-11-08 06:58:02 +00:00
parent 513c23b449
commit 9c843d7d6d
3 changed files with 27 additions and 6 deletions
+1
View File
@@ -56,6 +56,7 @@ let get_time state = state.t
let get_attitude state = (state.phi, state.theta, state.psi)
let set_air_speed state x = state.nominal_air_speed <- x
let get_air_speed state = state.nominal_air_speed
let drag = 0.45
let g = 9.81
+1
View File
@@ -35,6 +35,7 @@ val get_time : state -> float
val get_attitude : state -> radian * radian * radian
val set_air_speed : state -> meter_s -> unit
val get_air_speed : state -> meter_s
module Make :
functor (A : Data.MISSION) ->
+25 -6
View File
@@ -231,21 +231,40 @@ module Make(AircraftItl : AIRCRAFT_ITL) = struct
let take_off = fun () -> FlightModel.set_air_speed !state FM.nominal_airspeed in
let hbox = GPack.hbox ~spacing:4 ~packing:vbox#pack () in
let s = GButton.button ~label:"Set Pos" ~packing:hbox#pack () in
ignore (s#connect#clicked ~callback:set_pos);
let set_pos_and_boot = fun () ->
s#misc#set_sensitive false;
boot () in
if not !autoboot then begin
let s = GButton.button ~label:"Boot" ~packing:(hbox#pack) () in
ignore (s#connect#clicked ~callback:boot)
let callback = fun () ->
set_pos_and_boot ();
s#misc#set_sensitive false in
ignore (s#connect#clicked ~callback)
end else
boot ();
set_pos_and_boot ();
if not !autolaunch then begin
let t = GButton.button ~label:"Launch" ~packing:hbox#pack () in
ignore (t#connect#clicked ~callback:take_off)
let callback = fun () ->
take_off ();
t#misc#set_sensitive false in
ignore (t#connect#clicked ~callback);
(* Monitor an AUTO2 lauch to disable the button *)
let monitor = fun () ->
if FlightModel.get_air_speed !state > 0. then begin
t#misc#set_sensitive false;
false
end else
true in
ignore (GMain.Timeout.add 1000 monitor)
end else
take_off ();
let s = GButton.button ~label:"Set Pos" ~packing:hbox#pack () in
ignore (s#connect#clicked ~callback:set_pos);
let hbox = GPack.hbox ~packing:vbox#pack () in
let l = fun s -> ignore(GMisc.label ~text:s ~packing:hbox#pack ()) in
l "East:"; hbox#pack east_label#coerce;