diff options
Diffstat (limited to 'Master/tlpkg/installer/install-menu-perltk.pl')
-rw-r--r-- | Master/tlpkg/installer/install-menu-perltk.pl | 218 |
1 files changed, 150 insertions, 68 deletions
diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl index 343eca2f52b..7f17d1d6d1b 100644 --- a/Master/tlpkg/installer/install-menu-perltk.pl +++ b/Master/tlpkg/installer/install-menu-perltk.pl @@ -63,6 +63,14 @@ my $subframe; my $mainwindow; my $bintextbutton; my $schemebutton; +my $tmflocalbutton; +my $tmfsysvarbutton; +my $tmfsysconfigbutton; +my $tmfhomebutton; +my $pathbutton; +my $deskintbutton; +my $assocbutton; +my $adminbutton; my $collectionstext; my $texmflocaltext; my $texmfsysvartext; @@ -74,6 +82,7 @@ my $optletterstate; my $optfmtstate; my $optsrcstate; my $optdocstate; +my $portableyesno = ( $vars{'portable'} ? __("Yes") : __("No") ); my $letteryesno = $::letterdesc[$vars{'option_letter'}]; my $fmtyesno = ( $vars{'option_fmt'} ? __("Yes") : __("No") ); my $srcyesno = ( $vars{'option_src'} ? __("Yes") : __("No") ); @@ -115,11 +124,11 @@ sub setup_hooks_perltk { @::install_packages_hook = (); push @::install_packages_hook, \&update_progressbar; push @::install_packages_hook, - sub { + sub { return unless defined $mainwindow; return unless defined $::sww; - $mainwindow->update; - $::sww->update; + $mainwindow->update; + $::sww->update; }; } @@ -167,59 +176,68 @@ sub run_menu_perltk { my $row = 1; $fr->Label(-text => __("TeX Live %s Installation", $TeXLive::TLConfig::ReleaseYear))->grid(-row => $row, -column => 1, -columnspan => 3); - $row++; - $fr->Label(-text => "------- " . __("Basic Information") . " -------")->grid(-row => $row, -column => 1, -columnspan => 3); - + if (!$vars{'in_place'}) { - # binary system line - if (!win32()) { $row++; - $fr->Label(-text => __('Binary system(s)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $bintextbutton = $fr->Label(-anchor => 'w'); - $bintextbutton->grid(-row => $row, -column => 2, -padx => "2m"); - $fr->Button(-text => __("Change"), -command => sub { menu_select_binsystems(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); - } + $fr->Label(-text => "------- " . __("Basic Information") . " -------")->grid(-row => $row, -column => 1, -columnspan => 3); - $row++; + # binary system line + if (!win32()) { + $row++; + $fr->Label(-text => __('Binary system(s)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $bintextbutton = $fr->Label(-anchor => 'w'); + $bintextbutton->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => __("Change"), -command => sub { menu_select_binsystems(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + } - # scheme line - $fr->Label(-text => __('Selected scheme'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $schemebutton = $fr->Label(-anchor => 'w'); - $schemebutton->grid(-row => $row, -column => 2, -padx => "2m"); - $fr->Button(-text => __("Change"), -command => sub { menu_select_scheme(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $row++; - $row++; + # scheme line + $fr->Label(-text => __('Selected scheme'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $schemebutton = $fr->Label(-anchor => 'w'); + $schemebutton->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => __("Change"), -command => sub { menu_select_scheme(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); - # further customization - $fr->Label(-text => "------- " . __("Further Customization") . " -------")->grid(-row => $row, -column => 1,-columnspan => 3); + $row++; - $row++; - # standard collection line - $fr->Label(-text => __('Standard collections'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Button(-text => __("Change"), -command => sub { menu_select_standard_collections(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + # further customization + $fr->Label(-text => "------- " . __("Further Customization") . " -------")->grid(-row => $row, -column => 1,-columnspan => 3); - $row++; - # lang collection line - $fr->Label(-text => __('Language collections'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $langcoltext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); - $fr->Button( -text => __("Change"), -command => sub { menu_select_lang_collections(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $row++; + # standard collection line + $fr->Label(-text => __('Standard collections'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Button(-text => __("Change"), -command => sub { menu_select_standard_collections(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); - $row++; - $collectionstext = $fr->Label(); - $collectionstext->grid(-row => $row, -column => 1, -columnspan => 3); + $row++; + # lang collection line + $fr->Label(-text => __('Language collections'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $langcoltext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button( -text => __("Change"), -command => sub { menu_select_lang_collections(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + + $row++; + $collectionstext = $fr->Label(); + $collectionstext->grid(-row => $row, -column => 1, -columnspan => 3); + } $row++; # further customization $fr->Label(-text => "------- " . __("Directory setup") . " -------")->grid(-row => $row, -column => 1, -columnspan => 3); $row++; + $fr->Label(-text => __('Portable setup'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$portableyesno)->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Button(-text => __("Toggle"), -command => sub { toggle_portable(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + + $row++; # texdir line $fr->Label(-text => __('TEXDIR (the main TeX directory)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); $texdirtext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); - if ($::alternative_selector) { - $fr->Button(-text => __("Change"), -command => sub { menu_edit_texdir("TEXDIR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); - } else { - $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXDIR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + if (!$vars{'in_place'}) { + if ($::alternative_selector) { + $fr->Button(-text => __("Change"), -command => sub { menu_edit_texdir("TEXDIR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + } else { + $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXDIR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + } } @@ -227,25 +245,35 @@ sub run_menu_perltk { # texmflocal line $fr->Label(-text => __('TEXMFLOCAL (directory for site-wide local files)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); $texmflocaltext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); - $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFLOCAL"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $tmflocalbutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFLOCAL"); }); + $tmflocalbutton -> grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; # texmfsysvar line $fr->Label(-text => __('TEXMFSYSVAR (directory for autogenerated data)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); $texmfsysvartext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); - $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFSYSVAR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $tmfsysvarbutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFSYSVAR"); }); + $tmfsysvarbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; - # texmfsysvar line + # texmfsysconfig line $fr->Label(-text => __('TEXMFSYSCONFIG (directory for local config)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); $texmfsysconfigtext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); - $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFSYSCONFIG"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $tmfsysconfigbutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFSYSCONFIG"); }); + $tmfsysconfigbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; # texmfhome line $fr->Label(-text => __('TEXMFHOME (directory for user-specific files)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); $texmfhometext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); - $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFHOME"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $tmfhomebutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFHOME"); }); + $tmfhomebutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + + if ($vars{'portable'}) { + for my $b ($tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) { + $b->configure(-state => 'disabled') + } + } $row++; # Options @@ -267,14 +295,14 @@ sub run_menu_perltk { $fr->Label(-anchor => 'w', -textvariable => \$fmtyesno)->grid(-row => $row, -column => 2, -padx => "2m"); $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_fmt'}, \$fmtyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); - if ($vars{'doc_splitting_supported'}) { + if ($vars{'doc_splitting_supported'} and !$vars{'in_place'}) { $row++; $fr->Label(-text => __('Install font/macro doc tree'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); $fr->Label(-anchor => 'w', -textvariable => \$docyesno)->grid(-row => $row, -column => 2, -padx => "2m"); $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_doc'}, \$docyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } - if ($vars{'src_splitting_supported'}) { + if ($vars{'src_splitting_supported'} and !$vars{'in_place'}) { $row++; $fr->Label(-text => __('Install font/macro source tree'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); $fr->Label(-anchor => 'w', -textvariable => \$srcyesno)->grid(-row => $row, -column => 2, -padx => "2m"); @@ -282,38 +310,49 @@ sub run_menu_perltk { } $row++; - $fr->Label(-text => (win32()) ? __('Adjust PATH setting in registry') : + $fr->Label(-text => (win32()) ? __('Adjust PATH setting in registry') : __('Create symlinks in system directories'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); $fr->Label(-anchor => 'w', -textvariable => \$pathadjyesno)->grid(-row => $row, -column => 2, -padx => "2m"); if (unix()) { - $fr->Button(-text => __("Change"), -command => sub { menu_select_symlink(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $pathbutton = $fr->Button(-text => __("Change"), -command => sub { menu_select_symlink(); }); } else { - $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_path'}, \$pathadjyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $pathbutton = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_path'}, \$pathadjyesno); }); } + $pathbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); if ($::opt_all_options || win32()) { $row++; $fr->Label(-text => __('Add shortcuts to menu and desktop'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); $fr->Label(-anchor => 'w', -textvariable => \$deskintyesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_desktop_integration'}, \$deskintyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $deskintbutton = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_desktop_integration'}, \$deskintyesno); }); + $deskintbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; $fr->Label(-text => __('Change file associations'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); $fr->Label(-anchor => 'w', -textvariable => \$fileassocyesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $fr->Button(-text => __("Change"), -command => sub { menu_edit_file_assocs(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $assocbutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_file_assocs(); }); + $assocbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); if ($::opt_all_options || admin()) { $row++; $fr->Label(-text => __('Installation for all users'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); $fr->Label(-anchor => 'w', -textvariable => \$adminallyesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_w32_multi_user'}, \$adminallyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $adminbutton = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_w32_multi_user'}, \$adminallyesno); }); + $adminbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } $row++; $fr->Label(-text => __('Install TeXworks front end'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); $fr->Label(-anchor => 'w', -textvariable => \$editoryesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'collection-texworks'}, \$editoryesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + if (!$vars{'in_place'}) { + $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'collection-texworks'}, \$editoryesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + } + } + if ($vars{'portable'}) { + for $b ($pathbutton, $deskintbutton, $assocbutton, $adminbutton) { + $b->configure(-state => 'disabled') if $b; + } } # install/cancel buttons @@ -330,7 +369,7 @@ sub run_menu_perltk { #my $wizardbutton = $f3->Button( # -text => __("Wizard"), # -command => sub { - # $mainwindow->destroy; + # $mainwindow->destroy; # require("installer/install-menu-wizard.pl"); # setup_hooks_wizard(); # $return = run_menu_wizard(); @@ -404,6 +443,7 @@ sub installation_window { -command => sub { $mainwindow->destroy; }); } +# this sub will not be called if $vars{'in_place'} sub menu_edit_texdir { my $key = shift; our $addyear = 1; @@ -511,7 +551,7 @@ sub menu_edit_file_assocs { $opt->pack(-padx => "2m", -pady => "2m")->focus(); my $f = $sw->Frame; my $okbutton = $f->Button(-text => __("Ok"), - -command => sub { + -command => sub { my $idx; if ($var eq $::fileassocdesc[0]) { $idx = 0; @@ -522,8 +562,8 @@ sub menu_edit_file_assocs { } else { die "How that could happen!\n"; } - $vars{$key} = $idx; - $fileassocyesno = $::fileassocdesc[$idx]; + $vars{$key} = $idx; + $fileassocyesno = $::fileassocdesc[$idx]; $sw->destroy; })->pack(-side => "left", -padx => "2m", -pady => "2m"); my $cancelbutton = $f->Button(-text => __("Cancel"), -command => sub { $sw->destroy; })->pack(-side => "left", -padx => "2m", -pady => "2m"); $f->pack; @@ -619,7 +659,7 @@ sub menu_select_standard_collections { -command => sub { deselect_collections(\%lvars, @collections_std) })->pack(-side => 'right', -padx => "2m", -pady => "2m"); $fd->pack(-expand => 'x', -padx => "2m", -pady => "2m"); my $okbutton = $fd->Button(-text => __("Ok"), - -command => sub { + -command => sub { # we call the update only if something has changed my $changed = 0; for my $k (keys %lvars) { @@ -629,8 +669,8 @@ sub menu_select_standard_collections { } } if ($changed) { - %vars = %lvars; - callback_select_collection(); + %vars = %lvars; + callback_select_collection(); } $sw->destroy; })->pack(-side => 'left', -padx => "2m", -pady => "2m"); @@ -706,8 +746,8 @@ sub menu_select_lang_collections { } } if ($changed) { - %vars = %lvars; - callback_select_collection(); + %vars = %lvars; + callback_select_collection(); } $sw->destroy; })->pack(-side => 'left', -padx => "2m", -pady => "2m"); @@ -815,7 +855,8 @@ sub menu_select_binsystems { sub menu_set_text { my $w = shift; my $t = shift; - $w->configure(-text => $t, @_); + # if in_place or portable not a complete interface + $w->configure(-text => $t, @_) if $w; } sub menu_set_schemebutton_text { @@ -927,15 +968,19 @@ sub callback_edit_directories { $vars{'TEXMFSYSVAR'} =~ s/^~/$home/; $vars{'TEXMFSYSCONFIG'} =~ s/^~/$home/; # only if we set TEXDIR we set the others in parallel + my $texdirnoslash; if ($key eq "TEXDIR") { if ($vars{'TEXDIR'}=~/^(.*)\/$texlive_release$/) { - $vars{'TEXMFLOCAL'}="$1/texmf-local"; - $vars{'TEXMFSYSVAR'}="$1/$texlive_release/texmf-var"; - $vars{'TEXMFSYSCONFIG'}="$1/$texlive_release/texmf-config"; + $texdirnoslash = $1; + $vars{'TEXMFLOCAL'}="$texdirnoslash/texmf-local"; + $vars{'TEXMFSYSVAR'}="$texdirnoslash/$texlive_release/texmf-var"; + $vars{'TEXMFSYSCONFIG'}="$texdirnoslash/$texlive_release/texmf-config"; } elsif ($vars{'TEXDIR'}=~/^(.*)$/) { - $vars{'TEXMFLOCAL'}="$1/texmf-local"; - $vars{'TEXMFSYSVAR'}="$1/texmf-var"; - $vars{'TEXMFSYSCONFIG'}="$1/texmf-config"; + $texdirnoslash = $1; + $texdirnoslash =~ s!/$!!; + $vars{'TEXMFLOCAL'}="$texdirnoslash/texmf-local"; + $vars{'TEXMFSYSVAR'}="$texdirnoslash/texmf-var"; + $vars{'TEXMFSYSCONFIG'}="$texdirnoslash/texmf-config"; } $vars{'TEXDIRW'}=$vars{'TEXDIR'} } @@ -954,6 +999,43 @@ sub dump_vars_stdout { } } +sub toggle_portable { + my $td = $vars{'TEXDIR'}; + my $b; + if ($vars{'portable'}) { + $vars{'portable'} = 0; + $portableyesno = __('No'); + # enable some buttons + for $b ($tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) { + $b->configure(-state => 'normal'); + } + for $b ($pathbutton, $deskintbutton, $assocbutton, $adminbutton) { + $b->configure(-state => 'normal') if $b; + } + } else { + $vars{'portable'} = 1; + $portableyesno = __('Yes'); + # disable some buttons. These should get a name first. + for $b ($tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) { + $b->configure(-state => 'disabled'); + } + $vars{'option_path'} = 0; + $vars{'option_desktop_integration'} = 0; + $vars{'option_file_assocs'} = 0; + $vars{'option_w32_multi_user'} = 0; + $deskintyesno = __("No"); + $pathadjyesno = __("No"); + $fileassocyesno = __("None"); + $adminallyesno = __("No"); + for $b ($pathbutton, $deskintbutton, $assocbutton, $adminbutton) { + $b->configure(-state => 'disabled') if $b; + } + } + set_texlive_default_dirs(); # this sub tests for portable and in_place + menu_set_pathes_text(); + # same for some options +} + sub toggle_and_set_opt_variable { my ($varsref, $toggleref, $choicesref) = @_; my ($no, $yes) = $choicesref ? @$choicesref : (__('No'), __('Yes')); |