summaryrefslogtreecommitdiff
path: root/Master/tlpkg/etc/dev.installer-gui-rework.diff
blob: 2b17d086c64963a1d85af07bdece27636a0f0551 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
Index: install-tl
===================================================================
--- install-tl	(revision 11294)
+++ install-tl	(working copy)
@@ -268,10 +268,7 @@
 
 # $finished == 1 if the menu call already did the installation
 my $finished = 0;
-@::start_install_hook = ();
-@::end_install_hook = ();
-@::start_postinst_hook = ();
-@::start_install_hook = ();
+@::info_hook = ();
 
 my $system_tmpdir=get_system_tmpdir();
 my $media;
@@ -481,9 +478,6 @@
 sub do_installation {
   # do the actual installation
   my $h;
-  foreach $h (@::start_install_hook) {
-    &$h();
-  }
   prepare_installation();
   if (!$vars{'from_dvd'}) {
     calc_depends();
@@ -518,9 +512,6 @@
     create_uninstaller($vars{'TEXDIR'}, $vars{'TEXDIRW'},
       $vars{'TEXMFSYSVAR'}, $vars{'TEXMFSYSCONFIG'});
   }
-  foreach $h (@::start_postinst_hook) {
-    &$h();
-  }
   do_postinst_stuff();
   # now we save every scheme that is fully covered by the stuff we have
   # installed to the $localtlpdb
@@ -539,9 +530,6 @@
     }
   }
   $localtlpdb->save unless $vars{'from_dvd'};
-  foreach $h (@::end_install_hook) {
-    &$h();
-  }
 }
 
 sub dump_vars {
Index: tlpkg/TeXLive/TLMedia.pm
===================================================================
--- tlpkg/TeXLive/TLMedia.pm	(revision 11294)
+++ tlpkg/TeXLive/TLMedia.pm	(working copy)
@@ -117,9 +117,6 @@
       # even if opt_doc is false
       $real_opt_doc = 1;
     }
-    foreach my $h (@::install_packages_hook) {
-      &$h("install: $pkg");
-    }
     my $container;
     my @installfiles;
     my $location = $self->location;
Index: tlpkg/TeXLive/TLUtils.pm
===================================================================
--- tlpkg/TeXLive/TLUtils.pm	(revision 11294)
+++ tlpkg/TeXLive/TLUtils.pm	(working copy)
@@ -806,7 +806,7 @@
     my $infostr = sprintf("Installing [%0${td}d/$totalnr]: $package",$n);
     info("$infostr\n");
     foreach my $h (@::install_packages_hook) {
-      &$h($infostr);
+      &$h($n,$totalnr);
     }
     my $real_opt_doc = $opt_doc;
     # if we install a package from the Documentation class we
@@ -1523,7 +1523,12 @@
 =cut
 
 sub info {
-  logit(\*STDOUT, 0, @_);
+  my $str = shift;
+  logit(\*STDOUT, 0, $str);
+  chomp($str);
+  for my $i (@::info_hook) {
+    &{$i}($str);
+  }
 }
 
 =pod
Index: tlpkg/installer/install-menu-perltk.pl
===================================================================
--- tlpkg/installer/install-menu-perltk.pl	(revision 11294)
+++ tlpkg/installer/install-menu-perltk.pl	(working copy)
@@ -100,29 +100,26 @@
 my $optsrcstate;
 my $optdocstate;
 
-push @::start_install_hook, 
-  sub { 
-    update_statusbar("Starting installation");
+push @::info_hook,
+  sub {
+    update_status(join(" ",@_));
     $mainwindow->update;
   };
-push @::start_postinst_hook, 
-  sub { 
-    update_statusbar("Starting post-installation Jobs");
-    $mainwindow->update;
-  };
-push @::end_install_hook, 
-  sub { 
-    update_statusbar("Installation finished");
-    $mainwindow->update;
-  };
+push @::install_packages_hook, \&update_progressbar;
+push @::install_packages_hook, 
+  sub { $mainwindow->update; $::sww->update; };
 
-push @::install_packages_hook, \&update_statusbar;
-push @::install_packages_hook, sub { $mainwindow->update; };
-
-sub update_statusbar {
-  my $p = shift;
-  $::statusbar->configure(-text => "$p");
+sub update_status {
+  my ($p) = @_;
+  $::progressw->insert("end", "$p\n");
+  $::progressw->see("end");
 }
+sub update_progressbar {
+  my ($n,$total) = @_;
+  if (defined($n) && defined($total)) {
+    $::progress->value(int($n*100/$total));
+  }
+}
 
 my %text = ( title      => 'TeX Live 2008 Installation',
              basicinfo  => 'Basic Information',
@@ -369,7 +366,20 @@
   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;
-      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');
   my $quitbutton = $f3->Button(
     -text    => $text{'quit'},
@@ -392,9 +404,6 @@
   $mw->bind('<Escape>', [ $quitbutton, 'Invoke' ]);
   $row++;
   $f3->grid(-row => $row, -column => 1, -columnspan => 3);
-  $::statusbar = $fr->Label(-text => $text{'status'});
-  $row++;
-  $::statusbar->grid(-row => $row, -column => 1, -columnspan => 3);
   menu_update_texts();
   $fr->gridColumnconfigure(2, -minsize => 300);
   $mw->pack(-expand => 1, -fill => "both");