summaryrefslogtreecommitdiff
path: root/Master/tlpkg/installer/install-menu-perltk.pl
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2017-04-15 08:22:51 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2017-04-15 08:22:51 +0000
commit2b467244921da9f75590f1ca21e3f6d1eae09471 (patch)
tree5551f25d5aaf35942ba0da8be9cd32d32cabf88c /Master/tlpkg/installer/install-menu-perltk.pl
parentade96bccf43fcbd9bdf05e4943942bf59dc3c488 (diff)
Reworked installer and tlaunch option
git-svn-id: svn://tug.org/texlive/trunk@43805 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/installer/install-menu-perltk.pl')
-rw-r--r--Master/tlpkg/installer/install-menu-perltk.pl778
1 files changed, 440 insertions, 338 deletions
diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl
index 230a6db0451..af465638057 100644
--- a/Master/tlpkg/installer/install-menu-perltk.pl
+++ b/Master/tlpkg/installer/install-menu-perltk.pl
@@ -22,8 +22,8 @@ require Tk;
require Tk::Dialog;
require Tk::DialogBox;
require Tk::PNG;
-require Tk::ROText;
-require Tk::ProgressBar;
+#require Tk::ROText;
+#require Tk::ProgressBar;
require Tk::BrowseEntry;
if ($::alternative_selector) {
@@ -52,6 +52,7 @@ our %TRANS;
require("TeXLive/trans.pl");
load_translations();
+# @fileassocdesc also defined in install-tl
$::fileassocdesc[0] = __("None");
$::fileassocdesc[1] = __("Only new");
$::fileassocdesc[2] = __("All");
@@ -59,6 +60,14 @@ $::fileassocdesc[2] = __("All");
$::letterdesc[0] = __('A4');
$::letterdesc[1] = __('letter');
+$::deskintdesc[0] = __("No shortcuts");
+$::deskintdesc[1] = __("TeX Live menu");
+if (win32() && is_vista()) { $::deskintdesc[2] = __("Launcher entry"); }
+
+# generic option strings:
+$::yesno[0] = __('No');
+$::yesno[1] = __('Yes');
+
my $mw;
my $subframe;
my $mainwindow;
@@ -116,19 +125,19 @@ $::run_menu = \&run_menu_perltk;
# From here on only function definitions
# ##################################################################
-sub setup_perltk_local_vars {
- $portableyesno = ( $vars{'portable'} ? __("Yes") : __("No") );
+sub setup_perltk_local_strings {
+ $portableyesno = $::yesno[$vars{'portable'}];
$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") );
+ $fmtyesno = $::yesno[$vars{'option_fmt'}];
+ $srcyesno = $::yesno[$vars{'option_src'}];
+ $deskintyesno = $::deskintdesc[$vars{'option_desktop_integration'}];
+ $pathadjyesno = $::yesno[$vars{'option_path'}];
$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") );
- $adjustrepoyesno = ( $vars{'option_adjustrepo'} ? __("Yes") : __("No") );
+ $editoryesno = $::yesno[$vars{'collection-texworks'}];
+ $adminallyesno = $::yesno[$vars{'option_w32_multi_user'}];
+ $docyesno = $::yesno[$vars{'option_doc'}];
+ $restrictedyesno = $::yesno[$vars{'option_write18_restricted'}];
+ $adjustrepoyesno = $::yesno[$vars{'option_adjustrepo'}];
}
sub menu_abort {
@@ -136,43 +145,9 @@ sub menu_abort {
$mainwindow->destroy;
}
-sub setup_hooks_perltk {
- @::info_hook = ();
- push @::info_hook,
- sub {
- return unless defined $mainwindow;
- update_status(join(" ",@_));
- $mainwindow->update;
- };
- push @::warn_hook,
- sub {
- return unless defined $mainwindow ;
- update_status(join(" ",@_));
- $mainwindow->update;
- };
- @::install_packages_hook = ();
- push @::install_packages_hook, \&update_progressbar;
- push @::install_packages_hook,
- sub {
- return unless defined $mainwindow;
- return unless defined $::sww;
- $mainwindow->update;
- $::sww->update;
- };
-}
-
-sub update_status {
- my ($p) = @_;
- return unless defined $::progressw;
- $::progressw->insert("end", "$p");
- $::progressw->see("end");
-}
-sub update_progressbar {
- my ($n,$total) = @_;
- return unless defined $::progress;
- if (defined($n) && defined($total)) {
- $::progress->value(int($n*100/$total));
- }
+sub menu_do_it {
+ $return = $MENU_INSTALL;
+ $mainwindow->destroy;
}
sub disable_buttons {
@@ -194,46 +169,46 @@ sub change_button_state {
$collection_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);
$adjustrepo_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);
+ $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 {
if ($::opt_select_repository) {
} else {
do_remote_init();
- setup_perltk_local_vars();
+ setup_perltk_local_strings();
calc_depends();
}
$mainwindow = Tk::MainWindow->new;
$mainwindow->protocol('WM_DELETE_WINDOW' => \&menu_abort);
- setup_hooks_perltk();
# Taco once reported for 2010 that using these scrolled pane
# on Windows just died
# with the proliferation of netbooks and a new perl installed
# let us try to go back to using scrolled pane on both unix and windows
- #if (!win32()) {
- require Tk::Pane;
- $subframe = $mainwindow->Scrolled("Frame", -scrollbars => "oe");
- #} else {
- # $subframe = $mainwindow->Frame;
- #}
+ require Tk::Pane;
+ $subframe = $mainwindow->Scrolled("Frame", -scrollbars => "oe");
$mw = $subframe->Frame;
# image frame on the left
my $fl = $mw->Frame(-background => "#0078b8");
my $img = $fl->Photo(-format => 'png',
-file => "$::installerdir/tlpkg/installer/texlive.png");
- $fl->Label(-image => $img, -background => "#0078b8")->pack(-expand => 1, -fill => "y");
- $fl->Label(-text => "v$::installerrevision/$::menurevision", -background => "#0078b8")->pack;
+ $fl->Label(-image => $img, -background => "#0078b8")
+ ->pack(-expand => 1, -fill => "y");
+ $fl->Label(
+ -text => "v$::installerrevision/$::menurevision",
+ -background => "#0078b8")->pack;
# data frame on the right
my $fr = $mw->Frame;
@@ -242,7 +217,9 @@ sub run_menu_perltk {
my $row = 1;
- $fr->Label(-text => __("TeX Live %s Installation", $TeXLive::TLConfig::ReleaseYear))->grid(-row => $row, -column => 1, -columnspan => 3);
+ $fr->Label(
+ -text => __("TeX Live %s Installation", $TeXLive::TLConfig::ReleaseYear))
+ ->grid(-row => $row, -column => 1, -columnspan => 3);
if ($::opt_select_repository) {
$row++;
@@ -266,29 +243,36 @@ sub run_menu_perltk {
}
}
push @mirror_list, __("NETWORK REPOSITORIES");
- push @mirror_list, " " . __("Default remote repository") . ": http://mirror.ctan.org";
+ push @mirror_list,
+ " " . __("Default remote 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 = "";
- } elsif ($mirror_entry =~ m!(http|ftp)://!) {
- $mirror_entry = TeXLive::TLUtils::extract_mirror_entry($mirror_entry);
- } else {
- $mirror_entry =~ s/^\s*//;
- # $mirror_entry = TeXLive::TLUtils::extract_mirror_entry($mirror_entry);
- }
- },
- -variable => \$mirror_entry)->grid(-row => $row, -column => 2, -sticky => 'w');
+ $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 = "";
+ } elsif ($mirror_entry =~ m!(http|ftp)://!) {
+ $mirror_entry =
+ TeXLive::TLUtils::extract_mirror_entry($mirror_entry);
+ } else {
+ $mirror_entry =~ s/^\s*//;
+ # $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;
@@ -302,17 +286,20 @@ sub run_menu_perltk {
-buttons => [ __("Ok") ])->Show;
$mirror_entry = "";
} elsif (!do_version_agree()) {
- $fr->Dialog(-title => __("Warning"),
- -text => __('The TeX Live versions of the local installation and the repository being accessed are not compatible:
+ $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),
+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();
+ setup_perltk_local_strings();
calc_depends();
menu_update_texts();
enable_buttons();
@@ -322,34 +309,46 @@ Please select a different mirror.', $TeXLive::TLConfig::ReleaseYear, $texlive_re
if (!$vars{'in_place'}) {
$row++;
- $fr->Label(-text => "------- " . __("Basic Information") . " -------")->grid(-row => $row, -column => 1, -columnspan => 3);
+ $fr->Label(-text => "------- " . __("Basic Information") . " -------")
+ ->grid(-row => $row, -column => 1, -columnspan => 3);
# binary system line
if (!win32()) {
$row++;
- $fr->Label(-text => __('Binary system(s)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
+ $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");
- $bin_toggle_button = $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++;
# scheme line
- $fr->Label(-text => __('Selected scheme'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
+ $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");
- $scheme_toggle_button = $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++;
# further customization
- $fr->Label(-text => "------- " . __("Further Customization") . " -------")->grid(-row => $row, -column => 1,-columnspan => 3);
+ $fr->Label(-text => "------- " . __("Further Customization") . " -------")
+ ->grid(-row => $row, -column => 1,-columnspan => 3);
$row++;
# collection line
- $fr->Label(-text => __('Installation collections'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $collection_toggle_button = $fr->Button(-text => __("Change"), -command => sub { menu_select_standard_collections(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ $fr->Label(-text => __('Installation collections'), -anchor => 'w')
+ ->grid(-row => $row, -column => 1, -sticky => 'w');
+ $collection_toggle_button = $fr->Button(
+ -text => __("Change"),
+ -command => sub { menu_select_standard_collections(); })
+ ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
$row++;
$collectionstext = $fr->Label();
@@ -358,139 +357,255 @@ Please select a different mirror.', $TeXLive::TLConfig::ReleaseYear, $texlive_re
$row++;
# further customization
- $fr->Label(-text => "------- " . __("Directory setup") . " -------")->grid(-row => $row, -column => 1, -columnspan => 3);
+ $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");
- $portable_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_portable(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ $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");
+ $portable_toggle_button = $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");
+ $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 (!$vars{'in_place'}) {
if ($::alternative_selector) {
- $texdir_toggle_button = $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 {
- $texdir_toggle_button = $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");
}
}
$row++;
# 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");
- $tmflocalbutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFLOCAL"); });
- $tmflocalbutton -> grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ $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");
+ $tmflocalbutton = $fr->Button(
+ -text => __("Change"),
+ -command => sub { menu_edit_vars_value("TEXMFLOCAL"); })
+ ->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");
- $tmfsysvarbutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFSYSVAR"); });
- $tmfsysvarbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ $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");
+ $tmfsysvarbutton = $fr->Button(
+ -text => __("Change"),
+ -command => sub { menu_edit_vars_value("TEXMFSYSVAR"); })
+ ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
$row++;
# 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");
- $tmfsysconfigbutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFSYSCONFIG"); });
- $tmfsysconfigbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ $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");
+ $tmfsysconfigbutton = $fr->Button(
+ -text => __("Change"),
+ -command => sub { menu_edit_vars_value("TEXMFSYSCONFIG"); })
+ ->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");
- $tmfhomebutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFHOME"); });
- $tmfhomebutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ $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");
+ $tmfhomebutton = $fr->Button(
+ -text => __("Change"),
+ -command => sub { menu_edit_vars_value("TEXMFHOME"); })
+ ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
if ($vars{'portable'}) {
- for my $b ($tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) {
+ for my $b (
+ $tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) {
$b->configure(-state => 'disabled')
}
}
$row++;
# Options
- $fr->Label(-text => "------- " . __("Options") . " -------")->grid(-row => $row, -column => 1, -columnspan => 3);
+ $fr->Label(-text => "------- " . __("Options") . " -------")
+ ->grid(-row => $row, -column => 1, -columnspan => 3);
$row++;
# 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");
- $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");
+ $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");
+ $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");
- $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");
+ $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");
+ $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");
- $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");
+ $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");
+ $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");
- $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");
+ $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");
+ $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");
- $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");
+ $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");
+ $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++;
- $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");
+ $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()) {
- $pathbutton = $fr->Button(-text => __("Change"), -command => sub { menu_select_symlink(); });
+ $pathbutton = $fr->Button(
+ -text => __("Change"), -command => sub { menu_select_symlink(); });
} else {
- $pathbutton = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_path'}, \$pathadjyesno); });
+ $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 menu shortcuts'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $fr->Label(-anchor => 'w', -textvariable => \$deskintyesno)->grid(-row => $row, -column => 2, -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");
+ $fr->Label(-text => __('Add menu shortcuts'), -anchor => 'w')
+ ->grid(-row => $row, -column => 1, -sticky => 'w');
+ $fr->Label(-anchor => 'w', -textvariable => \$deskintyesno)
+ ->grid(-row => $row, -column => 2, -padx => "2m");
+ $deskintbutton = $fr->Button(
+ -text => __("Change"),
+ -command => sub {
+ toggle_and_set_opt_variable(
+ \$vars{'option_desktop_integration'},
+ \$deskintyesno, \@::deskintdesc); })
+ ->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");
- $assocbutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_file_assocs(); });
- $assocbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ $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");
+ $assocbutton = $fr->Button(
+ -text => __("Change"),
+ -command => sub {
+ toggle_and_set_opt_variable(
+ \$vars{'option_file_assocs'}, \$fileassocyesno, \@::fileassocdesc); })
+ ->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");
- $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");
+ $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");
+ $adminbutton = $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");
}
$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->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'}) {
- $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");
+ $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 ($media ne 'NET') {
$row++;
- $fr->Label(-text => __('After installation, get package updates from CTAN'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
- $fr->Label(-anchor => 'w', -textvariable => \$adjustrepoyesno)->grid(-row => $row, -column => 2, -padx => "2m");
- $adjustrepo_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_adjustrepo'}, \$adjustrepoyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
+ $fr->Label(
+ -text => __('After installation, get package updates from CTAN'),
+ -anchor => 'w')
+ ->grid(-row => $row, -column => 1, -sticky => 'w');
+ $fr->Label(-anchor => 'w', -textvariable => \$adjustrepoyesno)
+ ->grid(-row => $row, -column => 2, -padx => "2m");
+ $adjustrepo_toggle_button = $fr->Button(
+ -text => __("Toggle"),
+ -command => sub {
+ toggle_and_set_opt_variable(
+ \$vars{'option_adjustrepo'}, \$adjustrepoyesno); })
+ ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
}
if ($vars{'portable'}) {
@@ -516,17 +631,17 @@ Licensed under the GNU General Public License version 2 or higher
In case of problems, please contact: texlive\@tug.org"
)->pack(-ipadx => "2m", -ipady => "2m");
$sw->Show;
- })->pack(-side => 'left', -padx => "2m", -pady => "2m");
-
+ })->pack(-side => 'left', -padx => "2m", -pady => "2m");
+
$installbutton = $f3->Button(
-text => __("Install TeX Live"),
- -command => sub { installation_window(); });
- $installbutton->pack(-side => 'left', -padx => "2m", -pady => "2m")->focus();
+ -command => \&menu_do_it
+ )->pack(-side => 'left', -padx => "2m", -pady => "2m")->focus();
my $quitbutton = $f3->Button(
-text => __("Quit"),
- -command => \&menu_abort,
+ -command => \&menu_abort
)->pack(-side => 'right', -padx => "2m", -pady => "2m");
$mw->bind('<Escape>', [ $quitbutton, 'Invoke' ]);
#my $wizardbutton = $f3->Button(
@@ -550,7 +665,8 @@ In case of problems, please contact: texlive\@tug.org"
my $rh = $mw->reqheight;
my $rw = $mw->reqwidth;
my $maxheight = $mainwindow->screenheight() - 20;
- debug("Requested height: $rh, requested width: $rw, max height: $maxheight\n");
+ debug(
+ "Requested height: $rh, requested width: $rw, max height: $maxheight\n");
if ($rh > $maxheight) {
$rh = $maxheight;
$rw += 20; # for the scrollbar = =
@@ -561,20 +677,18 @@ In case of problems, please contact: texlive\@tug.org"
$mainwindow->geometry("=${rw}x${rh}");
#$mw->pack(-expand => 1, -fill => "both");
- pre_warn($mainwindow) if win32();
+ if (win32() && pre_warn($mainwindow)) { return $MENU_ABORT; }
Tk::MainLoop();
return($return);
}
-sub pre_warn() {
+sub pre_warn {
my $parent = shift;
require TeXLive::TLWinGoo;
- my $pre_warning = $parent->Toplevel();
- $pre_warning->title(
- __("TeX Live %s Installation", $TeXLive::TLConfig::ReleaseYear));
- my $wrn = __('Best to disable your virus scanner during installation.');
-
+ my ($b_quit, $b_cont) = (__('Quit'), __('Continue'));
+ my $wrn = __(
+ 'In case of trouble, try disabling your virus scanner during installation.');
if (!admin()) {
$wrn .= "\n\n".
__("The installer does not have adminstrative permissions;\nso can only install for current user.");
@@ -583,62 +697,12 @@ sub pre_warn() {
__("Right-click install-tl-advanced and select \"run as administrator\"\n if you want to install for all users.");
}
}
- $pre_warning->Label(-textvariable=>\$wrn, -justify=>'left')->pack();
- my $sf = $pre_warning->Frame;
- $sf->Button(-text=>__('Quit'), -command=>sub{exit()})->pack(-side=>'left');
- $sf->Button(-text=>__('Continue'), -command=>sub{
- $parent->deiconify();
- $parent->raise;
- $pre_warning->withdraw();
- })->pack(-side=>'right');
- $sf->pack(-fill => 'x');
-}
-
-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 => __("Cancel"),
- -command => sub { $::sww->destroy; $mainwindow->destroy;
- do_cleanup(); exit(1); }
- )->pack(-pady => "2m");
- $b->focus();
- $f->pack;
- do_installation();
- $return = $MENU_ALREADYDONE;
- my $t = __("See %s/index.html for links to documentation.\nThe TeX Live web site (http://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; please consider supporting it by joining the group best for you. The list of groups is available on the web at http://tug.org/usergroups.html.", $::vars{'TEXDIR'});
- if (!win32()) {
- $t .= "\n\n" . __("Add %s/texmf-dist/doc/man to MANPATH.\nAdd %s/texmf-dist/doc/info to INFOPATH.\nMost importantly, add %s/bin/%s\nto your PATH for current and future sessions.", $::vars{'TEXDIR'}, $::vars{'TEXDIR'}, $::vars{'TEXDIR'}, $::vars{'this_platform'});
- }
- if (@::WARNLINES) {
- $t .= "\n\n" . __("There were some warnings during the installation process.\nHere is the list of warning messages:") . "\n";
- $t .= join('', @::WARNLINES);
- $t =~ s/\n\z//;
- }
-
- $t .= "\n\n" . __("Welcome to TeX Live!");
- #$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 => __("Finish"),
- -command => sub { $mainwindow->destroy; });
+ my $ans = $parent->Dialog(
+ -title => __("TeX Live %s Installation", $TeXLive::TLConfig::ReleaseYear),
+ -text => $wrn,
+ -default_button => $b_cont,
+ -buttons => [$b_quit, $b_cont])->Show();
+ return $ans eq $b_quit;
}
# this sub will not be called if $vars{'in_place'}
@@ -681,19 +745,31 @@ sub menu_edit_texdir {
my $sw = $mainwindow->Toplevel(-title => __("Change variable value"));
$sw->transient($mainwindow);
$sw->grab();
- $sw->Label(-text => __("Enter path for %s (use ~ for %s)", $key, $hint_var))->pack(-padx => "2m", -pady => "2m");
+ $sw->Label(-text => __("Enter path for %s (use ~ for %s)", $key, $hint_var))
+ ->pack(-padx => "2m", -pady => "2m");
$entry = $sw->Entry(-width => 60)->pack(-padx => "2m", -pady => "2m");
my $f = $sw->Frame;
- my $c1 = $f->Checkbutton(-text => 'Add "texlive"', -variable => \$addtexlive,
+ my $c1 = $f->Checkbutton(
+ -text => 'Add "texlive"',
+ -variable => \$addtexlive,
-command => \&update_label);
- my $c2 = $f->Checkbutton(-text => "Add \"$texlive_release\"", -variable => \$addyear,
+ my $c2 = $f->Checkbutton(
+ -text => "Add \"$texlive_release\"", -variable => \$addyear,
-command => \&update_label);
- my $foo = $sw->Scrolled("DirTree", -scrollbars => "osoe",
- -browsecmd => sub { my ($d) = @_; $currsel = $d; update_label(); },
- -directory => "$currsel");
+ my $foo = $sw->Scrolled(
+ "DirTree", -scrollbars => "osoe",
+ -browsecmd => sub { my ($d) = @_; $currsel = $d; update_label(); },
+ -directory => "$currsel");
my $ff = $sw->Frame;
- my $ok = $ff->Button(-text => __("Ok"), -command => sub { $val = $entry->get; callback_edit_directories($key,$val); $sw->destroy; });
- my $cancel = $ff->Button(-text => __("Cancel"), -command => sub { $sw->destroy; });
+ my $ok = $ff->Button(
+ -text => __("Ok"),
+ -command => sub {
+ $val = $entry->get;
+ callback_edit_directories($key,$val);
+ $sw->destroy; });
+ my $cancel = $ff->Button(
+ -text => __("Cancel"),
+ -command => sub { $sw->destroy; });
update_label();
$c1->pack(-side => "left", -padx => "2m", -pady => "2m");
$c2->pack(-side => "right", -padx => "2m", -pady => "2m");
@@ -719,56 +795,28 @@ sub menu_edit_vars_value {
} else {
$hint_var = win32() ? '%USERPROFILE%' : '$HOME';
}
- $sw->Label(-text => __("Enter path for %s (use ~ for %s)", $key, $hint_var))->pack(-padx => "2m", -pady => "2m");
+ $sw->Label(-text => __("Enter path for %s (use ~ for %s)", $key, $hint_var))
+ ->pack(-padx => "2m", -pady => "2m");
my $entry = $sw->Entry(-text => native_slashify($val), -width => 60);
$entry->pack(-padx => "2m", -pady => "2m")->focus();
my $f = $sw->Frame;
- my $okbutton = $f->Button(-text => __("Ok"),
- -command => sub { $val = forward_slashify($entry->get); callback_edit_directories($key,$val) ; $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m");
- my $cancelbutton = $f->Button(-text => __("Cancel"),
- -command => sub { $sw->destroy })->pack(-side => 'right', -padx => "2m", -pady => "2m");
+ my $okbutton = $f->Button(
+ -text => __("Ok"),
+ -command => sub {
+ $val = forward_slashify($entry->get);
+ callback_edit_directories($key,$val) ;
+ $sw->destroy })
+ ->pack(-side => 'left', -padx => "2m", -pady => "2m");
+ my $cancelbutton = $f->Button(
+ -text => __("Cancel"),
+ -command => sub { $sw->destroy })
+ ->pack(-side => 'right', -padx => "2m", -pady => "2m");
$f->pack(-expand => 'x');
# bindings
$sw->bind('<Return>' => [ $okbutton, 'Invoke']);
$sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']);
}
-sub menu_edit_file_assocs {
- my $sw = $mainwindow->Toplevel(-title => __('Change file associations'));
- $sw->transient($mainwindow);
- $sw->grab();
- my $key = 'option_file_assocs';
- my $var = $::fileassocdesc[$vars{$key}];
- $sw->Label(-text => __("Change file associations"))->pack(-padx => "2m", -pady => "2m");
- my $opt = $sw->BrowseEntry(-autolistwidth => 1,
- -variable => \$var);
- for my $i (0..2) {
- $opt->insert("end", $::fileassocdesc[$i]);
- }
-
- $opt->pack(-padx => "2m", -pady => "2m")->focus();
- my $f = $sw->Frame;
- my $okbutton = $f->Button(-text => __("Ok"),
- -command => sub {
- my $idx;
- if ($var eq $::fileassocdesc[0]) {
- $idx = 0;
- } elsif ($var eq $::fileassocdesc[1]) {
- $idx = 1;
- } elsif ($var eq $::fileassocdesc[2]) {
- $idx = 2;
- } else {
- die "How that could happen!\n";
- }
- $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;
- $sw->bind('<Return>', [ $okbutton, 'Invoke' ]);
- $sw->bind('<Escape>', [ $cancelbutton, 'Invoke' ]);
-}
-
sub menu_select_scheme {
my $sw = $mainwindow->Toplevel(-title => __('Selected scheme'));
@@ -785,7 +833,8 @@ sub menu_select_scheme {
my @scheme_order = schemes_ordered_for_presentation();
push @scheme_order, "scheme-custom";
my $selected = $vars{'selected_scheme'};
- $sw->Label(-text => __("Selected scheme"))->pack(-padx => "2m", -pady => "2m");
+ $sw->Label(-text => __("Selected scheme"))
+ ->pack(-padx => "2m", -pady => "2m");
my $f2 = $sw->Frame;
foreach my $scheme (@scheme_order) {
my $desc;
@@ -796,19 +845,24 @@ sub menu_select_scheme {
$desc = __("custom selection of collections");
}
my $b;
- $b = $f2->Radiobutton(-variable => \$selected, -value => $scheme,
+ $b = $f2->Radiobutton(
+ -variable => \$selected, -value => $scheme,
-text => __($desc),
- -justify => 'left', -wraplength => 500)->pack(-anchor => 'w', -pady => "1m");
+ -justify => 'left', -wraplength => 500)
+ ->pack(-anchor => 'w', -pady => "1m");
if ($selected eq $scheme) {
$b->focus();
}
}
$f2->pack;
my $f3 = $sw->Frame;
- my $okbutton = $f3->Button(-text => __("Ok"),
- -command => sub { callback_select_scheme($selected) ; $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m");
- my $cancelbutton = $f3->Button(-text => __("Cancel"),
- -command => sub { $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m");
+ my $okbutton = $f3->Button(
+ -text => __("Ok"),
+ -command => sub { callback_select_scheme($selected) ; $sw->destroy })
+ ->pack(-side => 'left', -padx => "2m", -pady => "2m");
+ my $cancelbutton = $f3->Button(
+ -text => __("Cancel"), -command => sub { $sw->destroy })
+ ->pack(-side => 'left', -padx => "2m", -pady => "2m");
$f3->pack(-expand => 'x');
$sw->bind('<Return>' => [ $okbutton, 'Invoke']);
$sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']);
@@ -825,18 +879,25 @@ sub menu_select_standard_collections {
my $f2 = $fb->Frame;
my $f3 = $fb->Frame;
my %lvars = %vars;
- $sw->Label(-text => __("Select the collections to be installed"))->pack(-padx => "2m", -pady => "2m");
+ $sw->Label(-text => __("Select the collections to be installed"))
+ ->pack(-padx => "2m", -pady => "2m");
my $onethirdcol = $#collections_std / 3;
my $twothirdcol = 2 * $onethirdcol;
my $i = 0;
foreach my $coll (sort @collections_std) {
my $tlpobj = $tlpdb->get_package("$coll");
if ($i < $onethirdcol) {
- $f1->Checkbutton(-variable => \$lvars{$coll}, -text => __($tlpobj->shortdesc))->pack(-anchor => 'w');
+ $f1->Checkbutton(
+ -variable => \$lvars{$coll}, -text => __($tlpobj->shortdesc))
+ ->pack(-anchor => 'w');
} elsif ($i < $twothirdcol) {
- $f2->Checkbutton(-variable => \$lvars{$coll}, -text => __($tlpobj->shortdesc))->pack(-anchor => 'w');
+ $f2->Checkbutton(
+ -variable => \$lvars{$coll}, -text => __($tlpobj->shortdesc))
+ ->pack(-anchor => 'w');
} else {
- $f3->Checkbutton(-variable => \$lvars{$coll}, -text => __($tlpobj->shortdesc))->pack(-anchor => 'w');
+ $f3->Checkbutton(
+ -variable => \$lvars{$coll}, -text => __($tlpobj->shortdesc))
+ ->pack(-anchor => 'w');
}
$i++;
}
@@ -845,10 +906,14 @@ sub menu_select_standard_collections {
$f3->pack(-side => 'left', -padx => "2m", -pady => "2m");
$fb->pack(-padx => "2m", -pady => "2m");
$fc->pack(-side => 'left', -expand => 'x', -padx => "2m", -pady => "2m");
- $fc->Button(-text => __("Select All"),
- -command => sub { select_collections(\%lvars, @collections_std) })->pack(-side => 'left', -padx => "2m", -pady => "2m")->focus();
- $fc->Button(-text => __("Deselect All"),
- -command => sub { deselect_collections(\%lvars, @collections_std) })->pack(-side => 'right', -padx => "2m", -pady => "2m");
+ $fc->Button(
+ -text => __("Select All"),
+ -command => sub { select_collections(\%lvars, @collections_std) })
+ ->pack(-side => 'left', -padx => "2m", -pady => "2m")->focus();
+ $fc->Button(
+ -text => __("Deselect All"),
+ -command => sub { deselect_collections(\%lvars, @collections_std) })
+ ->pack(-side => 'right', -padx => "2m", -pady => "2m");
$fd->pack(-side => 'left', -expand => 'x', -padx => "2m", -pady => "2m");
my $okbutton = $fd->Button(-text => __("Ok"),
-command => sub {
@@ -866,8 +931,9 @@ sub menu_select_standard_collections {
}
$sw->destroy;
})->pack(-side => 'left', -padx => "2m", -pady => "2m");
- my $cancelbutton = $fd->Button(-text => __("Cancel"),
- -command => sub { $sw->destroy })->pack(-side => 'right', -padx => "2m", -pady => "2m");
+ my $cancelbutton = $fd->Button(
+ -text => __("Cancel"), -command => sub { $sw->destroy })
+ ->pack(-side => 'right', -padx => "2m", -pady => "2m");
$sw->bind('<Return>' => [ $okbutton, 'Invoke']);
$sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']);
}
@@ -905,15 +971,15 @@ sub menu_select_symlink {
$vars{'option_path'} = $osym;
toggle_and_set_opt_variable(\$vars{'option_path'}, \$pathadjyesno);
}
- my $sw = $mainwindow->Toplevel(-title => __('Create symlinks in system directories'));
+ my $sw = $mainwindow->Toplevel(
+ -title => __('Create symlinks in system directories'));
$sw->transient($mainwindow);
$sw->grab();
- $sw->Checkbutton(-variable => \$osym,
- -text => __("create symlinks in standard directories"),
- -command => sub { set_unset_buttons(); } )->grid(-column => 1,
- -row => 1,
- -columnspan => 2,
- -padx => "2m");
+ $sw->Checkbutton(
+ -variable => \$osym,
+ -text => __("create symlinks in standard directories"),
+ -command => sub { set_unset_buttons(); } )
+ ->grid(-column => 1, -row => 1, -columnspan => 2, -padx => "2m");
$binlab = $sw->Label(-text => __("binaries to"));
$binb = $sw->Entry(-textvariable => \$lbin);
$manlab = $sw->Label(-text => __("manpages to"));
@@ -928,8 +994,9 @@ sub menu_select_symlink {
$infob->grid(-row => 4, -column => 2, -sticky => "ew", -padx => "2m");
set_unset_buttons();
my $f2 = $sw->Frame; $f2->grid(-column => 1, -columnspan => 2, -row => 5);
- my $okbutton = $f2->Button(-text => __("Ok"),
- -command => sub { return_callback(); $sw->destroy })->pack(-side => 'left');
+ my $okbutton = $f2->Button(
+ -text => __("Ok"), -command => sub { return_callback(); $sw->destroy })
+ ->pack(-side => 'left');
my $cancelbutton = $f2->Button(-text => __("Cancel"),
-command => sub { $sw->destroy })->pack(-side => 'right');
$sw->bind('<Return>' => [ $okbutton, 'Invoke']);
@@ -959,10 +1026,14 @@ sub menu_select_binsystems {
$f2l->pack(-side => 'left');
$f2->pack(-padx => "2m", -pady => "2m");
my $f3 = $sw->Frame;
- my $okbutton = $f3->Button(-text => __("Ok"),
- -command => sub { callback_select_systems() ; $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m");
- my $cancelbutton = $f3->Button(-text => __("Cancel"),
- -command => sub { $sw->destroy })->pack(-side => 'right', -padx => "2m", -pady => "2m");
+ my $okbutton = $f3->Button(
+ -text => __("Ok"),
+ -command => sub { callback_select_systems() ; $sw->destroy })
+ ->pack(-side => 'left', -padx => "2m", -pady => "2m");
+ my $cancelbutton = $f3->Button(
+ -text => __("Cancel"),
+ -command => sub { $sw->destroy })
+ ->pack(-side => 'right', -padx => "2m", -pady => "2m");
$f3->pack(-expand => 'x');
$sw->bind('<Return>' => [ $okbutton, 'Invoke']);
$sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']);
@@ -974,9 +1045,10 @@ sub check_on_removal {
if (!$vars{"binary_$a"} && $a eq $vars{'this_platform'}) {
# removal not supported
$vars{"binary_$a"} = 1;
- $arch_frame->Dialog(-title => __("Warning"),
- -text => __("Removals of the main platform not possible!"),
- -buttons => [ __("Ok") ])->Show;
+ $arch_frame->Dialog(
+ -title => __("Warning"),
+ -text => __("Removals of the main platform not possible!"),
+ -buttons => [ __("Ok") ])->Show;
}
}
@@ -1007,7 +1079,10 @@ sub menu_set_binbutton_text {
}
menu_set_text($bintextbutton, $selsys);
} else {
- menu_set_text($bintextbutton, __("%s out of %s", $vars{'n_systems_selected'}, $vars{'n_systems_available'}));
+ menu_set_text(
+ $bintextbutton, __(
+ "%s out of %s", $vars{'n_systems_selected'},
+ $vars{'n_systems_available'}));
}
}
}
@@ -1020,32 +1095,51 @@ sub menu_set_collections_text {
sub menu_set_pathes_text {
if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) {
- menu_set_text($texdirtext, native_slashify($vars{'TEXDIR'}), -foreground => "black");
+ menu_set_text(
+ $texdirtext, native_slashify($vars{'TEXDIR'}),
+ -foreground => "black");
} else {
- menu_set_text($texdirtext, __("(default not allowed or not writable - please change!)"), -foreground => "red");
+ menu_set_text(
+ $texdirtext,
+ __("(default not allowed or not writable - please change!)"),
+ -foreground => "red");
}
menu_set_text($texmflocaltext, native_slashify($vars{'TEXMFLOCAL'}));
if ((-w $vars{'TEXMFSYSVAR'}) || (-w dirname($vars{'TEXMFSYSVAR'}))) {
- menu_set_text($texmfsysvartext, native_slashify($vars{'TEXMFSYSVAR'}), -foreground => "black");
+ menu_set_text(
+ $texmfsysvartext, native_slashify($vars{'TEXMFSYSVAR'}),
+ -foreground => "black");
} elsif ("$vars{'TEXMFSYSVAR'}" =~ m;^$vars{'TEXDIR'};) {
if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) {
- menu_set_text($texmfsysvartext, native_slashify($vars{'TEXMFSYSVAR'}), -foreground => "black");
+ menu_set_text(
+ $texmfsysvartext, native_slashify($vars{'TEXMFSYSVAR'}),
+ -foreground => "black");
} else {
- menu_set_text($texmfsysvartext, __("(please change TEXDIR first!)"), -foreground => "red");
+ menu_set_text(
+ $texmfsysvartext, __("(please change TEXDIR first!)"),
+ -foreground => "red");
}
} else {
- menu_set_text($texmfsysvartext, __("(default not writable - please change!)"));
+ menu_set_text(
+ $texmfsysvartext, __("(default not writable - please change!)"));
}
if ((-w $vars{'TEXMFSYSCONFIG'}) || (-w dirname($vars{'TEXMFSYSCONFIG'}))) {
- menu_set_text($texmfsysconfigtext, native_slashify($vars{'TEXMFSYSCONFIG'}), -foreground => "black");
+ menu_set_text(
+ $texmfsysconfigtext, native_slashify($vars{'TEXMFSYSCONFIG'}),
+ -foreground => "black");
} elsif ("$vars{'TEXMFSYSCONFIG'}" =~ m;^$vars{'TEXDIR'};) {
if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) {
- menu_set_text($texmfsysconfigtext, native_slashify($vars{'TEXMFSYSCONFIG'}), -foreground => "black");
+ menu_set_text(
+ $texmfsysconfigtext, native_slashify($vars{'TEXMFSYSCONFIG'}),
+ -foreground => "black");
} else {
- menu_set_text($texmfsysconfigtext, __("(please change TEXDIR first!)"), -foreground => "red");
+ menu_set_text(
+ $texmfsysconfigtext, __("(please change TEXDIR first!)"),
+ -foreground => "red");
}
} else {
- menu_set_text($texmfsysconfigtext, __("(default not writable - please change!)"));
+ menu_set_text(
+ $texmfsysconfigtext, __("(default not writable - please change!)"));
}
menu_set_text($texmfhometext, native_slashify($vars{'TEXMFHOME'}));
}
@@ -1128,11 +1222,11 @@ sub callback_edit_var() {
menu_update_texts();
}
-sub dump_vars_stdout {
- foreach my $k (keys %vars) {
- print "DEBUG: vars{$k} = $vars{$k}\n";
- }
-}
+#sub dump_vars_stdout {
+# foreach my $k (keys %vars) {
+# print "DEBUG: vars{$k} = $vars{$k}\n";
+# }
+#}
sub toggle_portable {
my $td = $vars{'TEXDIR'};
@@ -1141,8 +1235,9 @@ sub toggle_portable {
$vars{'portable'} = 0;
$portableyesno = __('No');
# enable some buttons
- for $b ($tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) {
- $b->configure(-state => 'normal');
+ for $b (
+ $tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) {
+ $b->configure(-state => 'normal');
}
for $b ($pathbutton, $deskintbutton, $assocbutton, $adminbutton) {
$b->configure(-state => 'normal') if $b;
@@ -1151,8 +1246,9 @@ sub toggle_portable {
$vars{'portable'} = 1;
$portableyesno = __('Yes');
# disable some buttons. These should get a name first.
- for $b ($tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) {
- $b->configure(-state => 'disabled');
+ for $b (
+ $tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) {
+ $b->configure(-state => 'disabled');
}
$vars{'option_path'} = 0;
$vars{'option_desktop_integration'} = 0;
@@ -1169,18 +1265,24 @@ sub toggle_portable {
set_texlive_default_dirs(); # this sub tests for portable and in_place
$mw -> messageBox(
-title => __('Warning'),
- -message => __("Portable option changed;\nDirectories have been reinitialized"),
+ -message =>
+ __("Portable option changed;\nDirectories have been reinitialized"),
-type => 'OK', -icon => 'warning');
menu_set_pathes_text();
# same for some options
}
sub toggle_and_set_opt_variable {
+ # $varsref: the variable to be changed
+ # $toggleref: the string representation of the value of $varsref;
+ # $choicesref: array ref of possible values for $toggleref
my ($varsref, $toggleref, $choicesref) = @_;
- my ($no, $yes) = $choicesref ? @$choicesref : (__('No'), __('Yes'));
- $$toggleref = ($$toggleref eq $yes) ? $no : $yes;
- $$varsref = 0;
- $$varsref = 1 if ($$toggleref eq $yes);
+ $choicesref = \@::yesno unless defined $choicesref;
+
+ my $n_opts = @$choicesref;
+ $$varsref += 1;
+ $$varsref = 0 if $$varsref >= $n_opts;
+ $$toggleref = $$choicesref[$$varsref];
calc_depends();
menu_update_texts();
}