diff options
Diffstat (limited to 'Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl')
-rw-r--r-- | Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl | 164 |
1 files changed, 108 insertions, 56 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl index bc910bad907..c5746ac7954 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl @@ -10,42 +10,49 @@ our $back_config = $back->add("config",-label => ___"config"); $screens{"config"} = $back_config; -my $default_location = $localtlpdb->option_location; -my $default_formats = ($localtlpdb->option_create_formats ? ___"yes" : ___"no"); -my $default_docfiles = ($localtlpdb->option_install_docfiles ? ___"yes" : ___"no"); -my $default_srcfiles = ($localtlpdb->option_install_srcfiles ? ___"yes" : ___"no"); -my $default_backupdir = $localtlpdb->option("backupdir"); -my $default_autobackup = $localtlpdb->option("autobackup"); +my %defaults; +for my $key (keys %TeXLive::TLConfig::TLPDBOptionTlmgrName) { + if ($TeXLive::TLConfig::TLPDBOptionType{$key} eq "b") { + $defaults{$key} = ($localtlpdb->option($key) ? ___"yes" : ___"no"); + } else { + $defaults{$key} = $localtlpdb->option($key); + } +} # this will be loaded only on unix systems! # +my @config_set_l; +my @config_set_m; +my @config_set_r; my $back_config_set = $back_config->Labelframe(-text => ___"defaultsettings"); $back_config_set->pack(-fill => "both", -padx => "2m", -pady => "2m"); -my $back_config_set_l1 = $back_config_set->Label(-text => ___"defaultsource", -anchor => "w"); -my $back_config_set_m1 = $back_config_set->Label(-textvariable => \$default_location); -my $back_config_set_r1 = $back_config_set->Button(-text => ___"change", +push @config_set_l, + $back_config_set->Label(-text => ___"defaultsource", -anchor => "w"); +push @config_set_m, + $back_config_set->Label(-textvariable => \$defaults{"location"}); +push @config_set_r, + $back_config_set->Button(-text => ___"change", -command => sub { menu_default_location(); }); -my $back_config_set_l2 = $back_config_set->Label(-text => ___"createformats", -anchor => "w"); -my $back_config_set_m2 = $back_config_set->Label(-textvariable => \$default_formats); -my $back_config_set_r2 = $back_config_set->Button(-text => ___"toggle", - -command => sub { toggle_setting("formats"); }); -my $back_config_set_l3 = $back_config_set->Label(-text => ___"installdoc", -anchor => "w"); -my $back_config_set_m3 = $back_config_set->Label(-textvariable => \$default_docfiles); -my $back_config_set_r3 = $back_config_set->Button(-text => ___"toggle", - -command => sub { toggle_setting("docfiles"); }); - -my $back_config_set_l4 = $back_config_set->Label(-text => ___"installsrc", -anchor => "w"); -my $back_config_set_m4 = $back_config_set->Label(-textvariable => \$default_srcfiles); -my $back_config_set_r4 = $back_config_set->Button(-text => ___"toggle", - -command => sub { toggle_setting("srcfiles"); }); +for my $key (qw/create_formats install_docfiles install_srcfiles/) { + push @config_set_l, + $back_config_set->Label(-text => ___($key), -anchor => "w"); + push @config_set_m, + $back_config_set->Label(-textvariable => \$defaults{$key}); + push @config_set_r, + $back_config_set->Button(-text => ___"toggle", + -command => sub { toggle_setting($key); }); +} -my $back_config_set_l5 = $back_config_set->Label(-text => ___"backupdir", -anchor => "w"); -my $back_config_set_m5 = $back_config_set->Label(-textvariable => \$default_backupdir); -my $back_config_set_r5 = $back_config_set->Button(-text => ___"change", +push @config_set_l, + $back_config_set->Label(-text => ___"backupdir", -anchor => "w"); +push @config_set_m, + $back_config_set->Label(-textvariable => \$defaults{"backupdir"}); +push @config_set_r, + $back_config_set->Button(-text => ___"change", -command => sub { my $dir = $back_config->chooseDirectory(); if (defined($dir) && ($default_backupdir ne $dir)) { @@ -56,23 +63,58 @@ my $back_config_set_r5 = $back_config_set->Button(-text => ___"change", } }); -my $back_config_set_l6 = $back_config_set->Label(-text => ___"autobackup", -anchor => "w"); -my $back_config_set_m6 = $back_config_set->Label(-textvariable => \$default_autobackup); -my $back_config_set_r6 = $back_config_set->Button(-text => ___"change", +push @config_set_l, + $back_config_set->Label(-text => ___"autobackup", -anchor => "w"); +push @config_set_m, + $back_config_set->Label(-textvariable => \$defaults{"autobackup"}); +push @config_set_r, + $back_config_set->Button(-text => ___"change", -command => sub { select_autobackup($p); }, -anchor => "w"); -$back_config_set_l1->grid( $back_config_set_m1, $back_config_set_r1, - -padx => "2m", -pady => "2m", -sticky => "nwe"); -$back_config_set_l2->grid( $back_config_set_m2, $back_config_set_r2, - -padx => "2m", -pady => "2m", -sticky => "nwe"); -$back_config_set_l3->grid( $back_config_set_m3, $back_config_set_r3, - -padx => "2m", -pady => "2m", -sticky => "nwe"); -$back_config_set_l4->grid( $back_config_set_m4, $back_config_set_r4, - -padx => "2m", -pady => "2m", -sticky => "nwe"); -$back_config_set_l5->grid( $back_config_set_m5, $back_config_set_r5, - -padx => "2m", -pady => "2m", -sticky => "nwe"); -$back_config_set_l6->grid( $back_config_set_m6, $back_config_set_r6, - -padx => "2m", -pady => "2m", -sticky => "nwe"); +if (!win32()) { + for my $key (qw/sys_bin sys_info sys_man/) { + push @config_set_l, + $back_config_set->Label(-text => ___($key), -anchor => "w"); + push @config_set_m, + $back_config_set->Label(-textvariable => \$defaults{$key}); + push @config_set_r, + $back_config_set->Button(-text => ___"change", + -command => sub { + my $dir = $back_config->chooseDirectory(); + if (defined($dir) && ($defaults{$key} ne $dir)) { + # see warning concerning UTF8 or other encoded dir names!! + $localtlpdb->option($key, $dir); + $defaults{$key} = $dir; + $localtlpdb->save; + } + }); + } +} + +if (win32()) { + for my $key (qw/desktop_integration file_assocs w32_multi_user/) { + push @config_set_l, + $back_config_set->Label(-text => ___($key), -anchor => "w"); + push @config_set_m, + $back_config_set->Label(-textvariable => \$defaults{$key}); + push @config_set_r, + $back_config_set->Button(-text => ___"change", + -command => sub { + my $dir = $back_config->chooseDirectory(); + if (defined($dir) && ($defaults{$key} ne $dir)) { + # see warning concerning UTF8 or other encoded dir names!! + $localtlpdb->option($key, $dir); + $defaults{$key} = $dir; + $localtlpdb->save; + } + }); + } +} + +for my $i (0..$#config_set_l) { + $config_set_l[$i]->grid( $config_set_m[$i], $config_set_r[$i], + -padx => "1m", -pady => "1m", -sticky => "nwe"); +} ############# @@ -183,6 +225,26 @@ $back_config_act->Button(-text => ___"updatemaps", })->pack(-expand => 1, -fill => "x", -padx => "2m", -pady => "2m"); +if (!win32()) { + $back_config_act->Button(-text => ___"updatesymlinks", + -command => sub { + $mw->Busy(-recurse => 1); + info("Updating symlinks ...\n"); + $localtlmedia->add_symlinks(); + $mw->Unbusy; + })->pack(-expand => 1, -fill => "x", + -padx => "2m", -pady => "2m"); + + $back_config_act->Button(-text => ___"removesymlinks", + -command => sub { + $mw->Busy(-recurse => 1); + info("Updating symlinks ...\n"); + $localtlmedia->remove_symlinks(); + $mw->Unbusy; + })->pack(-expand => 1, -fill => "x", + -padx => "2m", -pady => "2m"); +} + $back_config_act->pack(-side => 'right', -fill => "both", -padx => "2m", -pady => "2m", -expand => 1, -ipadx => "2m", -ipady => "2m"); @@ -218,7 +280,7 @@ sub menu_default_location { my $f = $sw->Frame; my $okbutton = $f->Button(-text => ___"ok", -command => sub { $default_location = $entry->get; - $localtlpdb->option_location($default_location); + $localtlpdb->option("location", $default_location); $localtlpdb->save; $sw->destroy })->pack(-side => 'left',-padx => "2m", -pady => "2m"); my $cancelbutton = $f->Button(-text => ___"cancel", @@ -230,19 +292,9 @@ sub menu_default_location { sub toggle_setting() { my ($key) = @_; - if ($key eq "formats") { - my $new = ($localtlpdb->option_create_formats ? 0 : 1); - $localtlpdb->option_create_formats($new); - $default_formats = ($new ? ___"yes" : ___"no"); - } elsif ($key eq "srcfiles") { - my $new = ($localtlpdb->option_install_srcfiles ? 0 : 1); - $localtlpdb->option_install_srcfiles($new); - $default_srcfiles = ($new ? ___"yes" : ___"no"); - } elsif ($key eq "docfiles") { - my $new = ($localtlpdb->option_install_docfiles ? 0 : 1); - $localtlpdb->option_install_docfiles($new); - $default_docfiles = ($new ? ___"yes" : ___"no"); - } + my $new = ($localtlpdb->option($key) ? 0 : 1); + $localtlpdb->option($key, $new); + $defaults{$key} = ($new ? ___"yes" : ___"no"); $localtlpdb->save; } @@ -281,7 +333,7 @@ sub select_autobackup { my $foo = $back_config->Toplevel(-title => ___"autobackup"); $foo->transient($mw); $foo->grab(); - my $var = $default_autobackup; + my $var = $defaults{"autobackup"}; my $opt = $foo->BrowseEntry(-label => ___"autobackup", -variable => \$var); my @al; @@ -299,7 +351,7 @@ sub select_autobackup { -command => sub { $var =~ s/ .*$//; $localtlpdb->option("autobackup", $var); - $default_autobackup = $var; + $defaults{"autobackup"} = $var; $localtlpdb->save; $foo->destroy; } |