[gimp-perl] Allow "bad" inputs if $interact true.
- From: Ed J <edj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-perl] Allow "bad" inputs if $interact true.
- Date: Thu, 8 May 2014 04:01:24 +0000 (UTC)
commit 1f37b4a8e3cf3bf19b7a206325a37896ef724066
Author: Ed J <edj src gnome org>
Date: Thu May 8 04:57:51 2014 +0100
Allow "bad" inputs if $interact true.
Gimp/Fu.pm | 8 ++++++--
UI/UI.pm | 17 +++++++++--------
2 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/Gimp/Fu.pm b/Gimp/Fu.pm
index 903545b..27a244f 100644
--- a/Gimp/Fu.pm
+++ b/Gimp/Fu.pm
@@ -222,8 +222,12 @@ Gimp::on_net {
die __"parameter '$entry->[1]' is not optional\n"
unless defined $args[$i] or $interact>0;
}
- for my $i (0..$#args) { $args[$i] = string2pf($args[$i], $params->[$i]); }
- if ($interact > 0) {
+ $interact = !!$interact;
+ for my $i (0..$#args) {
+ eval { $args[$i] = string2pf($args[$i], $params->[$i]); };
+ die $@ if $@ and not $interact;
+ }
+ if ($interact) {
(my $res,@args)=interact($function,$blurb,$help,$params,$menupath,@args);
return unless $res;
}
diff --git a/UI/UI.pm b/UI/UI.pm
index 57b7520..0900ac5 100644
--- a/UI/UI.pm
+++ b/UI/UI.pm
@@ -498,18 +498,19 @@ my %PF2INFO = (
$a->pack_start ($b,1,1,0);
my $load = Gtk2::Button->new('Browse');
$a->pack_start ($load,1,1,0);
- my $f = new Gtk2::FileSelection sprintf __"Fileselector for %s", $name;
- $f->set_filename ('.');
- $f->cancel_button->signal_connect (clicked => sub { $f->hide });
$load->signal_connect (clicked => sub {
- $f->set_title(sprintf __"Load %s", $name);
- $f->ok_button->signal_connect (clicked => sub {
- $f->hide;
+ my $f = new Gtk2::FileChooserDialog
+ sprintf(__"Load %s", $name),
+ undef, 'open', 'gtk-cancel' => 'cancel', 'gtk-open' => 'ok';
+ $f->show_all;
+ my $result = $f->run;
+ if ($result eq 'ok') {
my $i = Gimp->file_load($f->get_filename, $f->get_filename);
Gimp::Display->new($i);
$b->reload;
- });
- $f->show_all;
+ }
+ $f->destroy;
+ 1;
});
my $c = Gtk2::Button->new("Refresh");
$c->signal_connect("clicked", sub {$b->reload});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]