summaryrefslogtreecommitdiff
path: root/Master/tlpkg/installer/install-menu-perltk.pl
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2011-09-13 01:18:50 +0000
committerNorbert Preining <preining@logic.at>2011-09-13 01:18:50 +0000
commit8403bdd44f7afb2d9b199f310f21f7d757d4d03f (patch)
tree60a656a6bbf1000344058dda3a793e890e9dbb53 /Master/tlpkg/installer/install-menu-perltk.pl
parent3872da8466c31b1cedc8fbf2c43edc1fb720d63d (diff)
support selecting a mirror in all the installers
git-svn-id: svn://tug.org/texlive/trunk@23929 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/installer/install-menu-perltk.pl')
-rw-r--r--Master/tlpkg/installer/install-menu-perltk.pl182
1 files changed, 156 insertions, 26 deletions
diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl
index 084a10f6b8f..d76e05f719b 100644
--- a/Master/tlpkg/installer/install-menu-perltk.pl
+++ b/Master/tlpkg/installer/install-menu-perltk.pl
@@ -39,6 +39,7 @@ our @collections_std;
our @collections_lang;
our @collections_lang_doc;
our $texlive_release;
+our @media_available;
our $MENU_INSTALL = 0;
our $MENU_ABORT = 1;
@@ -61,6 +62,19 @@ $::letterdesc[1] = __('letter');
my $mw;
my $subframe;
my $mainwindow;
+my $bin_toggle_button;
+my $scheme_toggle_button;
+my $collection_toggle_button;
+my $langcoll_toggle_button;
+my $portable_toggle_button;
+my $texdir_toggle_button;
+my $paper_toggle_button;
+my $write_eighteen_toggle_button;
+my $format_toggle_button;
+my $doc_files_toggle_button;
+my $src_files_toggle_button;
+my $texworks_toggle_button;
+my $load_remote_button;
my $bintextbutton;
my $schemebutton;
my $tmflocalbutton;
@@ -82,17 +96,17 @@ 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") );
-my $deskintyesno = ( $vars{'option_desktop_integration'} ? __("Yes") : __("No") );
-my $pathadjyesno = ( $vars{'option_path'} ? __("Yes") : __("No") );
-my $fileassocyesno = $::fileassocdesc[$vars{'option_file_assocs'}];
-my $editoryesno = ( $vars{'collection-texworks'} ? __("Yes") : __("No") );
-my $adminallyesno = ( $vars{'option_w32_multi_user'} ? __("Yes") : __("No") );
-my $docyesno = ( $vars{'option_doc'} ? __("Yes") : __("No") );
-my $restrictedyesno = ( $vars{'option_write18_restricted'} ? __("Yes") : __("No") );
+my $portableyesno;
+my $letteryesno;
+my $fmtyesno;
+my $srcyesno;
+my $deskintyesno;
+my $pathadjyesno;
+my $fileassocyesno;
+my $editoryesno;
+my $adminallyesno;
+my $docyesno;
+my $restrictedyesno;
$::run_menu = \&run_menu_perltk;
@@ -101,6 +115,19 @@ $::run_menu = \&run_menu_perltk;
# From here on only function definitions
# ##################################################################
+sub setup_perltk_local_vars {
+ $portableyesno = ( $vars{'portable'} ? __("Yes") : __("No") );
+ $letteryesno = $::letterdesc[$vars{'option_letter'}];
+ $fmtyesno = ( $vars{'option_fmt'} ? __("Yes") : __("No") );
+ $srcyesno = ( $vars{'option_src'} ? __("Yes") : __("No") );
+ $deskintyesno = ( $vars{'option_desktop_integration'} ? __("Yes") : __("No") );
+ $pathadjyesno = ( $vars{'option_path'} ? __("Yes") : __("No") );
+ $fileassocyesno = $::fileassocdesc[$vars{'option_file_assocs'}];
+ $editoryesno = ( $vars{'collection-texworks'} ? __("Yes") : __("No") );
+ $adminallyesno = ( $vars{'option_w32_multi_user'} ? __("Yes") : __("No") );
+ $docyesno = ( $vars{'option_doc'} ? __("Yes") : __("No") );
+ $restrictedyesno = ( $vars{'option_write18_restricted'} ? __("Yes") : __("No") );
+}
sub menu_abort {
$return = $MENU_ABORT;
@@ -146,9 +173,42 @@ sub update_progressbar {
}
}
+sub disable_buttons {
+ change_button_state('disabled');
+}
+sub enable_buttons {
+ change_button_state('normal');
+}
+
+sub change_button_state {
+ my $what = shift;
+ $tmflocalbutton->configure(-state => $what);
+ $tmfsysvarbutton->configure(-state => $what);
+ $tmfsysconfigbutton->configure(-state => $what);
+ $tmfhomebutton->configure(-state => $what);
+ $bin_toggle_button->configure(-state => $what);
+ $scheme_toggle_button->configure(-state => $what);
+ $collection_toggle_button->configure(-state => $what);
+ $langcoll_toggle_button->configure(-state => $what);
+ $portable_toggle_button->configure(-state => $what);
+ $texdir_toggle_button->configure(-state => $what);
+ $texdir_toggle_button->configure(-state => $what);
+ $paper_toggle_button->configure(-state => $what);
+ $write_eighteen_toggle_button->configure(-state => $what);
+ $format_toggle_button->configure(-state => $what);
+ $pathbutton->configure(-state => $what);
+ $doc_files_toggle_button->configure(-state => $what) if defined($doc_files_toggle_button);
+ $src_files_toggle_button->configure(-state => $what) if defined($src_files_toggle_button);
+ $texworks_toggle_button->configure(-state => $what) if defined($texworks_toggle_button);
+}
sub run_menu_perltk {
- calc_depends();
+ if ($::opt_select_repository) {
+ } else {
+ do_remote_init();
+ setup_perltk_local_vars();
+ calc_depends();
+ }
$mainwindow = Tk::MainWindow->new;
$mainwindow->protocol('WM_DELETE_WINDOW' => \&menu_abort);
setup_hooks_perltk();
@@ -176,6 +236,71 @@ sub run_menu_perltk {
my $row = 1;
$fr->Label(-text => __("TeX Live %s Installation", $TeXLive::TLConfig::ReleaseYear))->grid(-row => $row, -column => 1, -columnspan => 3);
+ if ($::opt_select_repository) {
+ $row++;
+ my @mirror_list;
+ my @netlst;
+ my @loclst;
+ if ($#media_available >= 0) {
+ for my $l (@media_available) {
+ my ($a, $b) = split ('#', $l);
+ if ($a eq 'local_compressed' || $a eq 'local_uncompressed') {
+ push @loclst, " $b";
+ } elsif ($a eq 'NET') {
+ push @netlst, " cmd line repository: $b";
+ } else {
+ tlwarn("Unknown media $l\n");
+ }
+ }
+ if ($#loclst >= 0) {
+ push @mirror_list, "LOCAL REPOSITORIES";
+ push @mirror_list, @loclst;
+ }
+ }
+ push @mirror_list, "NETWORK REPOSITORIES";
+ push @mirror_list, " Default repository: http://mirror.ctan.org";
+ push @mirror_list, @netlst;
+ push @mirror_list, TeXLive::TLUtils::create_mirror_list();
+ my $mirror_entry;
+ $fr->Label(-text => __('Select repository'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
+ $fr->BrowseEntry(-state => 'readonly',
+ -listheight => 12,
+ -listwidth => 400,
+ -width => 35,
+ -autolistwidth => 1,
+ -choices => \@mirror_list,
+ -browsecmd =>
+ sub {
+ if ($mirror_entry !~ m/^ /) {
+ $mirror_entry = "";
+ } else {
+ $mirror_entry = TeXLive::TLUtils::extract_mirror_entry($mirror_entry);
+ }
+ },
+ -variable => \$mirror_entry)->grid(-row => $row, -column => 2, -sticky => 'w');
+ $load_remote_button = $fr->Button(-text => __("Load"),
+ -command => sub {
+ $::init_remote_needed = 1;
+ my $mfull = $mirror_entry;
+ only_load_remote($mfull);
+ if (!do_version_agree()) {
+ $fr->Dialog(-title => __("Warning"),
+ -text => __('The TeX Live versions of the local installation and the repository being accessed are not compatible:
+ local: %s
+ repository: %s
+Please select a different mirror.', $TeXLive::TLConfig::ReleaseYear, $texlive_release),
+ -buttons => [ __("Ok") ])->Show;
+ $mirror_entry = "";
+ } else {
+ $load_remote_button->configure(-state => 'disable');
+ final_remote_init($mfull);
+ setup_perltk_local_vars();
+ calc_depends();
+ menu_update_texts();
+ enable_buttons();
+ }
+ })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ }
if (!$vars{'in_place'}) {
$row++;
@@ -187,7 +312,7 @@ sub run_menu_perltk {
$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");
+ $bin_toggle_button = $fr->Button(-text => __("Change"), -command => sub { menu_select_binsystems(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
}
$row++;
@@ -196,7 +321,7 @@ sub run_menu_perltk {
$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");
+ $scheme_toggle_button = $fr->Button(-text => __("Change"), -command => sub { menu_select_scheme(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
$row++;
@@ -206,13 +331,13 @@ sub run_menu_perltk {
$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");
+ $collection_toggle_button = $fr->Button(-text => __("Change"), -command => sub { menu_select_standard_collections(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
$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");
+ $langcoll_toggle_button = $fr->Button( -text => __("Change"), -command => sub { menu_select_lang_collections(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
$row++;
$collectionstext = $fr->Label();
@@ -226,7 +351,7 @@ sub run_menu_perltk {
$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");
+ $portable_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_portable(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
$row++;
# texdir line
@@ -234,9 +359,9 @@ sub run_menu_perltk {
$texdirtext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -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");
+ $texdir_toggle_button = $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");
+ $texdir_toggle_button = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXDIR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
}
}
@@ -283,30 +408,30 @@ sub run_menu_perltk {
# optpaper
$fr->Label(-text => __('Default paper size'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
$fr->Label(-anchor => 'w', -textvariable => \$letteryesno)->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_letter'}, \$letteryesno, \@::letterdesc); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ $paper_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_letter'}, \$letteryesno, \@::letterdesc); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
$row++;
$fr->Label(-text => __('Allow execution of restricted list of programs via \write18'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
$fr->Label(-anchor => 'w', -textvariable => \$restrictedyesno)->grid(-row => $row, -column => 2, -padx => "2m");
- $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_write18_restricted'}, \$restrictedyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ $write_eighteen_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_write18_restricted'}, \$restrictedyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
$row++;
$fr->Label(-text => __('Create all format files'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
$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");
+ $format_toggle_button = $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'} 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");
+ $doc_files_toggle_button = $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'} 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");
- $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_src'}, \$srcyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ $src_files_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_src'}, \$srcyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
}
$row++;
@@ -346,9 +471,10 @@ sub run_menu_perltk {
$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");
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");
+ $texworks_toggle_button = $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;
@@ -376,7 +502,11 @@ sub run_menu_perltk {
# })->pack(-side => 'right', -padx => "2m", -pady => "2m");
$row++;
$f3->grid(-row => $row, -column => 1, -columnspan => 3);
- menu_update_texts();
+ if (!$::opt_select_repository) {
+ menu_update_texts();
+ } else {
+ disable_buttons();
+ }
$fr->gridColumnconfigure(2, -minsize => 300);
$mw->pack(-expand => 1, -fill => "both");
$mw->update;