From 6364eb309cf7e807752fca228e6a2879cb224b0b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 9 Aug 2002 11:06:35 +0000 Subject: - fix module parameter dialog box handling - enable the cancel on load_module__ask_options --- perl-install/any.pm | 22 ++++++++++++---------- perl-install/harddrake/ui.pm | Bin 9916 -> 9821 bytes perl-install/modparm.pm | 4 ++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/perl-install/any.pm b/perl-install/any.pm index 7ef9effba..2ff0cef2c 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -683,18 +683,20 @@ sub wait_load_module { sub load_module__ask_options { my ($in, $module_descr, $parameters) = @_; - if (@$parameters) { + my @parameters = map { [ @$_[0, 1, 2] ] } @$parameters; + + if (@parameters) { $in->ask_from('', _("You may now provide its options to module %s.\nNote that any address should be entered with the prefix 0x like '0x123'", $module_descr), - [ map { { label => $_->[0], help => $_->[1], val => \$_->[2] } } @$parameters ], + [ map { { label => $_->[0] . ($_->[1] ? " ($_->[1])" : ''), help => $_->[2], val => \$_->[3] } } @parameters ], ) or return; - map { if_($_->[2], "$_->[0]=$_->[2]") } @$parameters; + [ map { if_($_->[3], "$_->[0]=$_->[3]") } @parameters ]; } else { - split ' ', $in->ask_from_entry('', + my $s = $in->ask_from_entry('', _("You may now provide options to module %s. Options are in format ``name=value name2=value2 ...''. -For instance, ``io=0x300 irq=7''", $module_descr), _("Module options:"), - ); +For instance, ``io=0x300 irq=7''", $module_descr), _("Module options:")) or return; + [ split ' ', $s ]; } } @@ -710,7 +712,7 @@ sub load_category__prompt { [ keys %available_modules ]) or return; my $module_descr = $available_modules{$module}; - my @options; + my $options; require modparm; my @parameters = modparm::parameters($module); if (@parameters && $in->ask_from_list_('', @@ -719,13 +721,13 @@ properly, although it normally works fine without. Would you like to specify extra options for it or allow the driver to probe your machine for the information it needs? Occasionally, probing will hang a computer, but it should not cause any damage.", $module_descr), [ __("Autoprobe"), __("Specify options") ], 'Autoprobe') ne 'Autoprobe') { - @options = load_module__ask_options($in, $module_descr, \@parameters); + $options = load_module__ask_options($in, $module_descr, \@parameters) or return; } while (1) { eval { my $w = wait_load_module($in, $category, $module_descr, $module); log::l("user asked for loading module $module (type $category, desc $module_descr)"); - modules::load([ $module, @options ]); + modules::load([ $module, @$options ]); }; return $module_descr if !$@; @@ -733,7 +735,7 @@ not cause any damage.", $module_descr), [ __("Autoprobe"), __("Specify options") _("Loading module %s failed. Do you want to try again with other parameters?", $module_descr), 1) or return; - @options = load_module__ask_options($in, $module_descr, \@parameters); + $options = load_module__ask_options($in, $module_descr, \@parameters) or return; } } diff --git a/perl-install/harddrake/ui.pm b/perl-install/harddrake/ui.pm index 2ccc1b5e3..98c376015 100644 Binary files a/perl-install/harddrake/ui.pm and b/perl-install/harddrake/ui.pm differ diff --git a/perl-install/modparm.pm b/perl-install/modparm.pm index 1e9524572..68ded7851 100644 --- a/perl-install/modparm.pm +++ b/perl-install/modparm.pm @@ -52,8 +52,8 @@ sub parameters { ($is_a_number ? _("%d comma separated numbers", $min) : _("%d comma separated strings", $min)) : $min == 1 ? ($is_a_number ? _("comma separated numbers") : _("comma separated strings")) : - ''; #- to weird and buggy, do not display it - push @parameters, [ $format ? "$name ($format)" : $name, $description, $min, $max, $is_a_number ]; + ''; #- too weird and buggy, do not display it + push @parameters, [ $name, $format, $description, $min, $max, $is_a_number ]; } @parameters; } -- cgit v1.2.1