[gimp-perl] No more ignore GUI functions - instead trap exceptions; more idiomatic.
- From: Ed J <edj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-perl] No more ignore GUI functions - instead trap exceptions; more idiomatic.
- Date: Sat, 24 May 2014 08:10:39 +0000 (UTC)
commit 31edba1a86e6442ca16374f43375ccbc3fab49c7
Author: Ed J <edj src gnome org>
Date: Sat May 24 09:10:14 2014 +0100
No more ignore GUI functions - instead trap exceptions; more idiomatic.
Gimp/Fu.pm | 3 ---
UI/UI.pm | 2 +-
examples/animate_cells | 4 ++--
examples/billboard | 2 +-
examples/bricks | 2 +-
examples/example-fu | 2 +-
examples/example-net | 2 +-
examples/gimp-make-img-map | 4 ++--
examples/glowing_steel | 2 +-
examples/goldenmean | 2 +-
examples/iland | 2 +-
examples/innerbevel | 2 +-
examples/pixelmap | 2 +-
examples/prep4gif | 2 +-
examples/randomart1 | 2 +-
examples/sethspin | 2 +-
examples/stampify | 2 +-
examples/stamps | 2 +-
examples/yinyang | 2 +-
19 files changed, 20 insertions(+), 23 deletions(-)
---
diff --git a/Gimp/Fu.pm b/Gimp/Fu.pm
index 87d5c54..c607f84 100644
--- a/Gimp/Fu.pm
+++ b/Gimp/Fu.pm
@@ -301,9 +301,6 @@ sub make_ui_closure {
$run_mode = defined($menupath) ? shift : Gimp::RUN_NONINTERACTIVE;
my(@pre,@defaults,@lastvals);
- Gimp::ignore_functions(@Gimp::GUI_FUNCTIONS)
- unless $run_mode == Gimp::RUN_INTERACTIVE;
-
# set default arguments
for (0..$#{$params}) {
next if defined $_[$_];
diff --git a/UI/UI.pm b/UI/UI.pm
index 1a973bf..82edf0a 100644
--- a/UI/UI.pm
+++ b/UI/UI.pm
@@ -515,7 +515,7 @@ my %PF2INFO = (
my $result = $f->run;
if ($result eq 'ok') {
my $i = Gimp->file_load($f->get_filename, $f->get_filename);
- Gimp::Display->new($i);
+ eval { Gimp::Display->new($i); };
$b->reload;
}
$f->destroy;
diff --git a/examples/animate_cells b/examples/animate_cells
index b944a2a..fe57b71 100755
--- a/examples/animate_cells
+++ b/examples/animate_cells
@@ -51,10 +51,10 @@ podregister {
Gimp::Progress->update(1.0);
- Gimp::Display->new($image) if $work_on_copy;
+ eval { Gimp::Display->new($image) if $work_on_copy; };
$image->selection_none;
$image->undo_enable;
- Gimp->displays_flush();
+ ();
};
exit main;
diff --git a/examples/billboard b/examples/billboard
index 7dd4c12..d7a83e7 100755
--- a/examples/billboard
+++ b/examples/billboard
@@ -79,7 +79,7 @@ podregister {
$img = gimp_image_new($maxwide, $maxhigh, RGB);
$tmpimglayer = $img->add_new_layer(0,3,1);
- $img->display_new;
+ eval { Gimp::Display->new($img); };
Gimp::Progress->init("Billboard...",-1);
Gimp::Context->push();
Gimp::Context->set_background($background);
diff --git a/examples/bricks b/examples/bricks
index ed537de..c104967 100755
--- a/examples/bricks
+++ b/examples/bricks
@@ -11,7 +11,7 @@ podregister {
$imageh = abs($imageh); $imageh = 256 if (($imageh < 32) || ($imageh > 4096));
#print "Creating texture $imagew"."x$imageh\n";
my $image = Gimp::Image->new($imagew,$imageh,RGB);
- Gimp::Display->new($image);
+ eval { Gimp::Display->new($image); };
# make background
Gimp::Context->set_pattern($pattern);
my $layerpat = $image->add_new_layer(0,0,0);
diff --git a/examples/example-fu b/examples/example-fu
index 8a8b11f..d9558c1 100755
--- a/examples/example-fu
+++ b/examples/example-fu
@@ -21,7 +21,7 @@ podregister {
Gimp::Context->set_foreground("green");
$img->undo_group_end; # close the undo group
Gimp::Context->pop; # restore original context
- Gimp::Display->new($img);
+ eval { Gimp::Display->new($img); };
$img; # return image, as Gimp::Fu added that to our output parameters
# because no-image-input
};
diff --git a/examples/example-net b/examples/example-net
index d0c4573..31e7c54 100755
--- a/examples/example-net
+++ b/examples/example-net
@@ -12,7 +12,7 @@ Gimp::on_net {
my $img=Gimp::Image->new(600,300,RGB);
my $bg=$img->layer_new(30,20,RGB_IMAGE,"Background",100,NORMAL_MODE);
$img->insert_layer($bg,0,1); # you have to add a layer after you create it
- Gimp::Display->new($img); # Show it (this slows things down)
+ eval { Gimp::Display->new($img); }; # Show it (this slows things down)
# do a bunch of operations just as a speed test, flushing in between
Gimp::Context->push;
for $i (0..255) {
diff --git a/examples/gimp-make-img-map b/examples/gimp-make-img-map
index 1ebc0f1..ad6551b 100755
--- a/examples/gimp-make-img-map
+++ b/examples/gimp-make-img-map
@@ -189,7 +189,7 @@ sub decoration_drop_shadow {
$tiled_img->insert_layer($tiled_background,0,-1);
$tiled_img->insert_layer($tiled_shadow,0,-1);
$tiled_img->insert_layer($tiled_drw,0,-1);
- gimp_display_new($tiled_img);
+ eval { gimp_display_new($tiled_img); };
my $xpos = 0;
@@ -268,7 +268,7 @@ sub decoration_sunken_windows {
$tiled_img->insert_layer($tiled_punch_stencil,0,-1);
$tiled_img->insert_layer($tiled_drw,0,-1);
$tiled_img->insert_layer($tiled_punch_layer,0,-1);
- gimp_display_new($tiled_img);
+ eval { gimp_display_new($tiled_img); };
my $xpos = 0;
diff --git a/examples/glowing_steel b/examples/glowing_steel
index 724c40e..4e55f0f 100755
--- a/examples/glowing_steel
+++ b/examples/glowing_steel
@@ -58,7 +58,7 @@ sub perl_fu_glowing_steel {
gimp_image_set_active_layer($image,$backlayer);
gimp_context_pop();
- gimp_display_new($image);
+ eval { gimp_display_new($image); };
return $image;
}
diff --git a/examples/goldenmean b/examples/goldenmean
index 1a2a3a8..57ca79b 100755
--- a/examples/goldenmean
+++ b/examples/goldenmean
@@ -17,7 +17,7 @@ podregister {
Gimp::Context->push();
$layer->gimp_edit_fill(BACKGROUND_FILL);
Gimp::Context->pop();
- Gimp::Display->new($img);
+ eval { Gimp::Display->new($img); };
return $img;
};
diff --git a/examples/iland b/examples/iland
index 8d100f9..0ba5267 100755
--- a/examples/iland
+++ b/examples/iland
@@ -74,7 +74,7 @@ podregister {
$newdrawable->merge_shadow(1);
$newdrawable->update(0,0,$width, $height);
- Gimp->display_new($newimage);
+ eval { Gimp::Display->new($newimage); };
#Original pic => original state
if ($camerapos==3){
diff --git a/examples/innerbevel b/examples/innerbevel
index ad3cf1e..ad44ad6 100755
--- a/examples/innerbevel
+++ b/examples/innerbevel
@@ -21,7 +21,7 @@ podregister {
# -- step 2 --
$img->add_new_layer(0,TRANSPARENT_FILL);
$img->text_fontname(-1, 10, 10, $text, 0, 1, $fontsize, PIXELS, $font);
- Gimp::Display->new($img); # display the image early
+ eval { Gimp::Display->new($img); }; # display the image early
$layer = $img->merge_visible_layers(EXPAND_AS_NECESSARY);
@pt1 = ($layer->width * 0.5 -1, 0);
@pt2 = ($layer->width * 0.5 +1, $layer->height);
diff --git a/examples/pixelmap b/examples/pixelmap
index bc076b8..774eb18 100755
--- a/examples/pixelmap
+++ b/examples/pixelmap
@@ -87,7 +87,7 @@ register "pixelgen",
$image->delete;
die $error;
};
- Gimp::Display->new($image);
+ eval { Gimp::Display->new($image); };
$image;
};
diff --git a/examples/prep4gif b/examples/prep4gif
index 36a192d..e8347e6 100755
--- a/examples/prep4gif
+++ b/examples/prep4gif
@@ -9,7 +9,7 @@ podregister {
die __"You need at least 2 layers to perform prep4gif\n" if @layers < 2;
# Show the image early - this makes debugging a breeze
- my $newdisplay = Gimp::Display->new($out);
+ eval { Gimp::Display->new($out); };
# Hide the bottom layer, so it doesn't get into the merge visible later.
my $bottomlayer = $layers[$#layers];
gimp_item_set_visible($bottomlayer, 0);
diff --git a/examples/randomart1 b/examples/randomart1
index 1829fb0..48a0338 100755
--- a/examples/randomart1
+++ b/examples/randomart1
@@ -73,7 +73,7 @@ podregister {
$image->selection_none;
$image->undo_enable;
- Gimp::Display->new($image);
+ eval { Gimp::Display->new($image); };
# Gib das neu erzeugte Bild zur�ck, damit es angezeigt wird.
$image;
diff --git a/examples/sethspin b/examples/sethspin
index dc1342e..5bd4d16 100755
--- a/examples/sethspin
+++ b/examples/sethspin
@@ -73,7 +73,7 @@ podregister {
my $maxhigh = max($drawable->height, $destination->height);
my $img = Gimp->image_new($maxwide, $maxhigh, RGB);
my $tmpimglayer = $img->add_new_layer(0,3,1); # have to have a layer before displaying
- $img->display_new;
+ eval { Gimp::Display->new($img); };
$drawable->edit_copy;
my $spinlayer = $tmpimglayer->edit_paste(1);
$spinlayer->floating_sel_to_layer;
diff --git a/examples/stampify b/examples/stampify
index 4d7d092..ed1c0ef 100755
--- a/examples/stampify
+++ b/examples/stampify
@@ -44,7 +44,7 @@ podregister {
my $float = gimp_edit_paste($layer1, 0);
gimp_floating_sel_anchor($float);
# and return command to The Gimp.
- Gimp::Display->new($img2);
+ eval { Gimp::Display->new($img2); };
return $img2;
};
exit main;
diff --git a/examples/stamps b/examples/stamps
index 10545c7..a43d1cd 100755
--- a/examples/stamps
+++ b/examples/stamps
@@ -25,7 +25,7 @@ podregister {
gimp_selection_none($img);
# here, at last, comes the clever part! :-)
$layer->offset(1, 0, -($diameter / 2), -($diameter / 2));
- gimp_display_new($img);
+ eval { gimp_display_new($img); };
return $img;
};
diff --git a/examples/yinyang b/examples/yinyang
index 6a4f6e3..60c07b3 100755
--- a/examples/yinyang
+++ b/examples/yinyang
@@ -9,7 +9,7 @@ my @BUCKET_ARGS = (FG_BUCKET_FILL,NORMAL_MODE,100,0,0,0,0);
podregister {
# Create new image
my $img = Gimp::Image->new($width,$height,0);
- Gimp::Display->new($img);
+ eval { Gimp::Display->new($img); };
my $layer = $img->layer_new($width,$height,1,"Yin/Yang",100,0);
$img->insert_layer($layer,0,0);
$img->set_active_layer($layer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]