mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-01 04:46:51 +08:00
*** empty log message ***
This commit is contained in:
+26
-25
@@ -27,6 +27,7 @@
|
|||||||
<gui>
|
<gui>
|
||||||
<strip
|
<strip
|
||||||
background_color="=axial -90 |bisque|sandybrown;70"
|
background_color="=axial -90 |bisque|sandybrown;70"
|
||||||
|
selected_background_color="=axial -90 |white|yellow;70"
|
||||||
border_color="sienna"
|
border_color="sienna"
|
||||||
normal_font="bleriot-radar-m12c"
|
normal_font="bleriot-radar-m12c"
|
||||||
small_font="bleriot-radar-m8c"
|
small_font="bleriot-radar-m8c"
|
||||||
@@ -34,29 +35,29 @@
|
|||||||
value_color="brown"
|
value_color="brown"
|
||||||
/>
|
/>
|
||||||
<map>
|
<map>
|
||||||
<configuration
|
<configuration
|
||||||
grid="yes"
|
grid="yes"
|
||||||
map="no"
|
map="no"
|
||||||
max_dist_from_home_mask="no"
|
max_dist_from_home_mask="no"
|
||||||
max_dist_from_home_circle="yes"
|
max_dist_from_home_circle="yes"
|
||||||
grid_only_on_map="no"
|
grid_only_on_map="no"
|
||||||
grid_step="100"
|
grid_step="100"
|
||||||
/>
|
/>
|
||||||
<!-- This is the default palette. When there is no map. -->
|
<!-- This is the default palette. When there is no map. -->
|
||||||
<palette
|
<palette
|
||||||
waypoint="orange"
|
waypoint="orange"
|
||||||
secondary_waypoint="gray"
|
secondary_waypoint="gray"
|
||||||
highlighted_waypoint="white"
|
highlighted_waypoint="white"
|
||||||
desired_waypoint="red"
|
desired_waypoint="red"
|
||||||
max_dist_from_home_circle="red3"
|
max_dist_from_home_circle="red3"
|
||||||
carrot_symbol="red"
|
carrot_symbol="red"
|
||||||
carrot_label="darkred"
|
carrot_label="darkred"
|
||||||
aircraft_symbol="green"
|
aircraft_symbol="green"
|
||||||
aircraft_label="darkgreen"
|
aircraft_label="darkgreen"
|
||||||
selected_aircraft="orange"
|
selected_aircraft="orange"
|
||||||
grid="navy"
|
grid="navy"
|
||||||
back_screen="black"
|
back_screen="black"
|
||||||
track="blue"
|
track="blue"
|
||||||
/>
|
/>
|
||||||
</map>
|
</map>
|
||||||
</gui>
|
</gui>
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ use warnings;
|
|||||||
# this sub is the subject constructor method
|
# this sub is the subject constructor method
|
||||||
##############################################################################
|
##############################################################################
|
||||||
sub populate {
|
sub populate {
|
||||||
|
|
||||||
my ($self, $args) = @_;
|
my ($self, $args) = @_;
|
||||||
$self->SUPER::populate($args);
|
$self->SUPER::populate($args);
|
||||||
$self->configspec(-aircraft => [S_NEEDINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_SUPER, undef],
|
$self->configspec(-aircraft => [S_NEEDINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_SUPER, undef],
|
||||||
@@ -50,6 +49,7 @@ sub populate {
|
|||||||
-origin => [S_NEEDINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, undef],
|
-origin => [S_NEEDINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, undef],
|
||||||
-width => [S_NEEDINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, undef],
|
-width => [S_NEEDINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, undef],
|
||||||
-height => [S_NEEDINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, undef],
|
-height => [S_NEEDINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, undef],
|
||||||
|
-selected => [S_NOINIT, S_METHOD, S_RDWR, S_OVRWRT, S_NOPRPG, 0],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,8 @@ sub parse_config {
|
|||||||
print "Parsing gui.xml\n";
|
print "Parsing gui.xml\n";
|
||||||
my $doc = $parser->parsefile(Paparazzi::Environment::get_config("gui.xml"));
|
my $doc = $parser->parsefile(Paparazzi::Environment::get_config("gui.xml"));
|
||||||
my $strip = $doc->getElementsByTagName('strip')->[0];
|
my $strip = $doc->getElementsByTagName('strip')->[0];
|
||||||
foreach my $attr ('normal_font', 'small_font', 'background_color', 'border_color', 'label_color', 'value_color') {
|
foreach my $attr ('selected_background_color', 'background_color', 'normal_font',
|
||||||
|
'small_font', 'border_color', 'label_color', 'value_color') {
|
||||||
$self->{options}->{$attr} = $strip->getAttribute($attr);
|
$self->{options}->{$attr} = $strip->getAttribute($attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,43 +160,20 @@ sub draw {
|
|||||||
## ident of the plane
|
## ident of the plane
|
||||||
$zinc->add('text', $self->{'contentgroup'}, -text => uc($ident), -position=>[10,10], -font => $self->{options}->{normal_font}, -color => "midnightblue");
|
$zinc->add('text', $self->{'contentgroup'}, -text => uc($ident), -position=>[10,10], -font => $self->{options}->{normal_font}, -color => "midnightblue");
|
||||||
|
|
||||||
## AutoPilot label and value
|
my @label_attr = (['AP', 'ap_mode', 70, 10],
|
||||||
$self->add_label("AP", "ap_mode", 70, 10);
|
['RC', 'rc_status', 70, 22],
|
||||||
$self->add_value_text("ap_mode");
|
['GPS', 'gps_mode', 70, 34],
|
||||||
|
['Cal', 'contrast_status', 70, 46],
|
||||||
## RC Status label and value
|
['Ctrst', 'contrast_value', 70, 58],
|
||||||
$self->add_label("RC", "rc_status", 70, 22);
|
['alt:', 'alt', 150, 10],
|
||||||
$self->add_value_text("rc_status");
|
['desired:','target_alt', 150, 22],
|
||||||
|
['speed:', 'speed', 150, 46],
|
||||||
## GPS Fix label and value
|
['climb:', 'climb', 150, 58],
|
||||||
$self->add_label("GPS", "gps_mode", 70, 34);
|
);
|
||||||
$self->add_value_text("gps_mode");
|
foreach my $attr (@label_attr) {
|
||||||
|
$self->add_label($attr->[0], $attr->[1], $attr->[2], $attr->[3]);
|
||||||
## Cal label and value
|
$self->add_value_text($attr->[1]);
|
||||||
$self->add_label("cal", "contrast_status", 70, 46);
|
}
|
||||||
$self->add_value_text("contrast_status");
|
|
||||||
|
|
||||||
## crst label and value
|
|
||||||
$self->add_label("crst", "contrast_value", 70, 58);
|
|
||||||
$self->add_value_text("contrast_value");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## alt label and value
|
|
||||||
$self->add_label("alt:","alt", 150, 10);
|
|
||||||
$self->add_value_text("alt");
|
|
||||||
|
|
||||||
## desired alt label and value
|
|
||||||
$self->add_label("desired:","target_alt", 150, 22);
|
|
||||||
$self->add_value_text("target_alt");
|
|
||||||
|
|
||||||
## speed label and value
|
|
||||||
$self->add_label("speed:", "speed", 150, 46);
|
|
||||||
$self->add_value_text("speed");
|
|
||||||
|
|
||||||
## climb label and value
|
|
||||||
$self->add_label("climb:", "climb", 150, 58);
|
|
||||||
$self->add_value_text("climb");
|
|
||||||
|
|
||||||
$zinc->add('text', $self->{'contentgroup'}, -text => $self->string_of_time(0), -position => [8, 82], -font => $self->{options}->{small_font}, -color => $self->{options}->{label_color}, -tags => [ $self->{prefix}."flight_time_value"] );
|
$zinc->add('text', $self->{'contentgroup'}, -text => $self->string_of_time(0), -position => [8, 82], -font => $self->{options}->{small_font}, -color => $self->{options}->{label_color}, -tags => [ $self->{prefix}."flight_time_value"] );
|
||||||
##
|
##
|
||||||
@@ -326,7 +304,7 @@ sub border_block {
|
|||||||
|
|
||||||
sub set_item {
|
sub set_item {
|
||||||
my ($self, $item_name, $string, $color) = @_;
|
my ($self, $item_name, $string, $color) = @_;
|
||||||
print "in Strip::set_item $item_name $string $color ($self->{prefix})\n";
|
# print "in Strip::set_item $item_name $string $color ($self->{prefix})\n";
|
||||||
my $zinc = $self->get('-zinc');
|
my $zinc = $self->get('-zinc');
|
||||||
my $item = $zinc->find('withtag', $self->{prefix}.$item_name."_value");
|
my $item = $zinc->find('withtag', $self->{prefix}.$item_name."_value");
|
||||||
$zinc->itemconfigure($item, -text => $string, -color => $color);
|
$zinc->itemconfigure($item, -text => $string, -color => $color);
|
||||||
@@ -346,6 +324,7 @@ sub set_block {
|
|||||||
# FIXME: should be deprecated and we should use set_item or something like that
|
# FIXME: should be deprecated and we should use set_item or something like that
|
||||||
sub setBat {
|
sub setBat {
|
||||||
my ($self, $bat) = @_;
|
my ($self, $bat) = @_;
|
||||||
|
print "in Strip::set_bat $bat ($self->{prefix})\n";
|
||||||
$self->{'battery'} = $bat;
|
$self->{'battery'} = $bat;
|
||||||
my $batcolor = '#8080ff';
|
my $batcolor = '#8080ff';
|
||||||
$self->{'zinc'}->remove($self->{'zinc_bat'});
|
$self->{'zinc'}->remove($self->{'zinc_bat'});
|
||||||
@@ -381,10 +360,7 @@ sub attach_to_aircraft {
|
|||||||
|
|
||||||
sub aircraft_config_changed {
|
sub aircraft_config_changed {
|
||||||
my ($self, $aircraft, $event, $new_value) = @_;
|
my ($self, $aircraft, $event, $new_value) = @_;
|
||||||
# parse_config();
|
|
||||||
# parse flight plan
|
|
||||||
# print "in strip aircraft_config_changed $event $new_value\n";
|
# print "in strip aircraft_config_changed $event $new_value\n";
|
||||||
# flight_plan
|
|
||||||
if ($event eq 'flight_plan') {
|
if ($event eq 'flight_plan') {
|
||||||
# $self->border_block() if (defined $new_value) ; # display blocks of flight plan
|
# $self->border_block() if (defined $new_value) ; # display blocks of flight plan
|
||||||
}
|
}
|
||||||
@@ -395,35 +371,22 @@ sub aircraft_config_changed {
|
|||||||
if ($new_value < @{$names} ) {
|
if ($new_value < @{$names} ) {
|
||||||
$self->set_item($event,$self->{modes}->{$event}->{name}[$new_value], $self->{modes}->{$event}->{color}[$new_value]);
|
$self->set_item($event,$self->{modes}->{$event}->{name}[$new_value], $self->{modes}->{$event}->{color}[$new_value]);
|
||||||
}
|
}
|
||||||
else {
|
else { print "in Strip::aircraft_config_changed : wrong value $new_value for $event\n"}
|
||||||
print "in Strip::aircraft_config_changed : wrong value $new_value for $event\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
elsif ($event eq 'flight_time') {
|
elsif ($event eq 'flight_time') {
|
||||||
$self->set_item("flight_time",$self->string_of_time($new_value), $self->{options}->{value_color});
|
$self->set_item("flight_time",$self->string_of_time($new_value), $self->{options}->{value_color});
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($event eq 'bat') {
|
elsif ($event eq 'bat') {
|
||||||
#$self->set_item("ap_mode",$self->{modes}->{ap_mode}->{name}[$new_value]); # display blocks of flight plan
|
$self->set_bat($new_value); # display blocks of flight plan
|
||||||
}
|
}
|
||||||
|
elsif ( $event eq 'speed' or $event eq 'climb' or $event eq 'alt' or $event eq 'target_alt') {
|
||||||
elsif ($event eq 'speed') {
|
my $fmt = { speed => "%2.1fm/s",
|
||||||
$self->set_item("speed",sprintf("%2.1fm/s", $new_value), $self->{options}->{value_color});
|
climb => "%+2.1fm/s",
|
||||||
|
alt => "%4.1fm",
|
||||||
|
target_alt => "%4.1fm"
|
||||||
|
};
|
||||||
|
$self->set_item($event, sprintf($fmt->{$event}, $new_value), $self->{options}->{value_color});
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($event eq 'climb') {
|
|
||||||
$self->set_item("climb",sprintf("%+2.1fm/s", $new_value), $self->{options}->{value_color});
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($event eq 'alt') {
|
|
||||||
$self->set_item("alt",sprintf("%4.1fm", $new_value), $self->{options}->{value_color}); # display blocks of flight plan
|
|
||||||
}
|
|
||||||
|
|
||||||
elsif ($event eq 'target_alt') {
|
|
||||||
$self->set_item("desired_alt",sprintf("%4.1fm", $new_value), $self->{options}->{value_color}); # display blocks of flight plan
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# cur_block
|
# cur_block
|
||||||
elsif ($event eq 'cur_block') {
|
elsif ($event eq 'cur_block') {
|
||||||
$self->set_block($new_value); # display current block of flight plan
|
$self->set_block($new_value); # display current block of flight plan
|
||||||
@@ -435,10 +398,12 @@ sub aircraft_config_changed {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub OnStripPressed {
|
sub selected {
|
||||||
print ("OnStripPressed @_\n");
|
my ($self, $previous_val, $new_val) = @_;
|
||||||
my ($zinc, $self, $ac_id) = @_;
|
my $zinc = $self->get('-zinc');
|
||||||
$self->notify('SELECTED', $ac_id);
|
$zinc->itemconfigure($self->{'frame'},
|
||||||
|
-fillcolor => $new_val ? $self->{options}->{selected_background_color} :
|
||||||
|
$self->{options}->{background_color});
|
||||||
}
|
}
|
||||||
|
|
||||||
## fin de la classe
|
## fin de la classe
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ sub populate {
|
|||||||
-origin => [S_NEEDINIT, S_PASSIVE, S_RDONLY, S_OVRWRT, S_NOPRPG, undef],
|
-origin => [S_NEEDINIT, S_PASSIVE, S_RDONLY, S_OVRWRT, S_NOPRPG, undef],
|
||||||
-width => [S_NEEDINIT, S_PASSIVE, S_RDONLY, S_OVRWRT, S_NOPRPG, undef],
|
-width => [S_NEEDINIT, S_PASSIVE, S_RDONLY, S_OVRWRT, S_NOPRPG, undef],
|
||||||
-height => [S_NEEDINIT, S_PASSIVE, S_RDONLY, S_OVRWRT, S_NOPRPG, undef],
|
-height => [S_NEEDINIT, S_PASSIVE, S_RDONLY, S_OVRWRT, S_NOPRPG, undef],
|
||||||
|
-selected => [S_NOINIT, S_PASSIVE, S_RDWR, S_OVRWRT, S_NOPRPG, undef],
|
||||||
-pubevts => [S_NEEDINIT, S_PASSIVE, S_RDWR, S_APPEND, S_NOPRPG,[]],
|
-pubevts => [S_NEEDINIT, S_PASSIVE, S_RDWR, S_APPEND, S_NOPRPG,[]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -71,6 +72,9 @@ sub add_strip {
|
|||||||
sub OnStripPressed {
|
sub OnStripPressed {
|
||||||
print ("OnStripPressed @_\n");
|
print ("OnStripPressed @_\n");
|
||||||
my ($zinc, $self, $ac_id) = @_;
|
my ($zinc, $self, $ac_id) = @_;
|
||||||
|
$self->{strips}->{$self->get('-selected')}->configure('-selected' => 0) if defined $self->get('-selected');
|
||||||
|
$self->configure('-selected' => $ac_id);
|
||||||
|
$self->{strips}->{$ac_id}->configure('-selected' => 1);
|
||||||
$self->notify('SELECTED', $ac_id);
|
$self->notify('SELECTED', $ac_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user