diff options
author | Norbert Preining <preining@logic.at> | 2008-07-06 20:13:49 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-07-06 20:13:49 +0000 |
commit | 56336e2f3405142911c5afe9c657d6903bf80d6a (patch) | |
tree | b52a18c42fd21eb7497a3e5bf96e49c10fffbae3 /Master/tlpkg | |
parent | 04a0c6e37fd510f7f6d45d7baffdd3b9922d05a5 (diff) |
GUI installer:
- add bindings for OK and Escape in Dialogs
- layout several dialogs in a better way
- add default ESC for quitting the installer
git-svn-id: svn://tug.org/texlive/trunk@9305 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rw-r--r-- | Master/tlpkg/installer/install-menu-perltk.pl | 122 |
1 files changed, 73 insertions, 49 deletions
diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl index 7fb71f1c07a..c78b4631758 100644 --- a/Master/tlpkg/installer/install-menu-perltk.pl +++ b/Master/tlpkg/installer/install-menu-perltk.pl @@ -354,10 +354,11 @@ sub run_menu { $fr->Dialog(-text => $text{'finished'}, -buttons => [ $text{'finbut'} ])->Show; $mw->destroy }, )->pack(-side => 'left'); - $f3->Button( + my $quitbutton = $f3->Button( -text => $text{'quit'}, -command => sub { $return = $MENU_ABORT; $mw->destroy } )->pack(-side => 'right'); + $mw->bind('<Escape>', [ $quitbutton, 'Invoke' ]); $f3->pack(-expand => 'x'); $::statusbar = $fr->Label(-text => $text{'status'}); $::statusbar->pack; @@ -369,20 +370,27 @@ sub run_menu { sub menu_edit_vars_value { my $key = shift; my $sw = $mw->Toplevel(-title => $text{'changevar'}); + $sw->transient($mw); + $sw->grab(); my $val = $vars{$key}; - $sw->Label(-text => $text{'enterpath'} . " $key:" . $text{'hinthome'})->pack; + $sw->Label(-text => $text{'enterpath'} . " $key:" . $text{'hinthome'})->pack(-padx => "2m", -pady => "2m"); my $entry = $sw->Entry(-textvariable => $val, -width => 60); - $entry->pack; + $entry->pack(-padx => "2m", -pady => "2m"); my $f = $sw->Frame; - $f->Button(-text => $text{'ok'}, - -command => sub { $val = $entry->get; callback_edit_directories($key,$val) ; $sw->destroy })->pack(-side => 'left'); - $f->Button(-text => $text{'cancel'}, - -command => sub { $sw->destroy })->pack(-side => 'right'); + my $okbutton = $f->Button(-text => $text{'ok'}, + -command => sub { $val = $entry->get; callback_edit_directories($key,$val) ; $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m"); + my $cancelbutton = $f->Button(-text => $text{'cancel'}, + -command => sub { $sw->destroy })->pack(-side => 'right', -padx => "2m", -pady => "2m"); $f->pack(-expand => 'x'); + # bindings + $sw->bind('<Return>' => [ $okbutton, 'Invoke']); + $sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']); } sub menu_select_scheme { my $sw = $mw->Toplevel(-title => $labels{'scheme'}); + $sw->transient($mw); + $sw->grab(); my @schemes; foreach my $pkg ($tlpdb->list_packages) { my $tlpobj = $tlpdb->{'tlps'}{$pkg}; @@ -393,7 +401,7 @@ sub menu_select_scheme { } @schemes=sort @schemes; my $selected = $vars{'selected_scheme'}; - $sw->Label(-text => $text{'selectscheme'})->pack; + $sw->Label(-text => $text{'selectscheme'})->pack(-padx => "2m", -pady => "2m"); my $f2 = $sw->Frame; my $f2l = $f2->Frame; my $f2r = $f2->Frame; @@ -410,26 +418,30 @@ sub menu_select_scheme { } $i++; } - $f2l->pack(-side => 'left'); - $f2r->pack(-side => 'right'); + $f2l->pack(-side => 'left', -padx => "2m", -pady => "2m"); + $f2r->pack(-side => 'right', -padx => "2m", -pady => "2m"); $f2->pack; my $f3 = $sw->Frame; - $f3->Button(-text => $text{'ok'}, - -command => sub { callback_select_scheme($selected) ; $sw->destroy })->pack(-side => 'left'); - $f3->Button(-text => $text{'cancel'}, - -command => sub { $sw->destroy })->pack(-side => 'right'); + my $okbutton = $f3->Button(-text => $text{'ok'}, + -command => sub { callback_select_scheme($selected) ; $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m"); + my $cancelbutton = $f3->Button(-text => $text{'cancel'}, + -command => sub { $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m"); $f3->pack(-expand => 'x'); + $sw->bind('<Return>' => [ $okbutton, 'Invoke']); + $sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']); } sub menu_select_standard_collections { my $sw = $mw->Toplevel(-title => $labels{'stdcoll'}); + $sw->transient($mw); + $sw->grab(); my $fb = $sw->Frame; my $fc = $sw->Frame; my $fd = $sw->Frame; my $f1 = $fb->Frame; my $f2 = $fb->Frame; my %lvars = %vars; - $sw->Label(-text => $text{'selectstdcol'})->pack; + $sw->Label(-text => $text{'selectstdcol'})->pack(-padx => "2m", -pady => "2m"); my $halfcol = $#collections_std / 2; my $i = 0; foreach my $coll (sort @collections_std) { @@ -441,32 +453,35 @@ sub menu_select_standard_collections { } $i++; } - $f1->pack(-side => 'left'); - $f2->pack(-side => 'right'); - $fb->pack; - $fd->pack(-expand => 'x'); + $f1->pack(-side => 'left', -padx => "2m", -pady => "2m"); + $f2->pack(-side => 'right', -padx => "2m", -pady => "2m"); + $fb->pack(-padx => "2m", -pady => "2m"); + $fd->pack(); $fd->Button(-text => $text{'selectall'}, - -command => sub { select_collections(\%lvars, @collections_std) })->pack(-side => 'left'); + -command => sub { select_collections(\%lvars, @collections_std) })->pack(-side => 'left', -padx => "2m", -pady => "2m"); $fd->Button(-text => $text{'selectnone'}, - -command => sub { deselect_collections(\%lvars, @collections_std) })->pack(-side => 'right'); - $fc->pack(-expand => 'x'); - $fc->Button(-text => $text{'ok'}, - -command => sub { %vars = %lvars; callback_select_collection() ; $sw->destroy })->pack(-side => 'left'); - $fc->Button(-text => $text{'cancel'}, - -command => sub { $sw->destroy })->pack(-side => 'right'); + -command => sub { deselect_collections(\%lvars, @collections_std) })->pack(-side => 'right', -padx => "2m", -pady => "2m"); + $fc->pack(-expand => 'x', -padx => "2m", -pady => "2m"); + my $okbutton = $fc->Button(-text => $text{'ok'}, + -command => sub { %vars = %lvars; callback_select_collection() ; $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m"); + my $cancelbutton = $fc->Button(-text => $text{'cancel'}, + -command => sub { $sw->destroy })->pack(-side => 'right', -padx => "2m", -pady => "2m"); + $sw->bind('<Return>' => [ $okbutton, 'Invoke']); + $sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']); } sub menu_select_lang_collections { my $sw = $mw->Toplevel(-title => $labels{'langcoll'}); + $sw->transient($mw); + $sw->grab(); my $f1 = $sw->Frame; $f1->pack; - my $f1lang = $f1->Frame; - my $f1doc = $f1->Frame; - $f1lang->pack(-side => 'left'); - $f1doc->pack(-side => 'right'); + my $f1lang = $f1->Labelframe(-text => $text{'selectlang'}); + my $f1doc = $f1->Labelframe(-text => $text{'selectdoc'}); + $f1lang->pack(-side => 'left', -padx => "2m", -pady => "2m", -ipadx => "2m", -ipady => "2m"); + $f1doc->pack(-side => 'right', -padx => "2m", -pady => "2m", -ipadx => "2m", -ipady => "2m", -expand => 1, -fill => "y"); my $f1langT = $f1lang->Frame; $f1langT->pack; my $f1langL = $f1lang->Frame; $f1langL->pack; - $f1langT->Label(-text => $text{'selectlang'})->pack; my $f1langLa = $f1langL->Frame; $f1langLa->pack(-side => 'left'); my $f1langLb = $f1langL->Frame; $f1langLb->pack(-side => 'right'); my $langh = $#collections_lang / 2; @@ -484,13 +499,12 @@ sub menu_select_lang_collections { my $f1langB = $f1lang->Frame; $f1langB->pack(-expand => 'x'); $f1langB->Button(-text => $text{'selectall'}, - -command => sub { select_collections(\%lvars, @collections_lang) })->pack(-side => 'left'); + -command => sub { select_collections(\%lvars, @collections_lang) })->pack(-side => 'left', -padx => "2m", -pady => "2m"); $f1langB->Button(-text => $text{'selectnone'}, - -command => sub { deselect_collections(\%lvars, @collections_lang) })->pack(-side => 'right'); + -command => sub { deselect_collections(\%lvars, @collections_lang) })->pack(-side => 'right', -padx => "2m", -pady => "2m"); my $f1docT = $f1doc->Frame; $f1docT->pack; my $f1docL = $f1doc->Frame; $f1docL->pack; - $f1docT->Label(-text => $text{'selectdoc'})->pack; my $f1docLa = $f1docL->Frame; $f1docLa->pack(-side => 'left'); my $f1docLb = $f1docL->Frame; $f1docLb->pack(-side => 'right'); my $doch = $#collections_lang_doc / 2; @@ -505,16 +519,18 @@ sub menu_select_lang_collections { $i++; } my $f1docB = $f1doc->Frame; - $f1docB->pack(-expand => 'x'); + $f1docB->pack(-expand => 1, -side => "bottom"); $f1docB->Button(-text => $text{'selectall'}, - -command => sub { select_collections(\%lvars, @collections_lang_doc) })->pack(-side => 'left'); + -command => sub { select_collections(\%lvars, @collections_lang_doc) })->pack(-side => 'left', -padx => "2m", -pady => "2m"); $f1docB->Button(-text => $text{'selectnone'}, - -command => sub { deselect_collections(\%lvars, @collections_lang_doc) })->pack(-side => 'right'); + -command => sub { deselect_collections(\%lvars, @collections_lang_doc) })->pack(-side => 'left', -padx => "2m", -pady => "2m"); my $f2 = $sw->Frame; $f2->pack(-expand => 'x'); - $f2->Button(-text => $text{'ok'}, - -command => sub { %vars = %lvars; callback_select_collection() ; $sw->destroy })->pack(-side => 'left'); - $f2->Button(-text => $text{'cancel'}, - -command => sub { $sw->destroy })->pack(-side => 'right'); + my $okbutton = $f2->Button(-text => $text{'ok'}, + -command => sub { %vars = %lvars; callback_select_collection() ; $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m"); + my $cancelbutton = $f2->Button(-text => $text{'cancel'}, + -command => sub { $sw->destroy })->pack(-side => 'right', -padx => "2m", -pady => "2m"); + $sw->bind('<Return>' => [ $okbutton, 'Invoke']); + $sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']); } sub menu_select_symlink { @@ -542,6 +558,8 @@ sub menu_select_symlink { } set_unset_buttons(); my $sw = $mw->Toplevel(-title => $labels{'symlink'}); + $sw->transient($mw); + $sw->grab(); $sw->Checkbutton(-variable => \$osym, -text => $text{'createsym'}, -command => sub { set_unset_buttons(); } )->pack; @@ -561,36 +579,42 @@ sub menu_select_symlink { $infob->pack(-side => 'right'); $finfo->pack(-expand => 'x'); my $f2 = $sw->Frame; $f2->pack(-expand => 'x'); - $f2->Button(-text => $text{'ok'}, + my $okbutton = $f2->Button(-text => $text{'ok'}, -command => sub { return_callback(); $sw->destroy })->pack(-side => 'left'); - $f2->Button(-text => $text{'cancel'}, + my $cancelbutton = $f2->Button(-text => $text{'cancel'}, -command => sub { $sw->destroy })->pack(-side => 'right'); + $sw->bind('<Return>' => [ $okbutton, 'Invoke']); + $sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']); } sub menu_select_binsystems { our $f2r; our $f2; my $sw = $mw->Toplevel(-title => $labels{'binsys'}); + $sw->transient($mw); + $sw->grab(); my @diskarchs = (); foreach my $key (keys %vars) { if ($key=~/binary_(.*)/) { push @diskarchs, $1; } } - $sw->Label(-text => $text{'selectsys'})->pack; + $sw->Label(-text => $text{'selectsys'})->pack(-padx => "2m", -pady => "2m"); $f2 = $sw->Frame; my $f2l = $f2->Frame; foreach my $sys (sort @diskarchs) { $f2l->Checkbutton(-variable => \$vars{"binary_$sys"}, -text => platform_desc($sys))->pack(-anchor => 'w'); } $f2l->pack(-side => 'left'); - $f2->pack; + $f2->pack(-padx => "2m", -pady => "2m"); my $f3 = $sw->Frame; - $f3->Button(-text => $text{'ok'}, - -command => sub { callback_select_systems() ; $sw->destroy })->pack(-side => 'left'); - $f3->Button(-text => $text{'cancel'}, - -command => sub { $sw->destroy })->pack(-side => 'right'); + my $okbutton = $f3->Button(-text => $text{'ok'}, + -command => sub { callback_select_systems() ; $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m"); + my $cancelbutton = $f3->Button(-text => $text{'cancel'}, + -command => sub { $sw->destroy })->pack(-side => 'right', -padx => "2m", -pady => "2m"); $f3->pack(-expand => 'x'); + $sw->bind('<Return>' => [ $okbutton, 'Invoke']); + $sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']); } |