From 5c8afec4982eb3f53cc05cc59a340851ad9be370 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 4 Feb 2009 23:53:18 +0000 Subject: make wizard and normal gui switch switch able git-svn-id: svn://tug.org/texlive/trunk@12082 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/installer/install-menu-perltk.pl | 56 +++++++++++++++++---------- Master/tlpkg/installer/install-menu-wizard.pl | 55 ++++++++++++++++---------- 2 files changed, 70 insertions(+), 41 deletions(-) (limited to 'Master') diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl index ffe2cfbf699..f61e2795186 100644 --- a/Master/tlpkg/installer/install-menu-perltk.pl +++ b/Master/tlpkg/installer/install-menu-perltk.pl @@ -103,26 +103,28 @@ my $optfmtstate; my $optsrcstate; my $optdocstate; -push @::info_hook, - sub { - return unless defined $mainwindow; - update_status(join(" ",@_)); - $mainwindow->update; - }; -push @::warn_hook, - sub { - return unless defined $mainwindow ; - update_status(join(" ",@_)); - $mainwindow->update; - }; -push @::install_packages_hook, \&update_progressbar; -push @::install_packages_hook, - sub { - return unless defined $mainwindow; - return unless defined $::sww; - $mainwindow->update; - $::sww->update; - }; +sub setup_hooks_perltk { + push @::info_hook, + sub { + return unless defined $mainwindow; + update_status(join(" ",@_)); + $mainwindow->update; + }; + push @::warn_hook, + sub { + return unless defined $mainwindow ; + update_status(join(" ",@_)); + $mainwindow->update; + }; + push @::install_packages_hook, \&update_progressbar; + push @::install_packages_hook, + sub { + return unless defined $mainwindow; + return unless defined $::sww; + $mainwindow->update; + $::sww->update; + }; +} sub update_status { my ($p) = @_; @@ -177,6 +179,7 @@ my %text = ( title => 'TeX Live 2008 Installation', finished => 'See TEXDIR/index.html for links to documentation.\nThe TeX Live web site\n(http://tug.org/texlive/) contains any updates and corrections.\nTeX Live is a joint project of the TeX user groups around the world;\nplease consider supporting it by joining the group best for you. The\nlist of groups is available on the web at http://tug.org/usergroups.html.', finishedpath => 'Add TEXDIR/texmf/doc/man to MANPATH.\nAdd TEXDIR/texmf/doc/info to INFOPATH.\nMost importantly, add TEXDIR/bin/PLATFORM\nto your PATH for current and future sessions.', welcome => 'Welcome to TeX Live!', + wizard => 'Go to Wizard', ); @@ -235,6 +238,7 @@ my $docyesno = ( $vars{'option_doc'} ? $text{'yes'} : $text{'no'} ); sub run_menu_perltk { calc_depends(); $mainwindow = Tk::MainWindow->new; + setup_hooks_perltk(); if (!win32()) { require Tk::Pane; @@ -390,6 +394,18 @@ sub run_menu_perltk { -command => sub { $return = $MENU_ABORT; $mainwindow->destroy } )->pack(-side => 'right', -padx => "2m", -pady => "2m"); $mw->bind('', [ $quitbutton, 'Invoke' ]); + my $wizardbutton = $f3->Button( + -text => $text{'wizard'}, + -command => sub { + $mainwindow->destroy; + @::warn_hook = (); + @::debug_hook = (); + @::info_hook = (); + @::install_packages_hook = (); + require("installer/install-menu-wizard.pl"); + setup_hooks_wizard(); + $return = run_menu_wizard(); + })->pack(-side => 'right', -padx => "2m", -pady => "2m"); $row++; $f3->grid(-row => $row, -column => 1, -columnspan => 3); menu_update_texts(); diff --git a/Master/tlpkg/installer/install-menu-wizard.pl b/Master/tlpkg/installer/install-menu-wizard.pl index cb320a44956..3d7b060041d 100644 --- a/Master/tlpkg/installer/install-menu-wizard.pl +++ b/Master/tlpkg/installer/install-menu-wizard.pl @@ -26,8 +26,6 @@ our $MENU_ALREADYDONE = 3; my $return = $MENU_INSTALL; -my $custom = 0; - require Tk; require Tk::Dialog; require Tk::DialogBox; @@ -89,26 +87,27 @@ if (defined($::opt_lang)) { } -my $dest = $vars{'TEXDIR'}; +my $dest; my $mw; ###################################################################### -push @::info_hook, - sub { - return unless defined($mw); - wizard_update_status(join(" ",@_)); - $mw->update; - }; -push @::warn_hook, - sub { - return unless defined($mw); - wizard_update_status(join(" ",@_)); - $mw->update; - }; -push @::install_packages_hook, \&wizard_update_progressbar; -push @::install_packages_hook, - sub { $mw->update; }; +sub setup_hooks_wizard { + push @::info_hook, + sub { + return unless defined($mw); + wizard_update_status(join(" ",@_)); + $mw->update; + }; + push @::warn_hook, + sub { + return unless defined($mw); + wizard_update_status(join(" ",@_)); + $mw->update; + }; + push @::install_packages_hook, \&wizard_update_progressbar; + push @::install_packages_hook, sub { $mw->update; }; +} sub wizard_update_status { my ($p) = @_; @@ -218,15 +217,23 @@ my $BOTTOM = 400; my $INF = 300; my $fmain; +my $counter; + ################# WELCOME SCREEN ###################################### sub run_menu_wizard { $mw = Tk::MainWindow->new(-width => 640, -height => 480); + setup_hooks_wizard(); + + $dest = $vars{'TEXDIR'}; $tit = $mw->Label(-text => "TeX Live 2008 Installation"); $tit->place(-x => $LEFT, -y => $TOP); + $counter = $mw->Label(-text => "1/4"); + $counter->place(-x => (640 - $LEFT), -y => $TOP, -anchor => "ne"); + $fmain = $mw->Frame(-height => ($BOTTOM - $TOP -50), -width => 540); #, -borderwidth => 1, -relief => "ridge"); $fmain->place(-x => $LEFT, -y => ($TOP + 30)); @@ -253,6 +260,8 @@ sub reset_start { for ($fmain->children) { $_->destroy; } + $counter->configure(-text => "1/4"); + 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.", -justify => "left"); $inf->place(-x => 0, -y => 100); @@ -265,11 +274,12 @@ sub ask_path { for ($fmain->children) { $_->destroy; } + $counter->configure(-text => "2/4"); my $lab = $fmain->Label(-text => "Destination Folder:"); my $val = $fmain->Label(-textvar => \$dest); my $but = $fmain->Button(-text => "Change", -command => \&change_path, -relief => "ridge", -width => 10); - my $pa = $fmain->Checkbutton(-text => "Use letter-size paper instead of A4 by default", -variable => \$vars{"option_letter"}); + my $pa = $fmain->Checkbutton(-text => "Use letter-size paper by default, instead of A4", -variable => \$vars{"option_letter"}); my $cb = $fmain->Button(-text => "Advanced customization", -relief => "ridge", -command => sub { $mw->destroy; @@ -279,13 +289,14 @@ sub ask_path { @::info_hook = (); @::install_packages_hook = (); require("installer/install-menu-perltk.pl"); - $return = &{$::run_menu}(); + setup_hooks_perltk(); + $return = run_menu_perltk(); }); calc_depends(); - $fmain->Label(-text => "The destination folder will contain the installation.\nIt is recommended to keep the year as last component.", -justify => "left")->place(-x => 0, -y => 30); + $fmain->Label(-text => "The destination folder will contain the installation.\nIt is strongly recommended to keep the year as the last component.", -justify => "left")->place(-x => 0, -y => 30); my $ytmp = 100; $lab->place(-x => 0, -y => $ytmp); @@ -368,6 +379,7 @@ sub ask_go { for ($fmain->children) { $_->destroy; } + $counter->configure(-text => "3/4"); 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"); $inf->place(-x => 0, -y => 100); @@ -381,6 +393,7 @@ sub wizard_installation_window { for ($fmain->children) { $_->destroy; } + $counter->configure(-text => "4/4"); # create a progress bar window # compute the height of the Text by the given font -- cgit v1.2.3