[gimp-perl] Pass $Gimp::verbose in Gimp::Net mode. Bug 726751



commit 83a9f73f4d0f452996aa104e24b120537f25f174
Author: Ed J <m8r-35s8eo mailinator com>
Date:   Wed Mar 19 22:44:47 2014 +0000

    Pass $Gimp::verbose in Gimp::Net mode. Bug 726751

 Net/Net.pm     |    9 +++++----
 Perl-Server    |    4 +++-
 t/perlplugin.t |   19 ++++++++++---------
 t/run.t        |    2 +-
 4 files changed, 19 insertions(+), 15 deletions(-)
---
diff --git a/Net/Net.pm b/Net/Net.pm
index b19f429..d4bdc12 100644
--- a/Net/Net.pm
+++ b/Net/Net.pm
@@ -136,7 +136,6 @@ sub start_server {
    my $opt = shift;
    $opt = $Gimp::spawn_opts unless $opt;
    print __"trying to start gimp with options \"$opt\"\n" if $Gimp::verbose;
-   print $opt if $Gimp::verbose;
    $server_fh=local *SERVER_FH;
    my $gimp_fh=local *CLIENT_FH;
    socketpair $server_fh,$gimp_fh,AF_UNIX,SOCK_STREAM,PF_UNSPEC
@@ -159,9 +158,11 @@ sub start_server {
          open STDERR,">&1";
       }
       my @args;
-      my $args = &Gimp::RUN_NONINTERACTIVE." ".
-                 (&Gimp::_PS_FLAG_BATCH | &Gimp::_PS_FLAG_QUIET)." ".
-                 fileno($gimp_fh);
+      my $args = join ' ',
+       &Gimp::RUN_NONINTERACTIVE,
+       (&Gimp::_PS_FLAG_BATCH | &Gimp::_PS_FLAG_QUIET),
+       fileno($gimp_fh),
+       int($Gimp::verbose);
       push(@args,"--no-data") if $opt=~s/(^|:)no-?data//;
       push(@args,"-i") unless $opt=~s/(^|:)gui//;
       push(@args,"--verbose") if $Gimp::verbose;
diff --git a/Perl-Server b/Perl-Server
index efc4266..14289c9 100755
--- a/Perl-Server
+++ b/Perl-Server
@@ -161,7 +161,8 @@ sub extension_perl_server {
   my $run_mode=$_[0];
   $ps_flags=$_[1];
   my $extra=$_[2];
-  
+  $Gimp::verbose=$_[3];
+
   if ($run_mode == &Gimp::RUN_NONINTERACTIVE) {
      if ($ps_flags & &Gimp::_PS_FLAG_BATCH) {
         my($fh) = local *FH;
@@ -309,6 +310,7 @@ Gimp::on_query {
                             [&Gimp::PDB_INT32, "run_mode", "Interactive, [non-interactive]"],
                             [&Gimp::PDB_INT32, "flags", "internal flags (must be 0)"],
                             [&Gimp::PDB_INT32, "extra", "multi-purpose ;)"],
+                            [&Gimp::PDB_INT32, "verbose", "Gimp verbose var"],
                            ],[]);
 
    Gimp->install_procedure("gimp_procedural_db_constant_register", "Register a plug-in specific integer 
constant",
diff --git a/t/perlplugin.t b/t/perlplugin.t
index cba266b..f1e43a2 100644
--- a/t/perlplugin.t
+++ b/t/perlplugin.t
@@ -1,6 +1,7 @@
 use strict;
 use Test::More;
 #BEGIN { $Gimp::verbose = 1; }
+#Gimp::set_trace(TRACE_ALL);
 use Gimp qw(:auto);
 use Config;
 
@@ -10,7 +11,8 @@ our $DEBUG = 0;
 require 't/gimpsetup.pl';
 
 my $plugin = "$myplugins/test_perl_filter";
-write_plugin($DEBUG, $plugin, $Config{startperl}.<<'EOF');
+write_plugin($DEBUG, $plugin, $Config{startperl}.
+  "\nBEGIN { \$Gimp::verbose = ".int($Gimp::verbose).'; }'.<<'EOF');
 
 use strict;
 use Gimp qw(:auto __ N_);
@@ -31,31 +33,31 @@ sub boilerplate_params {
 &register(
   "test_dies",
   boilerplate_params('exceptions', '<None>'),
-  [ [PF_STRING, "text", "Input text", 'default' ], ],
+  [ [ PF_STRING, "text", "Input text", 'default' ], ],
   sub { die $_[0]."\n" }
 );
 
 &register(
   "test_pf_adjustment",
   boilerplate_params('returning text', '<None>'),
-  [ [PF_ADJUSTMENT, "input", "input", [100, 2, 1000, 1, 10, 0, 1]  ], ],
-  [ [PF_INT32, "num", "Output number", ], ],
+  [ [ PF_ADJUSTMENT, "input", "input", [100, 2, 1000, 1, 10, 0, 1]  ], ],
+  [ [ PF_INT32, "num", "Output number", ], ],
   sub { @_ }
 );
 
 &register(
   "test_return_text",
   boilerplate_params('returning text', '<None>'),
-  [ [PF_STRING, "text", "Input text", 'default' ], ],
-  [ [PF_STRING, "text", "Output text", ], ],
+  [ [ PF_STRING, "text", "Input text", 'default' ], ],
+  [ [ PF_STRING, "text", "Output text", ], ],
   sub { @_ }
 );
 
 &register(
   "test_return_colour",
   boilerplate_params('returning color', '<None>'),
-  [ [PF_COLOR, "colour", "Input colour", [ 5, 5, 5 ], ], ],
-  [ [PF_COLOR, "colour", "Output colour", ], ],
+  [ [ PF_COLOR, "colour", "Input colour", [ 5, 5, 5 ], ], ],
+  [ [ PF_COLOR, "colour", "Output colour", ], ],
   sub { @_ }
 );
 
@@ -99,7 +101,6 @@ sub boilerplate_params {
 exit main;
 EOF
 
-#Gimp::set_trace(TRACE_ALL);
 Gimp::init("spawn/");
 
 ok((my $i = Gimp::Image->new(10,10,RGB)), 'new image');
diff --git a/t/run.t b/t/run.t
index 483fbbd..4305cff 100644
--- a/t/run.t
+++ b/t/run.t
@@ -1,13 +1,13 @@
 use strict;
 use Test::More tests => 15;
 #BEGIN { $Gimp::verbose = 1; }
+#Gimp::set_trace(TRACE_ALL);
 use Gimp qw(:auto);
 
 our $dir;
 our $DEBUG = 0;
 require 't/gimpsetup.pl';
 
-#Gimp::set_trace(TRACE_ALL);
 Gimp::init("spawn/");
 
 ok((my $i = new Image(10,10,RGB)), 'OO Syntax for new image');


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]