diff options
author | Norbert Preining <preining@logic.at> | 2008-08-07 21:35:36 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-08-07 21:35:36 +0000 |
commit | fa3a0a2796b5975e7ca91ec0a572297cd4751fe3 (patch) | |
tree | c7906c88c5e7ef6218f4de0c713e15b827f349a9 | |
parent | 4d766917d2184021cbe4c36a6283e90fc3e091dd (diff) |
GUI installer: revert back to the grid one, and that also brings back the
changes to the system integration menu, since Siep's changes didn't help
in the end. Acked by Siep.
git-svn-id: svn://tug.org/texlive/trunk@10150 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/tlpkg/installer/install-menu-perltk.pl | 228 |
1 files changed, 115 insertions, 113 deletions
diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl index 3d9124e7719..1e19700d6c9 100644 --- a/Master/tlpkg/installer/install-menu-perltk.pl +++ b/Master/tlpkg/installer/install-menu-perltk.pl @@ -1,5 +1,4 @@ #!/usr/bin/env perl -# # $Id$ # # Copyright 2008 Norbert Preining, Reinhard Kotucha @@ -86,7 +85,7 @@ push @::start_install_hook, sub { update_statusbar("Starting installation"); push @::start_postinst_hook, sub { update_statusbar("Starting post-installation Jobs"); Tk::DoOneEvent(Tk::Event::DONT_WAIT); Tk::DoOneEvent(Tk::Event::DONT_WAIT);}; push @::end_install_hook, sub { update_statusbar("Installation finished"); - Tk::DoOneEvent(Tk::Event::DONT_WAIT); Tk::DoOneEvent(Tk::Event::DONT_WAIT); }; + Tk::DoOneEvent(Tk::Event::DONT_WAIT); Tk::DoOneEvent(Tk::Event::DONT_WAIT);}; push @::install_packages_hook, \&update_statusbar; # no idea how many of those are necessary, 1 is definitely not enough! @@ -177,7 +176,7 @@ if (($::lang ne "en") && ($::lang ne "C")) { http://tug.org/texlive/doc.html#install-tl-xlate for information.)\n\n"); } else { # merge the translated strings into the text string - open(LANG,"<$::installerdir/tlpkg/installer/lang/perltk-$::lang"); + open(LANG, "<$::installerdir/tlpkg/installer/lang/perltk-$::lang"); my %trans; while (<LANG>) { chomp; @@ -207,31 +206,12 @@ my $srcyesno = ( $vars{'option_src'} ? $text{'yes'} : $text{'no'} ); my $docyesno = ( $vars{'option_doc'} ? $text{'yes'} : $text{'no'} ); sub run_menu { - # computing $a: - my $a = 0; - foreach my $l (keys %labels) { - my $l = length($labels{$l}); - $a = $l if ($l > $a); - } - # add one char width for spacing - $a++; - my $b = 35; - if (win32()) { - $b = 30; - } - # computation of $c - my $c = 0; - foreach my $l (qw/change toggle/) { - my $l = length($text{$l}); - $c = $l if ($l > $c); - } - $c++; - debug("setting column widths to a=$a, c=$c\n"); calc_depends; $mainwindow = Tk::MainWindow->new; if (!win32()) { - eval 'require Tk::Pane; $subframe = $mainwindow->Scrolled("Frame", -scrollbars => "oe");'; + require Tk::Pane; + $subframe = $mainwindow->Scrolled("Frame", -scrollbars => "oe"); } else { $subframe = $mainwindow->Frame; } @@ -247,112 +227,124 @@ sub run_menu { my $fr = $mw->Frame; $fl->pack(-side => 'left', -expand => 1, -fill => "y"); $fr->pack(-side => 'right'); - $fr->Label(-text => $text{'title'})->pack; - $fr->Label(-text => "------- $text{'basicinfo'} -------")->pack; + + + my $row = 1; + $fr->Label(-text => $text{'title'})->grid(-row => $row, -column => 1, -columnspan => 3); + + $row++; + $fr->Label(-text => "------- $text{'basicinfo'} -------")->grid(-row => $row, -column => 1, -columnspan => 3); + # binary system line if (!win32()) { - my $fbin = $fr->Frame; $fbin->pack; - $fbin->Label(-text => $labels{'binsys'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $bintextbutton = $fbin->Label(-width => $b, -anchor => 'w'); $bintextbutton->pack(-side => 'left'); - $fbin->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_select_binsystems(); })->pack(-side => 'left'); + $row++; + $fr->Label(-text => $labels{'binsys'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $bintextbutton = $fr->Label(-anchor => 'w'); + $bintextbutton->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => $text{'change'}, -command => sub { menu_select_binsystems(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } + $row++; + # scheme line - my $fscheme = $fr->Frame; $fscheme->pack; - $fscheme->Label(-text => $labels{'scheme'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $schemebutton = $fscheme->Label(-width => $b, -anchor => 'w'); $schemebutton->pack(-side => 'left'); - $fscheme->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_select_scheme(); })->pack(-side => 'left'); + $fr->Label(-text => $labels{'scheme'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $schemebutton = $fr->Label(-anchor => 'w'); + $schemebutton->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => $text{'change'}, -command => sub { menu_select_scheme(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + + $row++; # further customization - $fr->Label(-text => "------- $text{'custom'} -------")->pack; + $fr->Label(-text => "------- $text{'custom'} -------")->grid(-row => $row, -column => 1,-columnspan => 3); + $row++; # standard collection line - my $fcoll = $fr->Frame; $fcoll->pack; - $fcoll->Label(-text => $labels{'stdcoll'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $fcoll->Label(-width => $b)->pack(-side => 'left'); - $fcoll->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_select_standard_collections(); })->pack(-side => 'left'); + $fr->Label(-text => $labels{'stdcoll'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Button(-text => $text{'change'}, -command => sub { menu_select_standard_collections(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $row++; # lang collection line - my $flang = $fr->Frame; $flang->pack; - $flang->Label(-text => $labels{'langcoll'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - # $flang->Label(-width => $b)->pack(-side => 'left'); - $langcoltext = $flang->Label(-width => $b, -anchor => 'w')->pack(-side => 'left'); - $flang->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_select_lang_collections(); })->pack(-side => 'left'); + $fr->Label(-text => $labels{'langcoll'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $langcoltext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button( -text => $text{'change'}, -command => sub { menu_select_lang_collections(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $row++; $collectionstext = $fr->Label(); - $collectionstext->pack; + $collectionstext->grid(-row => $row, -column => 1, -columnspan => 3); + $row++; # further customization - $fr->Label(-text => "------- $text{'dirsetup'} -------")->pack; + $fr->Label(-text => "------- $text{'dirsetup'} -------")->grid(-row => $row, -column => 1, -columnspan => 3); + $row++; # texdir line - my $ftexdir = $fr->Frame; $ftexdir->pack(-fill => 'x'); - $ftexdir->Label(-text => $labels{'texdir'}, -anchor => 'w')->pack(-side => 'left'); - $texdirtext = $ftexdir->Label->pack(-side => 'left', -expand => 1, -anchor => 'e', -padx => 20); - $ftexdir->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXDIR"); })->pack(-side => 'left'); + $fr->Label(-text => $labels{'texdir'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $texdirtext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXDIR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $row++; # texmflocal line - my $flocal = $fr->Frame; $flocal->pack(-fill => 'x'); - $flocal->Label(-text => $labels{'localdir'}, -anchor => 'w')->pack(-side => 'left'); - $texmflocaltext = $flocal->Label->pack(-side => 'left', -expand => 1, -anchor => 'e', -padx => 20); - $flocal->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFLOCAL"); })->pack(-side => 'left'); + $fr->Label(-text => $labels{'localdir'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $texmflocaltext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFLOCAL"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $row++; # texmfsysvar line - my $fsys = $fr->Frame; $fsys->pack(-fill => 'x'); - $fsys->Label(-text => $labels{'sysvardir'}, -anchor => 'w')->pack(-side => 'left'); - $texmfsysvartext = $fsys->Label->pack(-side => 'left', -expand => 1, -anchor => 'e', -padx => 20); - $fsys->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFSYSVAR"); })->pack(-side => 'left'); + $fr->Label(-text => $labels{'sysvardir'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $texmfsysvartext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFSYSVAR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $row++; # texmfsysvar line - my $fconfig = $fr->Frame; $fconfig->pack(-fill => 'x'); - $fconfig->Label(-text => $labels{'sysconfigdir'}, -anchor => 'w')->pack(-side => 'left'); - $texmfsysconfigtext = $fconfig->Label->pack(-side => 'left', -expand => 1, -anchor => 'e', -padx => 20); - $fconfig->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFSYSCONFIG"); })->pack(-side => 'left'); + $fr->Label(-text => $labels{'sysconfigdir'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $texmfsysconfigtext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFSYSCONFIG"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $row++; # texmfhome line - my $fhome = $fr->Frame; $fhome->pack(-fill => 'x'); - $fhome->Label(-text => $labels{'texmfhome'}, -anchor => 'w')->pack(-side => 'left'); - $texmfhometext = $fhome->Label->pack(-side => 'left', -expand => 1, -anchor => 'e', -padx => 20); - $fhome->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFHOME"); })->pack(-side => 'left'); - + $fr->Label(-text => $labels{'texmfhome'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $texmfhometext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => $text{'change'}, -command => sub { menu_edit_vars_value("TEXMFHOME"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $row++; # Options - $fr->Label(-text => "------- $text{'options'} -------")->pack; + $fr->Label(-text => "------- $text{'options'} -------")->grid(-row => $row, -column => 1, -columnspan => 3); + $row++; # optpaper - my $fletter = $fr->Frame; $fletter->pack; - $fletter->Label(-text => $labels{'optletter'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $fletter->Label(-width => $b, -anchor => 'w', -textvariable => \$letteryesno)->pack(-side => 'left'); - $fletter->Button(-width => $c, -text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_letter'}, \$letteryesno); })->pack(-side => 'left'); + $fr->Label(-text => $labels{'optletter'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$letteryesno)->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_letter'}, \$letteryesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); - my $ffmt = $fr->Frame; $ffmt->pack; - $ffmt->Label(-text => $labels{'optfmt'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $ffmt->Label(-width => $b, -anchor => 'w', -textvariable => \$fmtyesno)->pack(-side => 'left'); - $ffmt->Button(-width => $c, -text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_fmt'}, \$fmtyesno); })->pack(-side => 'left'); + $row++; + $fr->Label(-text => $labels{'optfmt'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$fmtyesno)->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_fmt'}, \$fmtyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); if ($vars{'doc_splitting_supported'}) { - my $fdoc = $fr->Frame; $fdoc->pack; - $fdoc->Label(-text => $labels{'optdoc'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $fdoc->Label(-width => $b, -anchor => 'w', -textvariable => \$docyesno)->pack(-side => 'left'); - $fdoc->Button(-width => $c, -text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_doc'}, \$docyesno); })->pack(-side => 'left'); + $row++; + $fr->Label(-text => $labels{'optdoc'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$docyesno)->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_doc'}, \$docyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } if ($vars{'src_splitting_supported'}) { - my $fsrc = $fr->Frame; $fsrc->pack; - $fsrc->Label(-text => $labels{'optsrc'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $fsrc->Label(-width => $b, -anchor => 'w', -textvariable => \$srcyesno)->pack(-side => 'left'); - $fsrc->Button(-width => $c, -text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_src'}, \$srcyesno); })->pack(-side => 'left'); + $row++; + $fr->Label(-text => $labels{'optsrc'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$srcyesno)->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => $text{'toggle'}, -command => sub { toggle_and_set_opt_variable(\$vars{'option_src'}, \$srcyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } if (unix()) { + $row++; # Symlinks - $fr->Label(-text => "------- $text{'sysint'} -------")->pack; + $fr->Label(-text => "------- $text{'sysint'} -------")->grid(-row => $row, -column => 1,-columnspan => 3); - my $fsym = $fr->Frame; $fsym->pack; - $fsym->Label(-text => $labels{'symlink'}, -width => $a, -anchor => 'w')->pack(-side => 'left'); - $symlinktext = $fsym->Label(-width => $b, -anchor => 'w')->pack(-side => 'left'); - $fsym->Button(-width => $c, -text => $text{'change'}, -command => sub { menu_select_symlink(); })->pack(-side => 'left') + $row++; + $fr->Label(-text => $labels{'symlink'}, -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $symlinktext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => $text{'change'}, -command => sub { menu_select_symlink(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } # install/cancel buttons @@ -380,9 +372,11 @@ sub run_menu { -command => sub { $return = $MENU_ABORT; $mainwindow->destroy } )->pack(-side => 'right'); $mw->bind('<Escape>', [ $quitbutton, 'Invoke' ]); - $f3->pack(-expand => 'x'); + $row++; + $f3->grid(-row => $row, -column => 1, -columnspan => 3); $::statusbar = $fr->Label(-text => $text{'status'}); - $::statusbar->pack; + $row++; + $::statusbar->grid(-row => $row, -column => 1, -columnspan => 3); menu_update_texts(); $mw->pack(-expand => 1, -fill => "both"); $mw->update; @@ -394,11 +388,9 @@ sub run_menu { $rh = $maxheight; $rw += 20; # for the scrollbar } - eval '$subframe->configure(-height => $rh, -width=>$rw)' if - (!win32() or win_version()>=5.1); + $subframe->configure(-height => $rh, -width=>$rw); $subframe->pack(-expand => 1, -fill => "both"); - eval '$mainwindow->configure(-height => $rh, -width=>$rw)' if - (!win32() or win_version()>=5.1); + $mainwindow->configure(-height => $rh, -width=>$rw); #$mw->pack(-expand => 1, -fill => "both"); Tk::MainLoop(); return($return); @@ -573,10 +565,26 @@ sub menu_select_lang_collections { sub menu_select_symlink { our ($lbin,$lman,$linfo); our $osym = $vars{'option_symlinks'}; + our ($binlab,$binb,$manlab,$manb,$infolab,$infob); sub set_unset_buttons { $lbin = ($osym ? $vars{'sys_bin'} : ''); $linfo = ($osym ? $vars{'sys_info'} : ''); $lman = ($osym ? $vars{'sys_man'} : ''); + if ($osym) { + $binlab->grid(-row => 2, -column => 1, -sticky => "w", -padx => "2m"); + $binb->grid(-row => 2, -column => 2, -sticky => "ew", -padx => "2m"); + $manlab->grid(-row => 3, -column => 1, -sticky => "w", -padx => "2m"); + $manb->grid(-row => 3, -column => 2, -sticky => "ew", -padx => "2m"); + $infolab->grid(-row => 4, -column => 1, -sticky => "w", -padx => "2m"); + $infob->grid(-row => 4, -column => 2, -sticky => "ew", -padx => "2m"); + } else { + $infob->gridForget; + $infolab->gridForget; + $manb->gridForget; + $manlab->gridForget; + $binb->gridForget; + $binlab->gridForget; + } } sub return_callback { if ($osym) { @@ -593,29 +601,23 @@ sub menu_select_symlink { $vars{'option_symlinks'} = $osym; menu_update_texts(); } - set_unset_buttons(); my $sw = $mainwindow->Toplevel(-title => $labels{'symlink'}); $sw->transient($mainwindow); $sw->grab(); $sw->Checkbutton(-variable => \$osym, -text => $text{'createsym'}, - -command => sub { set_unset_buttons(); } )->pack; - my $fbin = $sw->Frame; - $fbin->Label(-text => $text{'binto'})->pack(-side => 'left'); - my $binb = $fbin->Entry(-textvariable => \$lbin, -width => 30); - $binb->pack(-side => 'right'); - $fbin->pack(-expand => 'x'); - my $fman = $sw->Frame; - $fman->Label(-text => $text{'manto'})->pack(-side => 'left'); - my $manb = $fman->Entry(-textvariable => \$lman, -width => 30); - $manb->pack(-side => 'right'); - $fman->pack(-expand => 'x'); - my $finfo = $sw->Frame; - $finfo->Label(-text => $text{'infoto'})->pack(-side => 'left'); - my $infob = $finfo->Entry(-textvariable => \$linfo, -width => 30); - $infob->pack(-side => 'right'); - $finfo->pack(-expand => 'x'); - my $f2 = $sw->Frame; $f2->pack(-expand => 'x'); + -command => sub { set_unset_buttons(); } )->grid(-column => 1, + -row => 1, + -columnspan => 2, + -padx => "2m"); + $binlab = $sw->Label(-text => $text{'binto'}); + $binb = $sw->Entry(-textvariable => \$lbin); + $manlab = $sw->Label(-text => $text{'manto'}); + $manb = $sw->Entry(-textvariable => \$lman); + $infolab = $sw->Label(-text => $text{'infoto'}); + $infob = $sw->Entry(-textvariable => \$linfo); + set_unset_buttons(); + my $f2 = $sw->Frame; $f2->grid(-column => 1, -columnspan => 2, -row => 5); my $okbutton = $f2->Button(-text => $text{'ok'}, -command => sub { return_callback(); $sw->destroy })->pack(-side => 'left'); my $cancelbutton = $f2->Button(-text => $text{'cancel'}, |