diff options
-rw-r--r-- | Master/tlpkg/etc/dev.installer-gui-rework.diff | 190 |
1 files changed, 151 insertions, 39 deletions
diff --git a/Master/tlpkg/etc/dev.installer-gui-rework.diff b/Master/tlpkg/etc/dev.installer-gui-rework.diff index 2b17d086c64..438a95cc570 100644 --- a/Master/tlpkg/etc/dev.installer-gui-rework.diff +++ b/Master/tlpkg/etc/dev.installer-gui-rework.diff @@ -1,6 +1,6 @@ Index: install-tl =================================================================== ---- install-tl (revision 11294) +--- install-tl (revision 11304) +++ install-tl (working copy) @@ -268,10 +268,7 @@ @@ -46,7 +46,7 @@ Index: install-tl sub dump_vars { Index: tlpkg/TeXLive/TLMedia.pm =================================================================== ---- tlpkg/TeXLive/TLMedia.pm (revision 11294) +--- tlpkg/TeXLive/TLMedia.pm (revision 11304) +++ tlpkg/TeXLive/TLMedia.pm (working copy) @@ -117,9 +117,6 @@ # even if opt_doc is false @@ -60,10 +60,64 @@ Index: tlpkg/TeXLive/TLMedia.pm my $location = $self->location; Index: tlpkg/TeXLive/TLUtils.pm =================================================================== ---- tlpkg/TeXLive/TLUtils.pm (revision 11294) +--- tlpkg/TeXLive/TLUtils.pm (revision 11304) +++ tlpkg/TeXLive/TLUtils.pm (working copy) -@@ -806,7 +806,7 @@ - my $infostr = sprintf("Installing [%0${td}d/$totalnr]: $package",$n); +@@ -794,19 +794,56 @@ + my $totalnr = $#packs + 1; + my $td = length("$totalnr"); + my $n = 0; ++ my %tlpobjs; ++ my $totalsize = 0; ++ my $donesize = 0; ++ my %tlpsizes; ++ foreach my $p (@packs) { ++ $tlpobjs{$p} = $fromtlpdb->get_package($p); ++ if (!defined($tlpobjs{$p})) { ++ die "STRANGE: $p not to be found in ", $fromtlpdb->root; ++ } ++ if ($media ne 'DVD') { ++ # we use the container size as the measuring unit since probably ++ # downloading will be the limiting factor ++ $tlpsizes{$p} = $tlpobjs{$p}->containersize; ++ } else { ++ # we have to add the respective sizes, that is checking for ++ # installation of src and doc file ++ $tlpsizes{$p} = $tlpobjs{$p}->runsize; ++ $tlpsizes{$p} += $tlpobjs{$p}->srcsize if $opt_src; ++ $tlpsizes{$p} += $tlpobjs{$p}->docsize if $opt_doc; ++ my %foo = %{$tlpobjs{$p}->binsize}; ++ for my $k (keys %foo) { $tlpsizes{$p} += $foo{$k}; } ++ } ++ $totalsize += $tlpsizes{$p}; ++ } ++ my $starttime = time(); + foreach my $package (@packs) { +- my $tlpobj=$fromtlpdb->get_package($package); +- if (!defined($tlpobj)) { +- die "STRANGE: $package not to be found in ", $fromtlpdb->root; ++ my $tlpobj = $tlpobjs{$package}; ++ $n++; ++ my $remtime = "??:??"; ++ my $tottime = "??:??"; ++ if ($donesize > 0) { ++ # try to compute the remaining time ++ my $curtime = time(); ++ my $passedtime = $curtime - $starttime; ++ my $esttotalsecs = int ( ( $passedtime * $totalsize ) / $donesize ); ++ my $remsecs = $esttotalsecs - $passedtime; ++ my $min = int($remsecs/60); ++ my $sec = $remsecs % 60; ++ $remtime = sprintf("%02d:%02d", $min, $sec); ++ my $tmin = int($esttotalsecs/60); ++ my $tsec = $esttotalsecs % 60; ++ $tottime = sprintf("%02d:%02d", $tmin, $tsec); + } +- $n++; + # here we could add more information, eg about timing and number + # of bytes etc etc. + # the size of the containers is present +- my $infostr = sprintf("Installing [%0${td}d/$totalnr]: $package",$n); ++ my $infostr = sprintf("Installing [%0${td}d/$totalnr, est. time remain/total: $remtime/$tottime]: $package",$n); info("$infostr\n"); foreach my $h (@::install_packages_hook) { - &$h($infostr); @@ -71,7 +125,21 @@ Index: tlpkg/TeXLive/TLUtils.pm } my $real_opt_doc = $opt_doc; # if we install a package from the Documentation class we -@@ -1523,7 +1523,12 @@ +@@ -877,7 +914,13 @@ + die("Cannot open tlpobj file for ".$tlpobj->name); + $tlpobj->writeout(\*TMP); + close(TMP); ++ $donesize += $tlpsizes{$package}; + } ++ my $totaltime = time() - $starttime; ++ my $totmin = int ($totaltime/60); ++ my $totsec = $totaltime % 60; ++ info(sprintf("Time used for installing the packages: %02d:%02d\n", ++ $totmin, $totsec)); + $totlpdb->save; + } + +@@ -1523,7 +1566,12 @@ =cut sub info { @@ -87,9 +155,19 @@ Index: tlpkg/TeXLive/TLUtils.pm =pod Index: tlpkg/installer/install-menu-perltk.pl =================================================================== ---- tlpkg/installer/install-menu-perltk.pl (revision 11294) +--- tlpkg/installer/install-menu-perltk.pl (revision 11304) +++ tlpkg/installer/install-menu-perltk.pl (working copy) -@@ -100,29 +100,26 @@ +@@ -36,6 +36,9 @@ + require Tk::Dialog; + require Tk::DialogBox; + require Tk::PNG; ++require Tk::ROText; ++require Tk::ProgressBar; ++ + if ($::alternative_selector) { + require Tk::DirTree; + } +@@ -100,29 +103,26 @@ my $optsrcstate; my $optdocstate; @@ -135,48 +213,33 @@ Index: tlpkg/installer/install-menu-perltk.pl my %text = ( title => 'TeX Live 2008 Installation', basicinfo => 'Basic Information', -@@ -369,7 +366,20 @@ +@@ -369,32 +369,15 @@ my $f3 = $fr->Frame; $f3->Button( -text => $text{'install'}, - -command => sub { do_installation(); -+ -command => sub { -+ # create a progress bar window -+ $::sww = $mainwindow->Toplevel(-title => "installation process", -+ -width => 400); -+ $::sww->transient($mainwindow); -+ $::sww->grab(); -+ $::sww->Label(-text => "Installation process")->pack; -+ $::progressw = $::sww->ROText(-height => 16); -+ $::progressw->pack(-expand => 1, -fill => "both"); -+ $::progress = $::sww->ProgressBar( -+ -width => 20, -length => 400, -from => 0, -to => 100, -blocks => 50); -+ $::progress->value(0); -+ $::progress->pack(-expand => 1, -fill => "x"); -+ do_installation(); - $return = $MENU_ALREADYDONE; - my $t = $text{'finished'}; - if (!win32()) { -@@ -379,11 +389,13 @@ - $t =~ s/TEXDIR/$::vars{'TEXDIR'}/g; - $t =~ s/PLATFORM/$::vars{'this_platform'}/g; - $t =~ s/\\n/\n/g; +- $return = $MENU_ALREADYDONE; +- my $t = $text{'finished'}; +- if (!win32()) { +- $t .= "\n\n$text{'finishedpath'}"; +- } +- $t .= "\n\n$text{'welcome'}"; +- $t =~ s/TEXDIR/$::vars{'TEXDIR'}/g; +- $t =~ s/PLATFORM/$::vars{'this_platform'}/g; +- $t =~ s/\\n/\n/g; - my $sw = $mainwindow->DialogBox(-title => $text{'finbut'}, -buttons => [ $text{'finbut'} ]); - $sw->add("Label", -text => $t)->pack; - $sw->Show; - #$fr->Dialog(-text => $t, -buttons => [ $text{'finbut'} ])->Show; - $mainwindow->destroy }, -+ $::progressw->insert("end",$t); -+ $::progressw->see("end"); -+ my $f = $::sww->Frame; -+ $f->Button(-text => $text{'finbut'}, -+ -command => sub { $mainwindow->destroy; })->pack; -+ $f->pack; -+ }, - )->pack(-side => 'left'); +- )->pack(-side => 'left'); ++ -command => sub { installation_window(); } ++ )->pack(-side => 'left', -padx => "2m", -pady => "2m"); my $quitbutton = $f3->Button( -text => $text{'quit'}, -@@ -392,9 +404,6 @@ + -command => sub { $return = $MENU_ABORT; $mainwindow->destroy } +- )->pack(-side => 'right'); ++ )->pack(-side => 'right', -padx => "2m", -pady => "2m"); $mw->bind('<Escape>', [ $quitbutton, 'Invoke' ]); $row++; $f3->grid(-row => $row, -column => 1, -columnspan => 3); @@ -186,3 +249,52 @@ Index: tlpkg/installer/install-menu-perltk.pl menu_update_texts(); $fr->gridColumnconfigure(2, -minsize => 300); $mw->pack(-expand => 1, -fill => "both"); +@@ -415,6 +398,48 @@ + return($return); + } + ++sub installation_window { ++ # create a progress bar window ++ $::sww = $mainwindow->Toplevel(-title => "installation process", ++ -width => 400); ++ $::sww->transient($mainwindow); ++ $::sww->grab(); ++ $::sww->Label(-text => "Installation process")->pack; ++ $::progressw = $::sww->Scrolled("ROText", -scrollbars => "e", -height => 16); ++ $::progressw->pack(-expand => 1, -fill => "both"); ++ my $percent_done = 0; ++ $::progress = $::sww->ProgressBar(-variable => \$percent_done, ++ -width => 20, -length => 400, -from => 0, -to => 100, -blocks => 10, ++ -colors => [ 0, '#0078b8' ]); ++ $::progress->pack(-fill => "x"); ++ my $f = $::sww->Frame; ++ my $b = $f->Button(-text => $text{'cancel'}, ++ -command => sub { $::sww->destroy; $mainwindow->destroy; ++ do_cleanup(); exit(1); } ++ )->pack(-pady => "2m"); ++ $f->pack; ++ do_installation(); ++ $return = $MENU_ALREADYDONE; ++ my $t = $text{'finished'}; ++ if (!win32()) { ++ $t .= "\n\n$text{'finishedpath'}"; ++ } ++ $t .= "\n\n$text{'welcome'}"; ++ $t =~ s/TEXDIR/$::vars{'TEXDIR'}/g; ++ $t =~ s/PLATFORM/$::vars{'this_platform'}/g; ++ $t =~ s/\\n/\n/g; ++ $::progressw->insert("end", "\n"); ++ 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"); ++ $b->configure(-text => $text{'finbut'}, ++ -command => sub { $mainwindow->destroy; }); ++} ++ + sub menu_edit_texdir { + my $key = shift; + our $addyear = 1; |