mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 15:30:08 +08:00
Paparazzi Center Exception Handling (tnx to: Serge Le Huitouze)
This commit is contained in:
@@ -98,10 +98,12 @@ let write_preferences = fun (gui:Gtk_pc.window) file (ac_combo:Gtk_tools.combo)
|
|||||||
add_entry xml "last session" session_name in
|
add_entry xml "last session" session_name in
|
||||||
|
|
||||||
(* Save target *)
|
(* Save target *)
|
||||||
let xml =
|
let xml = (
|
||||||
let name = Gtk_tools.combo_value target_combo in
|
try
|
||||||
add_entry xml "last target" name in
|
let name = Gtk_tools.combo_value target_combo in
|
||||||
|
add_entry xml "last target" name
|
||||||
|
with _ -> xml) in
|
||||||
|
|
||||||
let xml =
|
let xml =
|
||||||
try
|
try
|
||||||
(* Save window size *)
|
(* Save window size *)
|
||||||
|
|||||||
@@ -166,40 +166,41 @@ let parse_ac_targets = fun target_combo ac_file ->
|
|||||||
store#clear ();
|
store#clear ();
|
||||||
(** Clear ComboBox
|
(** Clear ComboBox
|
||||||
**)
|
**)
|
||||||
let af_xml = Xml.parse_file (Env.paparazzi_src // "conf" // ac_file) in
|
(try
|
||||||
List.iter (fun tag ->
|
let af_xml = Xml.parse_file (Env.paparazzi_src // "conf" // ac_file) in
|
||||||
if ExtXml.tag_is tag "firmware" then begin
|
List.iter (fun tag ->
|
||||||
begin try
|
if ExtXml.tag_is tag "firmware" then begin
|
||||||
List.iter (fun tar ->
|
begin try
|
||||||
if ExtXml.tag_is tar "target" then begin
|
List.iter (fun tar ->
|
||||||
begin try
|
if ExtXml.tag_is tar "target" then begin
|
||||||
(** Temp Hack: remove these 3 lines once the bottom parts is ready *)
|
begin try
|
||||||
let (store, column) = Gtk_tools.combo_model target_combo in
|
(** Temp Hack: remove these 3 lines once the bottom parts is ready *)
|
||||||
let row = store#append () in
|
let (store, column) = Gtk_tools.combo_model target_combo in
|
||||||
store#set ~row ~column (Xml.attrib tar "name");
|
let row = store#append () in
|
||||||
(* this is the way to go *)
|
store#set ~row ~column (Xml.attrib tar "name");
|
||||||
strings := (Xml.attrib tar "name") :: !strings;
|
(* this is the way to go *)
|
||||||
count := !count + 1
|
strings := (Xml.attrib tar "name") :: !strings;
|
||||||
with _ -> () end;
|
count := !count + 1
|
||||||
end)
|
with _ -> () end;
|
||||||
(Xml.children tag)
|
end)
|
||||||
with _ -> () end;
|
(Xml.children tag)
|
||||||
end)
|
with _ -> () end;
|
||||||
(Xml.children af_xml);
|
end)
|
||||||
if !count = 0 then begin
|
(Xml.children af_xml);
|
||||||
let (store, column) = Gtk_tools.combo_model target_combo in
|
if !count = 0 then begin
|
||||||
let row = store#append () in
|
let (store, column) = Gtk_tools.combo_model target_combo in
|
||||||
store#set ~row ~column "sim";
|
let row = store#append () in
|
||||||
let (store, column) = Gtk_tools.combo_model target_combo in
|
store#set ~row ~column "sim";
|
||||||
let row = store#append () in
|
let (store, column) = Gtk_tools.combo_model target_combo in
|
||||||
store#set ~row ~column "ap";
|
let row = store#append () in
|
||||||
end;
|
store#set ~row ~column "ap";
|
||||||
let combo_box = Gtk_tools.combo_widget target_combo in
|
end;
|
||||||
combo_box#set_active 0
|
let combo_box = Gtk_tools.combo_widget target_combo in
|
||||||
|
combo_box#set_active 0
|
||||||
(**
|
(**
|
||||||
Gtk_tools.combo (!strings) target_combo
|
Gtk_tools.combo (!strings) target_combo
|
||||||
**)
|
**)
|
||||||
|
with _ -> ())
|
||||||
|
|
||||||
|
|
||||||
(* Link A/C to airframe & flight_plan labels *)
|
(* Link A/C to airframe & flight_plan labels *)
|
||||||
@@ -332,12 +333,14 @@ let build_handler = fun ~file gui ac_combo (target_combo:Gtk_tools.combo) (log:s
|
|||||||
|
|
||||||
(* Build button *)
|
(* Build button *)
|
||||||
let callback = fun () ->
|
let callback = fun () ->
|
||||||
let ac_name = Gtk_tools.combo_value ac_combo
|
try (
|
||||||
and target = Gtk_tools.combo_value target_combo in
|
let ac_name = Gtk_tools.combo_value ac_combo
|
||||||
let target = if target="sim" then target else sprintf "%s.compile" target in
|
and target = Gtk_tools.combo_value target_combo in
|
||||||
Utils.command ~file gui log ac_name target in
|
let target = if target="sim" then target else sprintf "%s.compile" target in
|
||||||
ignore (gui#button_build#connect#clicked ~callback);
|
Utils.command ~file gui log ac_name target
|
||||||
|
) with _ -> log "ERROR: Nothing to build!!!\n" in
|
||||||
|
ignore (gui#button_build#connect#clicked ~callback);
|
||||||
|
|
||||||
(* Upload button *)
|
(* Upload button *)
|
||||||
let callback = fun () ->
|
let callback = fun () ->
|
||||||
let ac_name = Gtk_tools.combo_value ac_combo
|
let ac_name = Gtk_tools.combo_value ac_combo
|
||||||
|
|||||||
Reference in New Issue
Block a user