mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-26 07:56:34 +08:00
new strip
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<rows>
|
||||
<widget size="500" name="map2d"/>
|
||||
<columns>
|
||||
<rows size="390">
|
||||
<rows size="370">
|
||||
<widget size="200" name="strips"/>
|
||||
</rows>
|
||||
<widget size="400" name="aircraft"/>
|
||||
|
||||
@@ -1030,11 +1030,9 @@
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image7">
|
||||
<property name="width_request">16</property>
|
||||
<property name="height_request">16</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-stop</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
@@ -1065,7 +1063,7 @@
|
||||
<widget class="GtkImage" id="image8">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-redo</property>
|
||||
<property name="icon_size">2</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
@@ -1096,7 +1094,7 @@
|
||||
<widget class="GtkImage" id="image4">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-goto-bottom</property>
|
||||
<property name="icon_size">2</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
@@ -1158,7 +1156,7 @@
|
||||
<widget class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-goto-first</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
@@ -1189,7 +1187,7 @@
|
||||
<widget class="GtkImage" id="image6">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-media-pause</property>
|
||||
<property name="icon_size">2</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
@@ -1220,7 +1218,7 @@
|
||||
<widget class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-goto-last</property>
|
||||
<property name="icon_size">2</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
@@ -1251,7 +1249,7 @@
|
||||
<widget class="GtkImage" id="image5">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-go-up</property>
|
||||
<property name="icon_size">2</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
@@ -1280,9 +1278,11 @@
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image10">
|
||||
<property name="width_request">22</property>
|
||||
<property name="height_request">22</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-apply</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
|
||||
@@ -701,13 +701,8 @@ let listen_flight_params = fun geomap auto_center_new_ac alert ->
|
||||
ac.first_pos <- false
|
||||
end;
|
||||
|
||||
let set_label lbl_name value =
|
||||
let s =
|
||||
if value < 0.
|
||||
then sprintf "- %.0f" (abs_float value)
|
||||
else sprintf "%.0f" value
|
||||
in
|
||||
ac.strip#set_label lbl_name s
|
||||
let set_label = fun lbl_name value ->
|
||||
ac.strip#set_label lbl_name (sprintf "%.0fm" value)
|
||||
in
|
||||
set_label "altitude" alt;
|
||||
ac.strip#set_speed speed;
|
||||
@@ -733,10 +728,10 @@ let listen_flight_params = fun geomap auto_center_new_ac alert ->
|
||||
and cur_stage = Pprz.int_assoc "cur_stage" vs in
|
||||
highlight_fp ac cur_block cur_stage;
|
||||
let set_label = fun l f ->
|
||||
ac.strip#set_label l (sprintf "%.0f" (Pprz.float_assoc f vs)) in
|
||||
ac.strip#set_label l (sprintf "%.0fm" (Pprz.float_assoc f vs)) in
|
||||
set_label "target_altitude" "target_alt";
|
||||
let target_alt = Pprz.float_assoc "target_alt" vs in
|
||||
ac.strip#set_label "diff_target_alt" (sprintf "%+.0f" (ac.alt -. target_alt));
|
||||
ac.strip#set_label "diff_target_alt" (sprintf "%+.0fm" (ac.alt -. target_alt));
|
||||
ac.target_alt <- target_alt;
|
||||
let b = try List.assoc cur_block ac.blocks with Not_found -> failwith (sprintf "Error: unknown block %d for A/C %s" cur_block ac.ac_name) in
|
||||
if b <> ac.last_block_name then begin
|
||||
|
||||
@@ -257,14 +257,22 @@ let add = fun config color center_ac mark ->
|
||||
strip#button_plus_five, 5.;
|
||||
strip#button_plus_thirty, 30.]
|
||||
|
||||
method connect_shift_lateral callback =
|
||||
method connect_shift_lateral = fun callback ->
|
||||
connect_buttons callback
|
||||
[ strip#button_left, -5.;
|
||||
strip#button_right, 5.;
|
||||
strip#button_center, 0.]
|
||||
|
||||
method connect_kill callback =
|
||||
connect_buttons callback
|
||||
method connect_kill = fun callback ->
|
||||
let callback = fun x ->
|
||||
if x = 1. then
|
||||
match GToolbox.question_box ~title:"Kill throttle" ~buttons:["Kill"; "Cancel"] (Printf.sprintf "Kill throttle of A/C %s ?" ac_name) with
|
||||
1 -> callback 1.
|
||||
| _ -> ()
|
||||
else (* No confirmation for resurrect *)
|
||||
callback x
|
||||
in
|
||||
connect_buttons callback
|
||||
[ strip#button_kill, 1.;
|
||||
strip#button_resurrect, 0.]
|
||||
|
||||
@@ -273,16 +281,18 @@ let add = fun config color center_ac mark ->
|
||||
[ strip#button_launch, 1. ]
|
||||
|
||||
method connect_mode = fun callback ->
|
||||
let callback = fun _ ->
|
||||
callback 2.; (* Back in AUTO2 *)
|
||||
true in
|
||||
let callback = fun _ -> (* Back in AUTO2 *)
|
||||
match GToolbox.question_box ~title:"Back to auto" ~buttons:["AUTO"; "Cancel"] (Printf.sprintf "Restore AUTO mode for A/C %s ?" ac_name) with
|
||||
1 -> callback 2.; true
|
||||
| _ -> true in
|
||||
ignore(strip#eventbox_mode#event#connect#button_press ~callback)
|
||||
|
||||
|
||||
(* Reset the flight time *)
|
||||
method connect_flight_time = fun callback ->
|
||||
let callback = fun _ ->
|
||||
callback 0.;
|
||||
true in
|
||||
let callback = fun _ -> (* Reset flight time *)
|
||||
match GToolbox.question_box ~title:"Reset flight time" ~buttons:["Reset"; "Cancel"] (Printf.sprintf "Reset flight time for A/C %s ?" ac_name) with
|
||||
1 -> callback 0.; true
|
||||
| _ -> true in
|
||||
ignore(strip#eventbox_flight_time#event#connect#button_press ~callback)
|
||||
|
||||
method hide_buttons () = strip#hbox_user#misc#hide (); strip#frame_nav#misc#set_sensitive false
|
||||
|
||||
Reference in New Issue
Block a user