summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-02-04 15:15:05 +0000
committerNorbert Preining <preining@logic.at>2009-02-04 15:15:05 +0000
commit3407ee11008d16a3d0c511ea9ed1af80d18d42db (patch)
treea57172c77627fe1acd0246a6172bed1036a8428a
parente2f4e8fddfbc0345b00c73e96453be41f6d18419 (diff)
go back to minimal wizard which only offers path/letter/go
fix its size to 640x480 git-svn-id: svn://tug.org/texlive/trunk@12076 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/tlpkg/installer/install-menu-wizard.pl492
1 files changed, 44 insertions, 448 deletions
diff --git a/Master/tlpkg/installer/install-menu-wizard.pl b/Master/tlpkg/installer/install-menu-wizard.pl
index 8977f717a7d..68f17b9769d 100644
--- a/Master/tlpkg/installer/install-menu-wizard.pl
+++ b/Master/tlpkg/installer/install-menu-wizard.pl
@@ -5,30 +5,6 @@
# This file is licensed under the GNU General Public License version 2
# or any later version.
#
-# HOW TO ADD A SCREEN:
-# 1) create a sub called something like
-# ask_yourscreen
-# 2) in the beginning of the sub call
-# $current_screen = "yourscreen";
-# 3) set the screen_subs hash
-# $screen_subs{"yourscreen"} = \&ask_yourscreen;
-# 4) call at the end of the screen
-# unpack_buttons();
-# pack_buttons("cancel", "prev", "next"); # if you are in the middle
-# if you want to change something on the $prv, $nxt, $can buttons
-# please do it *between* the two calls, then call
-# pack_buttons("-no-config", "cancel", "prev", "next");
-# Normally the text of $nxt button is set according to the existence of
-# a following screen to either Next or Install, and in the latter case
-# the -command is changed to \&wizard_installation_window
-# Calling with "-no-config" as first argument does inhibit that.
-#
-# The list of screens can be set using the run_menu(@screens), and
-# install_tl does transfer a call to
-# install-tl -gui "wizard:welcome,path,scheme,integration,install"
-# to
-# run_menu("welcome", "path", "scheme", "integration", "install");
-# which in turn will only show these screens.
use strict;
$^W = 1;
@@ -41,9 +17,6 @@ $::menurevision = $1;
our %vars;
our $tlpdb;
our $texlive_release;
-our @collections_std;
-our @collections_lang;
-our @collections_lang_doc;
our $MENU_INSTALL = 0;
our $MENU_ABORT = 1;
@@ -141,45 +114,6 @@ my $dest = $vars{'TEXDIR'};
my $mw;
-my $current_screen;
-
-my @screens = qw/welcome path install/;
-
-my %screen_subs;
-$screen_subs{"welcome"} = \&reset_start;
-$screen_subs{"path"} = \&ask_path;
-$screen_subs{"systems"} = \&ask_systems;
-$screen_subs{"scheme"} = \&ask_scheme;
-$screen_subs{"stdcoll"} = \&ask_stdcoll;
-$screen_subs{"langcoll"} = \&ask_langcoll;
-$screen_subs{"install"} = \&ask_go;
-
-sub next_screen {
- # returns the name of the next screen
- for my $i (0..$#screens) {
- if ($screens[$i] eq $current_screen) {
- return ( $i == $#screens ? undef : $screens[$i+1]);
- }
- }
-}
-sub prev_screen {
- # returns the name of the prev screen
- for my $i (0..$#screens) {
- if ($screens[$i] eq $current_screen) {
- return ($i ? $screens[$i-1] : undef);
- }
- }
-}
-sub run_screen {
- my $what = shift;
- debug("current screen = $current_screen\nwhat = $what\n");
- if (defined($screen_subs{$what})) {
- &{$screen_subs{$what}}();
- } else {
- tlwarn("Undefined screen: $what\n");
- }
-}
-
######################################################################
push @::info_hook,
@@ -299,62 +233,10 @@ if (($::lang ne "en") && ($::lang ne "C")) {
}
}
-sub unpack_buttons {
- $can->packForget;
- $spi->packForget;
- $prv->packForget;
- $spii->packForget;
- $nxt->packForget;
-}
-
-sub pack_buttons {
- my ($first) = @_;
- my $skip_buttonconfig = 0;
- if (defined($first) && ($first eq "-no-config")) {
- $skip_buttonconfig = 1;
- }
- if (member("cancel", @_)) {
- $can->pack(-side => "left");
- $spi->pack(-side => "left");
- }
- if (member("next", @_)) {
- # in case we pack the next button and there is no other screen we assume
- # that this is the install screen
- if (!$skip_buttonconfig) {
- if (!defined(next_screen($current_screen))) {
- $nxt->configure(-text => "Install",
- -command => \&wizard_installation_window);
- } else {
- $nxt->configure(-text => "Next >",
- -command => sub { run_screen(next_screen()); } );
- }
- }
- $nxt->pack(-side => "right");
- $spii->pack(-side => "right");
- }
- if (member("prev", @_)) {
- $prv->pack(-side => "right");
- }
-}
-
-
################# WELCOME SCREEN ######################################
-sub run_menu_wizard {
- my @args = @_;
-
- if (@args) {
- my $allok = 1;
- for my $s (@args) {
- if (!defined($screen_subs{$s})) {
- tlwarn("screen $s not defined, switching to normal wizard mode!");
- $allok = 0;
- last;
- }
- }
- @screens = @args if $allok;
- }
+sub run_menu_wizard {
calc_depends();
$mw = Tk::MainWindow->new;
@@ -368,26 +250,24 @@ sub run_menu_wizard {
$can = $fbuttons->Button(-width => 10, -relief => "ridge", -text => "Cancel",
-command => sub { $return = $MENU_ABORT; $mw->destroy; });
$spi = $fbuttons->Label(-width => 6);
- $nxt = $fbuttons->Button(-width => 10, -relief => "ridge", -text => "Next >",
- -command => sub { run_screen(next_screen()); } );
+ $nxt = $fbuttons->Button(-width => 10, -relief => "ridge", -text => "Next >");
$spii= $fbuttons->Label(-width => 2);
- $prv = $fbuttons->Button(-width => 10, -relief => "ridge", -text => "< Back",
- -command => sub { run_screen(prev_screen()); } );
+ $prv = $fbuttons->Button(-width => 10, -relief => "ridge", -text => "< Back");
reset_start();
- $ftitle->pack(-side => "top", -expand => 1, -fill => "both", -padx => "8m", -pady => "8m");
+ $ftitle->pack(-side => "top", -expand => 1, -fill => "x", -padx => "8m", -pady => "8m");
$fmain->pack(-side => "top", -expand => 1, -fill => "both", -padx => "8m", -pady => "8m");
$fbuttons->pack(-side => "bottom", -expand => 1, -fill => "x", -padx => "8m", -pady => "8m");
+ $mw->geometry("640x480");
Tk::MainLoop();
return($return);
}
$::run_menu = \&run_menu_wizard;
sub reset_start {
- $current_screen = "welcome";
for ($fmain->children) {
$_->destroy;
}
@@ -397,166 +277,26 @@ sub reset_start {
my $inf = $fmain->Label(-text => "Welcome to the installation of TeX Live 2008\nhttp://tug.org/texlive\n\nThis wizard will guide you through the installation.");
$inf->pack(-padx => "3m", -pady => "3m");
- unpack_buttons();
- pack_buttons("cancel", "next");
-
- $fmain->update;
- $mw->update;
-}
-
-############### BINARY SYSTEM SCREEN ############################
-
-sub ask_systems {
- $current_screen = "systems";
- for ($fmain->children) {
- $_->destroy;
- }
- $fmain->update;
- $mw->update;
-
- my $af = $fmain->Frame;
- my $bf = $fmain->Frame;
- my $lab = $af->Label(-text => "Binary system(s):");
- $lab->pack(-side => "left");
- my $val = $af->Label(-textvar => \$vars{'n_systems_selected'});
- $val->pack(-side => "left", -padx => "3m");
- my $but = $af->Button(-text => "Change", -command => \&change_systems, -relief => "ridge", -width => 10);
- $but->pack(-side => "right");
-
- my $inf = $bf->Label(-text => "Selects the list of binary systems to be installed.");
- $inf->pack(-padx => "3m", -pady => "3m");
-
- $af->pack(-expand => 1, -fill => "both");
- $bf->pack(-expand => 1, -fill => "both");
-
- unpack_buttons();
- pack_buttons("cancel", "prev", "next");
-
- $fmain->update;
- $mw->update;
-}
-
-sub change_systems {
- 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(-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(-padx => "2m", -pady => "2m");
- my $f3 = $sw->Frame;
- my $okbutton = $f3->Button(-text => $text{'ok'},
- -command => sub {
- if ($vars{"binary_win32"}) {
- $vars{"collection-wintools"} = 1;
- } else {
- $vars{"collection-wintools"} = 0;
- }
- calc_depends();
- update_numbers();
- $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']);
-}
-
-
-############## SCHEME SCREEN #####################################
-
-sub ask_scheme {
- $current_screen = "scheme";
- for ($fmain->children) {
- $_->destroy;
- }
- $fmain->update;
- $mw->update;
-
- my $af = $fmain->Frame;
- my $bf = $fmain->Frame;
- my $lab = $af->Label(-text => "Currently selected scheme:");
- $lab->pack(-side => "left");
- my $val = $af->Label(-textvar => \$vars{'selected_scheme'});
- $val->pack(-side => "left", -padx => "3m");
- my $but = $af->Button(-text => "Change", -command => \&change_scheme, -relief => "ridge", -width => 10);
- $but->pack(-side => "right");
-
- my $inf = $bf->Label(-text => "A scheme defines what will be installed.\nThe predefined scheme-full installs all of TeX Live (recommended).");
- $inf->pack(-padx => "3m", -pady => "3m");
+ $can->packForget;
+ $spi->packForget;
+ $prv->packForget;
+ $spii->packForget;
+ $nxt->packForget;
- $af->pack(-expand => 1, -fill => "both");
- $bf->pack(-expand => 1, -fill => "both");
+ $nxt->configure(-text => "Next >", -command => \&ask_path );
- unpack_buttons();
- pack_buttons("cancel", "prev", "next");
+ $can->pack(-side => "left");
+ $spi->pack(-side => "left");
+ $nxt->pack(-side => "right");
+ $spii->pack(-side => "right");
$fmain->update;
$mw->update;
}
-sub change_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};
- if ($tlpobj->category eq "Scheme") {
- push @schemes, $pkg;
- $vars{"$pkg"}=($vars{'selected_scheme'} eq $pkg)? 1:0;
- }
- }
- @schemes=sort @schemes;
- my $selected = $vars{'selected_scheme'};
- $sw->Label(-text => $text{'selectscheme'})->pack(-padx => "2m", -pady => "2m");
- my $f2 = $sw->Frame;
- my $f2l = $f2->Frame;
- my $f2r = $f2->Frame;
- my $nrfh = $#schemes / 2;
- my $i = 0;
- foreach my $scheme (@schemes) {
- my $tlpobj = $tlpdb->get_package("$scheme");
- if ($i < $nrfh) {
- $f2l->Radiobutton(-variable => \$selected, -value => $scheme,
- -text => $tlpobj->shortdesc)->pack(-anchor => 'w');
- } else {
- $f2r->Radiobutton(-variable => \$selected, -value => $scheme,
- -text => $tlpobj->shortdesc)->pack(-anchor => 'w');
- }
- $i++;
- }
- $f2l->pack(-side => 'left', -padx => "2m", -pady => "2m");
- $f2r->pack(-side => 'right', -padx => "2m", -pady => "2m");
- $f2->pack;
- my $f3 = $sw->Frame;
- my $okbutton = $f3->Button(-text => $text{'ok'}, -relief => "ridge",
- -command => sub { select_scheme($selected) ; $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m");
- my $cancelbutton = $f3->Button(-text => $text{'cancel'}, -relief => "ridge",
- -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']);
-}
-
-
################## PATH SCREEN ################################
sub ask_path {
- $current_screen = "path";
for ($fmain->children) {
$_->destroy;
}
@@ -596,8 +336,20 @@ sub ask_path {
$cf->pack(-expand => 1, -fill => "both");
$bf->pack(-expand => 1, -fill => "both");
- unpack_buttons();
- pack_buttons("cancel", "prev", "next");
+ $can->packForget;
+ $spi->packForget;
+ $prv->packForget;
+ $spii->packForget;
+ $nxt->packForget;
+
+ $prv->configure(-text => "< Prev", -command => \&reset_start );
+ $nxt->configure(-text => "Next >", -command => \&ask_go );
+
+ $can->pack(-side => "left");
+ $spi->pack(-side => "left");
+ $nxt->pack(-side => "right");
+ $spii->pack(-side => "right");
+ $prv->pack(-side => "right");
$fmain->update;
$mw->update;
@@ -650,178 +402,9 @@ sub callback_change_texdir {
$dest = $vars{'TEXDIR'};
}
-################## STD COLLECTIONS SCREEN ####################
-
-sub ask_stdcoll {
- $current_screen = "stdcoll";
- for ($fmain->children) {
- $_->destroy;
- }
- $fmain->update;
- $mw->update;
-
- my $af = $fmain->Frame;
- my $bf = $fmain->Frame;
- my $lab = $af->Label(-text => "Standard collections:");
- $lab->pack(-side => "left");
- my $but = $af->Button(-text => "Change", -command => \&change_stdcoll, -relief => "ridge", -width => 10);
- $but->pack(-side => "right");
-
- my $inf = $bf->Label(-text => "Select the from all available collections.");
- $inf->pack(-padx => "3m", -pady => "3m");
-
- $af->pack(-expand => 1, -fill => "both");
- $bf->pack(-expand => 1, -fill => "both");
-
- unpack_buttons();
- pack_buttons("cancel", "prev", "next");
-
- $fmain->update;
- $mw->update;
-}
-
-sub change_stdcoll {
- 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(-padx => "2m", -pady => "2m");
- my $halfcol = $#collections_std / 2;
- my $i = 0;
- foreach my $coll (sort @collections_std) {
- my $tlpobj = $tlpdb->get_package("$coll");
- if ($i < $halfcol) {
- $f1->Checkbutton(-variable => \$lvars{$coll}, -text => $tlpobj->shortdesc)->pack(-anchor => 'w');
- } else {
- $f2->Checkbutton(-variable => \$lvars{$coll}, -text => $tlpobj->shortdesc)->pack(-anchor => 'w');
- }
- $i++;
- }
- $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', -padx => "2m", -pady => "2m");
- $fd->Button(-text => $text{'selectnone'},
- -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; wizard_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 wizard_callback_select_collection {
- calc_depends();
- update_numbers();
-}
-
-################# LANGUAGE COLLECTIONS #######################
-
-sub ask_langcoll {
- $current_screen = "langcoll";
- for ($fmain->children) {
- $_->destroy;
- }
- $fmain->update;
- $mw->update;
-
- my $af = $fmain->Frame;
- my $bf = $fmain->Frame;
- my $lab = $af->Label(-text => "Language collections:");
- $lab->pack(-side => "left");
- my $but = $af->Button(-text => "Change", -command => \&change_langcoll, -relief => "ridge", -width => 10);
- $but->pack(-side => "right");
-
- my $inf = $bf->Label(-text => "Select language support and documentation.");
- $inf->pack(-padx => "3m", -pady => "3m");
-
- $af->pack(-expand => 1, -fill => "both");
- $bf->pack(-expand => 1, -fill => "both");
-
- unpack_buttons();
- pack_buttons("cancel", "prev", "next");
-
- $fmain->update;
- $mw->update;
-}
-
-sub change_langcoll {
- my $sw = $mw->Toplevel(-title => $labels{'langcoll'});
- $sw->transient($mw);
- $sw->grab();
- my $f1 = $sw->Frame;
- $f1->pack;
- 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;
- my $f1langLa = $f1langL->Frame; $f1langLa->pack(-side => 'left');
- my $f1langLb = $f1langL->Frame; $f1langLb->pack(-side => 'right');
- my $langh = $#collections_lang / 2;
- my $i = 0;
- my %lvars = %vars;
- foreach my $coll (sort @collections_lang) {
- my $tlpobj = $tlpdb->get_package("$coll");
- if ($i < $langh) {
- $f1langLa->Checkbutton(-variable => \$lvars{$coll}, -text => $tlpobj->shortdesc)->pack(-anchor => 'w');
- } else {
- $f1langLb->Checkbutton(-variable => \$lvars{$coll}, -text => $tlpobj->shortdesc)->pack(-anchor => 'w');
- }
- $i++;
- }
- my $f1langB = $f1lang->Frame;
- $f1langB->pack(-expand => 'x');
- $f1langB->Button(-text => $text{'selectall'},
- -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', -padx => "2m", -pady => "2m");
-
- my $f1docT = $f1doc->Frame; $f1docT->pack;
- my $f1docL = $f1doc->Frame; $f1docL->pack;
- my $f1docLa = $f1docL->Frame; $f1docLa->pack(-side => 'left');
- my $f1docLb = $f1docL->Frame; $f1docLb->pack(-side => 'right');
- my $doch = $#collections_lang_doc / 2;
- $i = 0;
- foreach my $coll (sort @collections_lang_doc) {
- my $tlpobj = $tlpdb->get_package("$coll");
- if ($i < $doch) {
- $f1docLa->Checkbutton(-variable => \$lvars{$coll}, -text => $tlpobj->shortdesc)->pack(-anchor => 'w');
- } else {
- $f1docLb->Checkbutton(-variable => \$lvars{$coll}, -text => $tlpobj->shortdesc)->pack(-anchor => 'w');
- }
- $i++;
- }
- my $f1docB = $f1doc->Frame;
- $f1docB->pack(-expand => 1, -side => "bottom");
- $f1docB->Button(-text => $text{'selectall'},
- -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 => 'left', -padx => "2m", -pady => "2m");
- my $f2 = $sw->Frame; $f2->pack(-expand => 'x');
- my $okbutton = $f2->Button(-text => $text{'ok'},
- -command => sub { %vars = %lvars; wizard_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']);
-}
-
-
################## INSTALL SCREEN #############################
sub ask_go {
- $current_screen = "install";
for ($fmain->children) {
$_->destroy;
}
@@ -831,8 +414,21 @@ sub ask_go {
my $inf = $fmain->Label(-justify => "left", -text => "We are ready to install TeX Live 2008.\nThe following settings will be used.\nIf you want to change something please go back,\notherwise press the \"Install\" button.\n\nDestination folder: $dest\nSelected scheme: $vars{'selected_scheme'}");
$inf->pack(-padx => "3m");
- unpack_buttons();
- pack_buttons("cancel", "prev", "next");
+ $can->packForget;
+ $spi->packForget;
+ $prv->packForget;
+ $spii->packForget;
+ $nxt->packForget;
+
+ $nxt->configure(-text => "Install",
+ -command => \&wizard_installation_window);
+ $prv->configure(-text => "< Prev", -command => \&ask_path);
+
+ $can->pack(-side => "left");
+ $spi->pack(-side => "left");
+ $nxt->pack(-side => "right");
+ $spii->pack(-side => "right");
+ $prv->pack(-side => "right");
$fmain->update;
$mw->update;