summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-02-04 17:47:43 +0000
committerNorbert Preining <preining@logic.at>2009-02-04 17:47:43 +0000
commit31b85d0556d918df36dbc6ba35939d0820f75d2d (patch)
treed5cb4e4b54a2474a399dfc810ce75b01f7cfdc88 /Master
parentc8eaa231dfefd82d3d0cb15d66be59b6c340e993 (diff)
new wizard using place and not changing the dimensions
git-svn-id: svn://tug.org/texlive/trunk@12078 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/tlpkg/installer/install-menu-wizard.pl239
1 files changed, 92 insertions, 147 deletions
diff --git a/Master/tlpkg/installer/install-menu-wizard.pl b/Master/tlpkg/installer/install-menu-wizard.pl
index e89d81ed1ee..cb320a44956 100644
--- a/Master/tlpkg/installer/install-menu-wizard.pl
+++ b/Master/tlpkg/installer/install-menu-wizard.pl
@@ -34,39 +34,17 @@ require Tk::DialogBox;
require Tk::PNG;
require Tk::ROText;
require Tk::ProgressBar;
+require Tk::Font;
use utf8;
no utf8;
#
-# LAYOUT of the wizard
#
-# /---------------------------------------------------\
-# | |
-# | /------------ Frame $ftitle -----------------\ |
-# | | Lab $tit | |
-# | \--------------------------------------------/ |
-# | |
-# | /------------ Frame $fmain ------------------\ |
-# | | | |
-# | \--------------------------------------------/ |
-# | |
-# | /------------ Frame $fbuttons ---------------\ |
-# | | But $can <$spi> But $prv <$spii> But $nxt | |
-# | \--------------------------------------------/ |
-# | |
-# \---------------------------------------------------/
-#
-my $ftitle;
my $tit;
-my $fmain;
-
-my $fbuttons;
my $can;
-my $spi;
my $prv;
-my $spii;
my $nxt;
my $img;
@@ -110,8 +88,8 @@ if (defined($::opt_lang)) {
}
}
-my $dest = $vars{'TEXDIR'};
+my $dest = $vars{'TEXDIR'};
my $mw;
######################################################################
@@ -130,7 +108,7 @@ push @::warn_hook,
};
push @::install_packages_hook, \&wizard_update_progressbar;
push @::install_packages_hook,
- sub { $mw->update; $::sww->update; };
+ sub { $mw->update; };
sub wizard_update_status {
my ($p) = @_;
@@ -234,34 +212,38 @@ if (($::lang ne "en") && ($::lang ne "C")) {
}
+my $LEFT = 50;
+my $TOP = 50;
+my $BOTTOM = 400;
+my $INF = 300;
+
+my $fmain;
################# WELCOME SCREEN ######################################
sub run_menu_wizard {
- calc_depends();
- $mw = Tk::MainWindow->new;
+ $mw = Tk::MainWindow->new(-width => 640, -height => 480);
+
+ $tit = $mw->Label(-text => "TeX Live 2008 Installation");
+
+ $tit->place(-x => $LEFT, -y => $TOP);
- $ftitle = $mw->Frame;
- $tit = $ftitle->Label(-text => "TeX Live 2008 Installation");
- $tit->pack(-side => "top", -expand => 1, -fill => "both");
+ $fmain = $mw->Frame(-height => ($BOTTOM - $TOP -50), -width => 540);
+ #, -borderwidth => 1, -relief => "ridge");
+ $fmain->place(-x => $LEFT, -y => ($TOP + 30));
- $fmain = $mw->Frame(); ## DEBUG: -relief => "ridge", -borderwidth => 2);
- $fbuttons = $mw->Frame;
- $can = $fbuttons->Button(-width => 10, -relief => "ridge", -text => "Cancel",
+ $can = $mw->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 >");
- $spii= $fbuttons->Label(-width => 2);
- $prv = $fbuttons->Button(-width => 10, -relief => "ridge", -text => "< Back");
+ $nxt = $mw->Button(-width => 10, -relief => "ridge", -text => "Next >");
+ $prv = $mw->Button(-width => 10, -relief => "ridge", -text => "< Back");
- reset_start();
+ $can->place(-x => $LEFT, -y => $BOTTOM);
+ my $rb = 640 - $LEFT;
+ $nxt->place(-x => $rb , -y => $BOTTOM, -anchor => "ne");
- $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");
+ reset_start();
- $mw->geometry("640x480");
Tk::MainLoop();
return($return);
}
@@ -271,27 +253,10 @@ sub reset_start {
for ($fmain->children) {
$_->destroy;
}
- $fmain->update;
- $mw->update;
-
- 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");
-
- $can->packForget;
- $spi->packForget;
- $prv->packForget;
- $spii->packForget;
- $nxt->packForget;
+ 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);
$nxt->configure(-text => "Next >", -command => \&ask_path );
-
- $can->pack(-side => "left");
- $spi->pack(-side => "left");
- $nxt->pack(-side => "right");
- $spii->pack(-side => "right");
-
- $fmain->update;
- $mw->update;
}
################## PATH SCREEN ################################
@@ -300,22 +265,13 @@ sub ask_path {
for ($fmain->children) {
$_->destroy;
}
- $fmain->update;
- $mw->update;
+ 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 $af = $fmain->Frame;
- my $bf = $fmain->Frame;
- my $cf = $fmain->Frame;
-
- my $lab = $af->Label(-text => "Destination Folder:");
- $lab->pack(-side => "left");
- my $val = $af->Label(-textvar => \$dest);
- $val->pack(-side => "left", -padx => "3m");
- my $but = $af->Button(-text => "Change", -command => \&change_path, -relief => "ridge", -width => 10);
- $but->pack(-side => "right");
-
- my $pa = $cf->Checkbutton(-text => "Use letter-size paper instead of A4 by default", -variable => \$vars{"option_letter"});
- my $cb = $cf->Button(-text => "Advanced customization",
+ my $pa = $fmain->Checkbutton(-text => "Use letter-size paper instead of A4 by default", -variable => \$vars{"option_letter"});
+ my $cb = $fmain->Button(-text => "Advanced customization",
+ -relief => "ridge",
-command => sub { $mw->destroy;
#undef &run_menu;
@::warn_hook = ();
@@ -325,34 +281,38 @@ sub ask_path {
require("installer/install-menu-perltk.pl");
$return = &{$::run_menu}();
});
- $pa->pack(-anchor => "w");
- $cb->pack(-anchor => "w");
calc_depends();
- my $inf = $bf->Label(-text => "Total size needed: $vars{'total_size'} MB\n\nThe destination folder will contain the installation.\nIt is recommended to keep the year as last component.");
- $inf->pack(-padx => "3m", -pady => "3m");
- $af->pack(-expand => 1, -fill => "both");
- $cf->pack(-expand => 1, -fill => "both");
- $bf->pack(-expand => 1, -fill => "both");
- $can->packForget;
- $spi->packForget;
- $prv->packForget;
- $spii->packForget;
- $nxt->packForget;
+ $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);
+
+ my $ytmp = 100;
+ $lab->place(-x => 0, -y => $ytmp);
+ $lab->update;
+ $ytmp += $lab->height;
+ $ytmp += 10;
+ $val->place(-x => 0, -y => $ytmp, -anchor => "w");
+
+ $but->place(-x => $fmain->width, -y => $ytmp, -anchor => "e");
+
+ $pa->place(-x => 0, -y => $ytmp + 30);
+
+
+ $cb->place(-x => $fmain->width, -y => $fmain->height, -anchor => "se");
+
+ $fmain->Label(-text => "Total size needed: $vars{'total_size'} MB",
+ -justify => "left"
+ )->place(-x => 0, -y => $fmain->height, -anchor => "sw");
$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");
+ my $rb = 640 - $LEFT;
+ $rb -= $nxt->width;
+ $rb -= 30;
- $fmain->update;
- $mw->update;
+ $prv->place(-x => $rb, -y => $BOTTOM, -anchor => "ne");
}
sub change_path {
@@ -408,58 +368,48 @@ sub ask_go {
for ($fmain->children) {
$_->destroy;
}
- $fmain->update;
- $mw->update;
+ 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");
- 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");
+ $inf->place(-x => 0, -y => 100);
- $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;
}
sub wizard_installation_window {
+ for ($fmain->children) {
+ $_->destroy;
+ }
# create a progress bar window
- $::sww = $mw->Toplevel(-title => "installation process",
- -width => 400);
- $::sww->transient($mw);
- $::sww->grab();
- $::sww->Label(-text => "Installation process")->pack;
- $::progressw = $::sww->Scrolled("ROText", -scrollbars => "e", -height => 16);
- $::progressw->pack(-expand => 1, -fill => "both");
+ # compute the height of the Text by the given font
+
+ $::progressw = $fmain->Scrolled("ROText", -scrollbars => "e",
+ -wrap => "word");
+ my $fo = $::progressw->cget("-font");
+
+ my $lines = int( ($fmain->height - 20) / $fo->metrics("-linespace"));
+
+ $::progressw->configure(-height => $lines); #, -width => $wd);
+
+ my $pw = $fmain->height - ($lines * $fo->metrics("-linespace")) - 5;
+
+
+ $::progressw->place(-x => 0, -y => 0, -width => $fmain->width);
+
my $percent_done = 0;
- $::progress = $::sww->ProgressBar(-variable => \$percent_done,
- -width => 20, -length => 400, -from => 0, -to => 100, -blocks => 10,
+ $fmain->update;
+ print "fmain width = ", $fmain->width, "\n";
+ $::progress = $fmain->ProgressBar(-variable => \$percent_done,
+ -width => $pw, -length => ($fmain->width),
+ -from => 0, -to => 110, -blocks => 10,
-colors => [ 0, '#0078b8' ]);
- $::progress->pack(-fill => "x");
- my $f = $::sww->Frame;
- my $b = $f->Button(-text => $text{'cancel'}, -relief => "ridge",
- -command => sub { $::sww->destroy; $mw->destroy;
- do_cleanup(); exit(1); }
- )->pack(-pady => "2m");
- $f->pack;
+ $::progress->place(-x => 0, -y => $fmain->height, -anchor => "sw");
+
# set the vars
calc_depends();
- #$mw->Busy(-recurse => 1);
do_installation();
- #$mw->Unbusy;
- $::sww->destroy;
+ $::progress->value(110);
$return = $MENU_ALREADYDONE;
my $t = $text{'finished'};
if (!win32()) {
@@ -469,20 +419,15 @@ sub wizard_installation_window {
$t =~ s/TEXDIR/$::vars{'TEXDIR'}/g;
$t =~ s/PLATFORM/$::vars{'this_platform'}/g;
$t =~ s/\\n/\n/g;
- for ($fmain->children) {
- $_->destroy;
- }
- $can->packForget;
- $prv->packForget;
- my $lab = $fmain->ROText(-height => 16, -relief => "flat", -wrap => "word");
- my $linechar = $lab->index("end");
- $lab->markSet("finaltext", $linechar);
- $lab->markGravity("finaltext", "left");
- $lab->insert("end", "\n$t");
- $lab->see("end");
- $lab->tagAdd("centered", $linechar, "end");
- $lab->tagConfigure("centered", -justify => "center");
- $lab->pack;
+ $can->placeForget;
+ $prv->placeForget;
+ my $linechar = $::progressw->index("end");
+ $::progressw->markSet("finaltext", $linechar);
+ $::progressw->markGravity("finaltext", "left");
+ $::progressw->insert("end", "\n$t");
+ $::progressw->see("end");
+ $::progressw->tagAdd("centered", $linechar, "end");
+ $::progressw->tagConfigure("centered", -justify => "center");
$nxt->configure(-text => $text{'finbut'},
-command => sub { $mw->destroy; });
}