Skip to content

Commit

Permalink
handle Gnuplot 6 warnings about Qt plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Sep 18, 2024
1 parent 34defd2 commit 5e2c880
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- handle Gnuplot 6 warnings about Qt plugins

2.027 2024-07-31
- add "resample" curve option for with=>'fits'
- with=>'fits' error if no FITS header
Expand Down
7 changes: 5 additions & 2 deletions lib/PDL/Graphics/Gnuplot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7470,6 +7470,7 @@ sub _printGnuplotPipe
# are explicitly stripped out
our $cp_serial = 0;

my $qt_re = qr/^qt.qpa.plugin: Could not find the Qt platform plugin.*/m;
sub _checkpoint {
my $this = shift;
my $suffix = shift || "main";
Expand Down Expand Up @@ -7602,16 +7603,18 @@ EOM
# that some warnings come with a line specifier and others don't.

WARN: while( $fromerr =~ m/^(\s*(line \d+\:\s*)?[wW]arning\:.*)$/m or
$fromerr =~ m/$qt_re/ or
$fromerr =~ m/^Populating font family aliases took/m # CED - Quicktime on MacOS Catalina throws a warning marked as an error. Stupid.
) {
if($2){
if ($2) {
# it's a warning with a line specifier. Break off two more lines before it.
last WARN unless($fromerr =~ s/^((gnu|multi)plot\>.*\n\s*\^\s*\n\s*(line \d+\:\s*)?[wW]arning\:.*(\n|$))//m);
my $a = $1;
$a =~ s/^\s*line \d+\:/Gnuplot:/m;
carp $a if($printwarnings);
} else {
last WARN unless($fromerr =~ s/^(\s*(line \d+\:\s*)?[wW](arning\:.*(\n|$)))//m);
$fromerr =~ s/$qt_re//;
last WARN unless $fromerr =~ s/^(\s*(line \d+\:\s*)?[wW](arning\:.*(\n|$)))//m;
carp "Gnuplot w$3\n" if($printwarnings);
}

Expand Down
8 changes: 5 additions & 3 deletions t/plot.t
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,11 @@ SKIP: {
skip "Skipping interactive tests - set env. variable GNUPLOT_INTERACTIVE to enable.",29;
}

eval { $w = gpwin('wxt') };
eval { $w = gpwin('x11') } if $@;
is($@, '', "created a wxt or x11 plot object");
for (qw(qt wxt x11)) {
eval { $w = gpwin($_) };
last if !$@;
}
is($@, '', "created a plot object");

isa_ok $PDL::Graphics::Gnuplot::termTab->{$w->{terminal}}, 'HASH', "Terminal is a known type";

Expand Down

0 comments on commit 5e2c880

Please sign in to comment.