Paparazzi Center Exception Handling (tnx to: Serge Le Huitouze)

This commit is contained in:
Christophe De Wagter
2010-12-11 16:20:43 +01:00
parent 6309583e59
commit a5ff37bce4
2 changed files with 46 additions and 41 deletions
+6 -4
View File
@@ -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
(* Save target *)
let xml =
let name = Gtk_tools.combo_value target_combo in
add_entry xml "last target" name in
let xml = (
try
let name = Gtk_tools.combo_value target_combo in
add_entry xml "last target" name
with _ -> xml) in
let xml =
try
(* Save window size *)
+40 -37
View File
@@ -166,40 +166,41 @@ let parse_ac_targets = fun target_combo ac_file ->
store#clear ();
(** Clear ComboBox
**)
let af_xml = Xml.parse_file (Env.paparazzi_src // "conf" // ac_file) in
List.iter (fun tag ->
if ExtXml.tag_is tag "firmware" then begin
begin try
List.iter (fun tar ->
if ExtXml.tag_is tar "target" then begin
begin try
(** Temp Hack: remove these 3 lines once the bottom parts is ready *)
let (store, column) = Gtk_tools.combo_model target_combo in
let row = store#append () in
store#set ~row ~column (Xml.attrib tar "name");
(* this is the way to go *)
strings := (Xml.attrib tar "name") :: !strings;
count := !count + 1
with _ -> () end;
end)
(Xml.children tag)
with _ -> () end;
end)
(Xml.children af_xml);
if !count = 0 then begin
let (store, column) = Gtk_tools.combo_model target_combo in
let row = store#append () in
store#set ~row ~column "sim";
let (store, column) = Gtk_tools.combo_model target_combo in
let row = store#append () in
store#set ~row ~column "ap";
end;
let combo_box = Gtk_tools.combo_widget target_combo in
combo_box#set_active 0
(try
let af_xml = Xml.parse_file (Env.paparazzi_src // "conf" // ac_file) in
List.iter (fun tag ->
if ExtXml.tag_is tag "firmware" then begin
begin try
List.iter (fun tar ->
if ExtXml.tag_is tar "target" then begin
begin try
(** Temp Hack: remove these 3 lines once the bottom parts is ready *)
let (store, column) = Gtk_tools.combo_model target_combo in
let row = store#append () in
store#set ~row ~column (Xml.attrib tar "name");
(* this is the way to go *)
strings := (Xml.attrib tar "name") :: !strings;
count := !count + 1
with _ -> () end;
end)
(Xml.children tag)
with _ -> () end;
end)
(Xml.children af_xml);
if !count = 0 then begin
let (store, column) = Gtk_tools.combo_model target_combo in
let row = store#append () in
store#set ~row ~column "sim";
let (store, column) = Gtk_tools.combo_model target_combo in
let row = store#append () in
store#set ~row ~column "ap";
end;
let combo_box = Gtk_tools.combo_widget target_combo in
combo_box#set_active 0
(**
Gtk_tools.combo (!strings) target_combo
**)
with _ -> ())
(* 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 *)
let callback = fun () ->
let ac_name = Gtk_tools.combo_value ac_combo
and target = Gtk_tools.combo_value target_combo in
let target = if target="sim" then target else sprintf "%s.compile" target in
Utils.command ~file gui log ac_name target in
ignore (gui#button_build#connect#clicked ~callback);
try (
let ac_name = Gtk_tools.combo_value ac_combo
and target = Gtk_tools.combo_value target_combo in
let target = if target="sim" then target else sprintf "%s.compile" target in
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 *)
let callback = fun () ->
let ac_name = Gtk_tools.combo_value ac_combo