Skip to content

Commit

Permalink
[papgets] save ac_id in layout if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
gautierhattenberger committed Jan 17, 2015
1 parent 58418be commit 2d6f399
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 7 additions & 2 deletions sw/ground_segment/cockpit/papgets.ml
Expand Up @@ -106,6 +106,11 @@ let locked = fun config ->
[PC.property "locked" (PC.get_property "locked" config)]
with _ -> []

let ac_id_prop = fun config ->
try
[PC.property "ac_id" (PC.get_property "ac_id" config)]
with _ -> []

let create = fun canvas_group papget ->
try
let type_ = ExtXml.attrib papget "type"
Expand Down Expand Up @@ -144,7 +149,7 @@ let create = fun canvas_group papget ->
Hashtbl.iter jump_to_block Live.aircrafts
in
let properties =
[ Papget_common.property "block_name" block_name ] @ locked papget in
[ Papget_common.property "block_name" block_name ] @ locked papget @ ac_id_prop papget in

let p = new Papget.canvas_goto_block_item properties clicked renderer in
let p = (p :> Papget.item) in
Expand Down Expand Up @@ -177,7 +182,7 @@ let create = fun canvas_group papget ->
let properties =
[ Papget_common.property "variable" varname;
Papget_common.float_property "value" value ]
@ locked papget in
@ locked papget @ ac_id_prop papget in
let p = new Papget.canvas_variable_setting_item properties clicked renderer in
let p = (p :> Papget.item) in
register_papget p
Expand Down
6 changes: 4 additions & 2 deletions sw/lib/ocaml/papget.ml
Expand Up @@ -64,7 +64,8 @@ object
method connect = fun cb -> callbacks <- cb :: callbacks
method config = fun () ->
let field = sprintf "%s:%s" msg_name field_descr in
[ PC.property "field" field ]
let ac_id = match sender with None -> [] | Some id -> [PC.property "ac_id" id] in
[ PC.property "field" field ] @ ac_id
method type_ = "message_field"

initializer
Expand Down Expand Up @@ -148,7 +149,8 @@ object
method connect = fun cb -> callbacks <- cb :: callbacks

method config = fun () ->
[ PC.property "expr" (Expr_syntax.sprint expr)]
let ac_id = match sender with None -> [] | Some id -> [PC.property "ac_id" id] in
[ PC.property "expr" (Expr_syntax.sprint expr)] @ ac_id

method type_ = "expression"

Expand Down

0 comments on commit 2d6f399

Please sign in to comment.