From 83ca0f2043d7b9490d54b45c8a29e5d88ce025e2 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 7 Jan 2003 22:59:21 +0000 Subject: - remove help (which was at the bottom) - wizard style - focus "Next" button by default (this is rough, some dialog boxes *need* changes before being able to complete (think root password dialog)) --- perl-install/install2.pm | 1 + perl-install/install_gtk.pm | 4 ++-- perl-install/install_steps_gtk.pm | 14 ++++++-------- perl-install/interactive/gtk.pm | 6 +++--- perl-install/ugtk2.pm | 29 ++++++++++++++++++----------- 5 files changed, 30 insertions(+), 24 deletions(-) (limited to 'perl-install') diff --git a/perl-install/install2.pm b/perl-install/install2.pm index a24c0ae99..367a9915a 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -342,6 +342,7 @@ sub main { umask 022; $::isInstall = 1; + $::isWizard = 1; $::no_ugtk_init = 1; $::expert = $::g_auto_install = 0; diff --git a/perl-install/install_gtk.pm b/perl-install/install_gtk.pm index 5f895a77c..0576ba313 100644 --- a/perl-install/install_gtk.pm +++ b/perl-install/install_gtk.pm @@ -71,7 +71,7 @@ widget "*Steps*" style "small-font" gtkset_background(@background1) unless $::live; #- || testing; create_logo_window($o); - create_help_window($o); +# create_help_window($o); } #------------------------------------------------------------------------------ @@ -198,7 +198,7 @@ sub init_sizes() { #- ($::rootheight, $::rootwidth) = (min(768, $::rootheight), min(1024, $::rootwidth)); ($::stepswidth, $::stepsheight) = (145, $::rootheight); ($::logowidth, $::logoheight) = ($::rootwidth - $::stepswidth, 40); - ($::helpwidth, $::helpheight) = ($::rootwidth - $::stepswidth, 104); + ($::helpwidth, $::helpheight) = ($::rootwidth - $::stepswidth, 0); ($::windowwidth, $::windowheight) = ($::rootwidth - $::stepswidth, $::rootheight - $::helpheight - $::logoheight); } diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index b7a4f60e1..c05061bde 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -119,7 +119,7 @@ sub enteringStep { printf "Entering step `%s'\n", $o->{steps}{$step}{text}; $o->SUPER::enteringStep($step); install_gtk::create_steps_window($o); - install_gtk::create_help_window($o); #- HACK: without this it doesn't work (reaches step doPartitionDisks then fail) +# install_gtk::create_help_window($o); #- HACK: without this it doesn't work (reaches step doPartitionDisks then fail) $o->set_help($o->{step}); } sub leavingStep { @@ -204,8 +204,8 @@ sub reallyChooseGroups { translate($path), map { $entry->($_) } grep { $o->{compssUsers}{$_}{path} eq $path } @{$o->{compssUsersSorted}}; }; gtkadd($w->{window}, - gtkpack($w->create_box_with_title(N("Package Group Selection")), - gtkpack_(Gtk2::VBox->new(0, 0), + gtkpack_($w->create_box_with_title(N("Package Group Selection")), + 1, gtkpack_(Gtk2::VBox->new(0, 0), 1, gtkpack_(Gtk2::HBox->new(0, 0), $o->{meta_class} eq 'server' ? ( 1, gtkpack(Gtk2::VBox->new(0, 0), @@ -233,8 +233,8 @@ sub reallyChooseGroups { ), ), )), - '', - gtkadd(Gtk2::HBox->new(0, 0), + 1, '', + 0, gtkadd(Gtk2::HBox->new(0, 0), $w_size, if_($individual, do { my $check = Gtk2::CheckButton->new(N("Individual package selection")); @@ -246,7 +246,6 @@ sub reallyChooseGroups { ), ), ); - $w->{rwindow}->set_default_size($::windowwidth * 0.8, $::windowheight * 0.8); $w->main; 1; } @@ -420,7 +419,6 @@ sub installPackages { $show_advertising = to_bool(@install_any::advertising_images) if !defined $show_advertising; my ($msg, $msg_time_remaining, $msg_time_total) = map { Gtk2::Label->new($_) } '', (N("Estimating")) x 2; my ($progress, $progress_total) = map { Gtk2::ProgressBar->new } (1..2); - $w->{rwindow}->set_resizable(0); #- so that it will auto shrink when passing from adverts to details gtkadd($w->{window}, my $box = Gtk2::VBox->new(0,10)); $box->pack_end(gtkshow(gtkpack(gtkset_size_request(Gtk2::VBox->new(0,5), $::windowwidth * 0.6, -1), $msg, $progress, @@ -601,7 +599,7 @@ sub set_help { join("\n\n", map { s/\n/ /mg; $_ } split("\n\n", translate($help::steps{$_}))) } @l; $o->{current_help} = join("\n\n\n", @l2); - gtktext_insert($o->{help_window_text}, $o->{current_help}); +# gtktext_insert($o->{help_window_text}, $o->{current_help}); 1; } diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm index 7f572914c..33577fe7f 100644 --- a/perl-install/interactive/gtk.pm +++ b/perl-install/interactive/gtk.pm @@ -416,7 +416,7 @@ sub ask_fromW { $w = Gtk2::Button->new(''); $w->signal_connect(clicked => sub { $get_all->(); - if ($::isWizard) { + if ($::isWizard && !$::isInstall) { $mainw->{rwindow}->set_sensitive(0); } else { $mainw->{rwindow}->hide; @@ -425,7 +425,7 @@ sub ask_fromW { $mainw->{retval} = $v; Gtk2->main_quit; } - if ($::isWizard) { + if ($::isWizard && !$::isInstall) { $mainw->{rwindow}->set_sensitive(1); } else { $mainw->{rwindow}->show; @@ -630,7 +630,7 @@ sub ask_fromW { gtkadd($mainw->{window}, $pack); $set_default_size->() if $has_scroll_always; $set_advanced->(0); - (@widgets ? $widgets[0]{focus_w} : $common->{focus_cancel} ? $mainw->{cancel} : $mainw->{ok})->grab_focus(); + ($common->{focus_cancel} ? $mainw->{cancel} : $mainw->{ok})->grab_focus(); my $check = sub { my ($f) = @_; diff --git a/perl-install/ugtk2.pm b/perl-install/ugtk2.pm index c2b91328d..31b91b1c5 100644 --- a/perl-install/ugtk2.pm +++ b/perl-install/ugtk2.pm @@ -312,7 +312,7 @@ sub create_box_with_title { } else { my $a = !$::no_separator; undef $::no_separator; - if ($o->{icon} && !$::isWizard) { + if ($o->{icon} && (!$::isWizard || $::isInstall)) { gtkpack__($box, gtkpack_(Gtk2::HBox->new(0,0), 0, gtkset_size_request(Gtk2::VBox->new(0,0), 15, 0), @@ -434,16 +434,18 @@ sub create_packtable { sub create_okcancel { my ($w, $ok, $cancel, $spread, @other) = @_; - $spread ||= $::isWizard ? "end" : "spread"; - $cancel = $::isWizard ? N("<- Previous") : N("Cancel") if !defined $cancel && !defined $ok; - $ok = $::isWizard ? ($::Wizard_finished ? N("Finish") : N("Next ->")) : N("Ok") if !defined $ok; + my $wizard_buttons = $::isWizard && !$pop_it; + $spread ||= $wizard_buttons ? "end" : "spread"; + $cancel = $wizard_buttons ? N("<- Previous") : N("Cancel") if !defined $cancel && !defined $ok; + $ok = $wizard_buttons ? ($::Wizard_finished ? N("Finish") : N("Next ->")) : N("Ok") if !defined $ok; my $b1 = gtksignal_connect($w->{ok} = Gtk2::Button->new($ok), clicked => $w->{ok_clicked} || sub { $w->{retval} = 1; Gtk2->main_quit }); my $b2 = $cancel && gtksignal_connect($w->{cancel} = Gtk2::Button->new($cancel), clicked => $w->{cancel_clicked} || sub { log::l("default cancel_clicked"); undef $w->{retval}; Gtk2->main_quit }); - $::isWizard and gtksignal_connect($w->{wizcancel} = Gtk2::Button->new(N("Cancel")), clicked => sub { die 'wizcancel' }); - my @l = grep { $_ } $::isWizard ? ($w->{wizcancel}, if_(!$::Wizard_no_previous, $b2), $b1) : ($b1, $b2); - push @l, map { gtksignal_connect(Gtk2::Button->new($_->[0]), clicked => $_->[1]) } @other; + gtksignal_connect($w->{wizcancel} = Gtk2::Button->new(N("Cancel")), clicked => sub { die 'wizcancel' }) if $wizard_buttons && !$::isInstall; + my @l = grep { $_ } $wizard_buttons ? (if_(!$::isInstall, $w->{wizcancel}), + if_(!$::Wizard_no_previous, $b2), $b1) : ($b1, $b2); + unshift @l, map { gtksignal_connect(Gtk2::Button->new($_->[0]), clicked => $_->[1]) } @other; - $_->can_default($::isWizard) foreach @l; + $_->can_default($wizard_buttons) foreach @l; gtkadd(create_hbox($spread), @l); } @@ -722,7 +724,6 @@ sub new { $o->{rwindow} = $o->{window}; if (!defined($::WizardWindow)) { $::WizardWindow = Gtk2::Window->new('toplevel'); - $::WizardWindow->set_position('center_always'); $::WizardWindow->signal_connect(delete_event => sub { die 'wizcancel' }); $::WizardTable = Gtk2::Table->new(2, 2, 0); $::WizardWindow->add($::WizardTable); @@ -752,8 +753,14 @@ sub new { 0, 0, 0, $height*$i, -1, -1, 'none', 0, 0); } }); - $::WizardTable->attach($draw1, 0, 2, 0, 1, 'fill', 'fill', 0, 0); - $::WizardTable->set_size_request(540,420); + if ($::isInstall) { + $::WizardTable->set_size_request($::windowwidth * 0.9, $::windowheight * 0.7); + $::WizardWindow->set_uposition($::stepswidth + $::windowwidth * 0.05, $::logoheight + $::windowheight * 0.15); + } else { + $::WizardWindow->set_position('center_always'); + $::WizardTable->attach($draw1, 0, 2, 0, 1, 'fill', 'fill', 0, 0); + $::WizardTable->set_size_request(540,420); + } $::WizardWindow->show_all; flush(); } -- cgit v1.2.1