summaryrefslogtreecommitdiff
path: root/Master/texmf
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-08-31 18:06:56 +0000
committerNorbert Preining <preining@logic.at>2009-08-31 18:06:56 +0000
commita81f2111208e907ef38b4f76085899d2e93b0fa0 (patch)
tree1612322ba590a3275953e02c0f8eef9bf5139059 /Master/texmf
parent2e0c4bb1eff08d3034f952774b56bbe070e21529 (diff)
disable buttons if we cannot write the tlpdb
git-svn-id: svn://tug.org/texlive/trunk@14969 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl1
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl8
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl26
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl1
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl18
5 files changed, 47 insertions, 7 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl b/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl
index a2b2ea002ef..ed5b2ead841 100644
--- a/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl
@@ -192,6 +192,7 @@ sub do_listframe {
$f_buttonf_optionsf->pack;
foreach my $k (keys %$buttonsref) {
$f_buttonf->Button(-text => $buttonsref->{$k}{'-text'},
+ -state => $::action_button_state,
-command => sub { my @l = $f_listf_lb->curselection;
my @pl;
foreach my $i (@l) {
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl
index a97a69f61d0..4c683e7e36e 100644
--- a/Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl
@@ -58,8 +58,12 @@ sub init_archs {
$subframe->pack;
$arch_frame = $back_arch->Frame;
$arch_frame->pack(-padx => "10m", -pady => "5m");
- $arch_frame->Button(-text => __("Apply changes"), -command => sub { apply_changes(); })->pack(-side => 'left', -padx => "3m");
- $arch_frame->Button(-text => __("Reset changes"), -command => sub { init_archs(); })->pack(-side => 'left', -padx => "3m");
+ $arch_frame->Button(-text => __("Apply changes"),
+ -state => $::action_button_state,
+ -command => sub { apply_changes(); })->pack(-side => 'left', -padx => "3m");
+ $arch_frame->Button(-text => __("Reset changes"),
+ -state => $::action_button_state,
+ -command => sub { init_archs(); })->pack(-side => 'left', -padx => "3m");
}
sub check_on_removal {
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl
index beb650479a7..761f16d604e 100644
--- a/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl
@@ -42,7 +42,8 @@ push @config_set_l,
push @config_set_m,
$back_config_set->Label(-textvariable => \$defaults{"location"});
push @config_set_r,
- $back_config_set->Button(-text => __("Change"),
+ $back_config_set->Button(-text => __("Change"),
+ -state => $::action_button_state,
-command => sub { menu_default_location(); });
@@ -52,6 +53,7 @@ push @config_set_m,
$back_config_set->Label(-textvariable => \$defaults{"create_formats"});
push @config_set_r,
$back_config_set->Button(-text => __("Toggle"),
+ -state => $::action_button_state,
-command => sub { toggle_setting("create_formats"); });
push @config_set_l,
@@ -60,6 +62,7 @@ push @config_set_m,
$back_config_set->Label(-textvariable => \$defaults{"install_srcfiles"});
push @config_set_r,
$back_config_set->Button(-text => __("Toggle"),
+ -state => $::action_button_state,
-command => sub { toggle_setting("install_srcfiles"); });
push @config_set_l,
@@ -68,6 +71,7 @@ push @config_set_m,
$back_config_set->Label(-textvariable => \$defaults{"install_docfiles"});
push @config_set_r,
$back_config_set->Button(-text => __("Toggle"),
+ -state => $::action_button_state,
-command => sub { toggle_setting("install_docfiles"); });
push @config_set_l,
@@ -76,6 +80,7 @@ push @config_set_m,
$back_config_set->Label(-textvariable => \$defaults{"backupdir"});
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
+ -state => $::action_button_state,
-command => sub {
my $dir = $back_config->chooseDirectory();
if (defined($dir) && ($default_backupdir ne $dir)) {
@@ -92,7 +97,8 @@ 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");
+ -state => $::action_button_state,
+ -command => sub { select_autobackup($p); }, -anchor => "w");
if (!win32()) {
push @config_set_l,
@@ -101,6 +107,7 @@ if (!win32()) {
$back_config_set->Label(-textvariable => \$defaults{"sys_bin"});
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
+ -state => $::action_button_state,
-command => sub {
my $dir = $back_config->chooseDirectory();
if (defined($dir) && ($defaults{"sys_bin"} ne $dir)) {
@@ -117,6 +124,7 @@ if (!win32()) {
$back_config_set->Label(-textvariable => \$defaults{"sys_info"});
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
+ -state => $::action_button_state,
-command => sub {
my $dir = $back_config->chooseDirectory();
if (defined($dir) && ($defaults{"sys_info"} ne $dir)) {
@@ -133,6 +141,7 @@ if (!win32()) {
$back_config_set->Label(-textvariable => \$defaults{"sys_man"});
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
+ -state => $::action_button_state,
-command => sub {
my $dir = $back_config->chooseDirectory();
if (defined($dir) && ($defaults{"sys_man"} ne $dir)) {
@@ -151,6 +160,7 @@ if (win32()) {
$back_config_set->Label(-textvariable => \$defaults{"desktop_integration"});
push @config_set_r,
$back_config_set->Button(-text => __("Toggle"),
+ -state => $::action_button_state,
-command => sub { toggle_setting("desktop_integration"); });
if (admin()) {
@@ -160,6 +170,7 @@ if (win32()) {
$back_config_set->Label(-textvariable => \$defaults{"w32_multi_user"});
push @config_set_r,
$back_config_set->Button(-text => __("Toggle"),
+ -state => $::action_button_state,
-command => sub { toggle_setting("w32_multi_user"); });
}
@@ -169,6 +180,7 @@ if (win32()) {
$back_config_set->Label(-textvariable => \$defaults{'file_assocs'});
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
+ -state => $::action_button_state,
-command => sub { select_file_assocs($p); }, -anchor => "w");
}
@@ -188,8 +200,10 @@ my $back_config_pap = $lower->Labelframe(-text => __("Paper settings"));
my $back_config_pap_l1 = $back_config_pap->Label(-text => __("Default paper for all"), -anchor => "w");
my $back_config_pap_m1 = $back_config_pap->Button(-text => "A4",
+ -state => $::action_button_state,
-command => sub { change_paper("all", "a4"); });
my $back_config_pap_r1 = $back_config_pap->Button(-text => "letter",
+ -state => $::action_button_state,
-command => sub { change_paper("all", "letter"); });
$back_config_pap_l1->grid( $back_config_pap_m1, $back_config_pap_r1,
@@ -251,7 +265,8 @@ foreach my $p (sort keys %papers) {
$l{$p} = $back_config_pap->Label(-text => __("Default paper for") . " $p", -anchor => "w");
$m{$p} = $back_config_pap->Label(-textvariable => \$defaultpaper{$p}, -anchor => "w");
$r{$p} = $back_config_pap->Button(-text => __("Change"),
- -command => sub { select_paper($p); }, -anchor => "w");
+ -state => $::action_button_state,
+ -command => sub { select_paper($p); }, -anchor => "w");
$l{$p}->grid( $m{$p}, $r{$p},
-padx => "2m", -pady => "2m", -sticky => "nsw");
}
@@ -263,6 +278,7 @@ my $back_config_act = $lower->Labelframe(-text => __("Actions"));
$back_config_act->Button(-text => __("Re-initialize file database"),
+ -state => $::action_button_state,
-command => sub {
$mw->Busy(-recurse => 1);
info("Running mktexlsr, this may take some time ...\n");
@@ -271,6 +287,7 @@ $back_config_act->Button(-text => __("Re-initialize file database"),
})->pack(-expand => 1, -fill => "x",
-padx => "2m", -pady => "2m");
$back_config_act->Button(-text => __("Re-create all formats"),
+ -state => $::action_button_state,
-command => sub {
$mw->Busy(-recurse => 1);
info("Running fmtutil-sys --all, this may take some time ...\n");
@@ -279,6 +296,7 @@ $back_config_act->Button(-text => __("Re-create all formats"),
})->pack(-expand => 1, -fill => "x",
-padx => "2m", -pady => "2m");
$back_config_act->Button(-text => __("Update font map database"),
+ -state => $::action_button_state,
-command => sub {
$mw->Busy(-recurse => 1);
info("Running updmap-sys, this may take some time ...\n");
@@ -289,6 +307,7 @@ $back_config_act->Button(-text => __("Update font map database"),
if (!win32()) {
$back_config_act->Button(-text => __("Update symbolic links"),
+ -state => $::action_button_state,
-command => sub {
$mw->Busy(-recurse => 1);
info("Updating symlinks ...\n");
@@ -298,6 +317,7 @@ if (!win32()) {
-padx => "2m", -pady => "2m");
$back_config_act->Button(-text => __("Remove symbolic links"),
+ -state => $::action_button_state,
-command => sub {
$mw->Busy(-recurse => 1);
info("Removing symlinks ...\n");
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl
index dc0ad47cf70..1e881b3547a 100644
--- a/Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl
@@ -25,6 +25,7 @@ if ($^O=~/^MSWin(32|64)$/i) {
$f->pack(-padx => "10m", -pady => "5m");
my $ok = $f->Button(-text => __("Remove TeX Live 2009"),
+ -state => $::action_button_state,
-command => sub {
system("tlmgr", "uninstall", "--force");
$mw->Dialog(-text => __("Complete removal completed"), -buttons => [ __("Ok") ])->Show;
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl
index 2d6f7b86b03..720e45330f3 100755
--- a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl
@@ -102,6 +102,16 @@ push @update_function_list, \&check_location_on_ctan;
push @update_function_list, \&init_install_media;
push @update_function_list, \&create_update_list;
+#
+# check that we can actually save the database
+#
+if (check_on_writable()) {
+ $::we_can_save = 1;
+} else {
+ $::we_can_save = 0;
+ # here we should pop up a warning window!!!
+}
+$::action_button_state = ($::we_can_save ? "normal" : "disabled");
our $top = $mw->Frame;
@@ -222,6 +232,11 @@ info(__("Completed") . "\n");
$mw->deiconify;
+if (!$::we_can_write) {
+ my $no_write_warn = $mw->Dialog(-title => "warning",
+ -text => __("You don't have permissions to change the installation in any way.\nPlease contact the administrator or call this program as administrator.\n\nMost buttons will be disabled."),
+ -buttons => [ __("Ok") ])->Show();
+}
Tk::MainLoop();
@@ -518,8 +533,7 @@ sub execute_action_gui {
sub give_warning_window {
my ($act, @args) = @_;
my $sw = $mw->DialogBox(-title => __("Warning Window"), -buttons => [ __("Ok") ]);
- $sw->add("Label", -text => "Executing action $act on @args failed.
-Please consult the log window for details."
+ $sw->add("Label", -text => $act . "@args" . __(": failed.\nPlease consult the log window for details.")
)->pack(-padx => "3m", -pady => "3m");
$sw->Show;
}