summaryrefslogtreecommitdiff
path: root/Master/texmf
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2012-05-09 02:29:09 +0000
committerNorbert Preining <preining@logic.at>2012-05-09 02:29:09 +0000
commit37c46addfbbc2675baf7acd2dc980ee47113694f (patch)
treeb57e71b9ff2519352344c1f662544b6522003316 /Master/texmf
parentda1af18b5cbb90d98f444257a675eefbe4f53b2f (diff)
when editing configurations, change color to red if a value was changed
git-svn-id: svn://tug.org/texlive/trunk@26268 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui.pl159
1 files changed, 104 insertions, 55 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui.pl
index da47d50f47c..44b1d06cfb2 100644
--- a/Master/texmf/scripts/texlive/tlmgrgui.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui.pl
@@ -8,10 +8,6 @@
# GUI for tlmgr
# version 2, completely rewritten GUI
#
-#
-# TODO FOR MULTI SUPPORT
-# - colorize the General config tab, if something is changed, show it in RED
-# that can actually applied to single repo tlmgrgui, too
# TODO: Fix return codes of execute_action sub items and execute_action
# so that we can give a decent warning window
# TODO: implement path adjustment also for Windows
@@ -102,6 +98,9 @@ my $menu_options;
my $menu_actions;
my $menu_help;
+# default color for background
+my $bgcolor;
+
#
# GUI elements
#
@@ -112,6 +111,8 @@ my $match_entry;
my $loaded_text;
my $loaded_text_button;
+my %settings_label;
+
#
# communication between filters and the rest
my $status_all = 0;
@@ -217,6 +218,8 @@ sub guimain {
info(__("Cannot load taxonomy file") . "\n");
}
do_rest_of_gui();
+ $bgcolor = $loaded_text->cget('-background');
+
setup_list();
update_grid();
@@ -1139,51 +1142,42 @@ sub do_general_settings {
-command => sub { transient_show_multiple_repos($location_button, @vals); });
}
+ $settings_label{'location'} = $location_button;
if ($mode_expert) {
push @config_set_l,
$back_config_set->Label(-text => __("Create formats on installation"), -anchor => "w");
- push @config_set_m,
- $back_config_set->Label(-textvariable => \$changeddefaults{"create_formats"}{'display'});
+ $settings_label{'create_formats'} = $back_config_set->Label(-textvariable => \$changeddefaults{"create_formats"}{'display'});
+ push @config_set_m, $settings_label{'create_formats'};
push @config_set_r,
$back_config_set->Button(-text => __("Toggle"),
-command => sub { toggle_setting("create_formats"); });
- push @config_set_l,
- $back_config_set->Label(-text => __("Install macro/font sources"), -anchor => "w");
- push @config_set_m,
- $back_config_set->Label(-textvariable => \$changeddefaults{"install_srcfiles"}{'display'});
+ push @config_set_l, $back_config_set->Label(-text => __("Install macro/font sources"), -anchor => "w");
+ $settings_label{'install_srcfiles'} = $back_config_set->Label(-textvariable => \$changeddefaults{"install_srcfiles"}{'display'});
+ push @config_set_m, $settings_label{'install_srcfiles'};
push @config_set_r,
$back_config_set->Button(-text => __("Toggle"),
-command => sub { toggle_setting("install_srcfiles"); });
- push @config_set_l,
- $back_config_set->Label(-text => __("Install macro/font docs"), -anchor => "w");
- push @config_set_m,
- $back_config_set->Label(-textvariable => \$changeddefaults{"install_docfiles"}{'display'});
+ push @config_set_l, $back_config_set->Label(-text => __("Install macro/font docs"), -anchor => "w");
+ $settings_label{'install_docfiles'} = $back_config_set->Label(-textvariable => \$changeddefaults{"install_docfiles"}{'display'});
+ push @config_set_m, $settings_label{'install_docfiles'};
push @config_set_r,
$back_config_set->Button(-text => __("Toggle"),
-command => sub { toggle_setting("install_docfiles"); });
- push @config_set_l,
- $back_config_set->Label(-text => __("Default backup directory"), -anchor => "w");
- push @config_set_m,
- $back_config_set->Label(-textvariable => \$changeddefaults{"backupdir"}{'display'});
+ push @config_set_l, $back_config_set->Label(-text => __("Default backup directory"), -anchor => "w");
+ $settings_label{'backupdir'} = $back_config_set->Label(-textvariable => \$changeddefaults{"backupdir"}{'display'});
+ push @config_set_m, $settings_label{'backupdir'};
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
- -command => sub {
- my $dir = $sw->chooseDirectory();
- if (defined($dir) && ($defaults{"backupdir"} ne $dir)) {
- # see warning concerning UTF8 or other encoded dir names!!
- $changeddefaults{"backupdir"}{'value'} = $dir;
- $changeddefaults{"backupdir"}{'display'} = $dir;
- }
- });
+ -command => sub { edit_dir_option ($sw, "backupdir"); });
push @config_set_l,
$back_config_set->Label(-text => __("Auto backup setting"), -anchor => "w");
- push @config_set_m,
- $back_config_set->Label(-textvariable => \$changeddefaults{"autobackup"}{'display'});
+ $settings_label{'autobackup'} = $back_config_set->Label(-textvariable => \$changeddefaults{"autobackup"}{'display'});
+ push @config_set_m, $settings_label{'autobackup'};
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
-command => sub { select_autobackup($sw); });
@@ -1191,34 +1185,34 @@ sub do_general_settings {
if (!win32()) {
push @config_set_l,
$back_config_set->Label(-text => __("Link destination for programs"), -anchor => "w");
- push @config_set_m,
- $back_config_set->Label(-textvariable => \$changeddefaults{"sys_bin"}{'display'});
+ $settings_label{'sys_bin'} = $back_config_set->Label(-textvariable => \$changeddefaults{"sys_bin"}{'display'});
+ push @config_set_m, $settings_label{'sys_bin'};
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
- -command => sub { edit_link_dir($sw, "sys_bin"); });
+ -command => sub { edit_dir_option ($sw, "sys_bin"); });
push @config_set_l,
$back_config_set->Label(-text => __("Link destination for info docs"), -anchor => "w");
- push @config_set_m,
- $back_config_set->Label(-textvariable => \$changeddefaults{"sys_info"}{'display'});
+ $settings_label{'sys_info'} = $back_config_set->Label(-textvariable => \$changeddefaults{"sys_info"}{'display'});
+ push @config_set_m, $settings_label{'sys_info'};
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
- -command => sub { edit_link_dir($sw, "sys_info"); });
+ -command => sub { edit_dir_option ($sw, "sys_info"); });
push @config_set_l,
$back_config_set->Label(-text => __("Link destination for man pages"), -anchor => "w");
- push @config_set_m,
- $back_config_set->Label(-textvariable => \$changeddefaults{"sys_man"}{'display'});
+ $settings_label{'sys_man'} = $back_config_set->Label(-textvariable => \$changeddefaults{"sys_man"}{'display'});
+ push @config_set_m, $settings_label{'sys_man'};
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
- -command => sub { edit_link_dir($sw, "sys_man"); });
+ -command => sub { edit_dir_option ($sw, "sys_man"); });
}
if (win32()) {
push @config_set_l,
$back_config_set->Label(-text => __("Create shortcuts in menu and on desktop"), -anchor => "w");
- push @config_set_m,
- $back_config_set->Label(-textvariable => \$changeddefaults{"desktop_integration"}{'display'});
+ $settings_label{'desktop_integration'} = $back_config_set->Label(-textvariable => \$changeddefaults{"desktop_integration"}{'display'});
+ push @config_set_m, $settings_label{'desktop_integration'};
push @config_set_r,
$back_config_set->Button(-text => __("Toggle"),
-command => sub { toggle_setting("desktop_integration"); });
@@ -1226,8 +1220,8 @@ sub do_general_settings {
if (admin()) {
push @config_set_l,
$back_config_set->Label(-text => __("Install for all users"), -anchor => "w");
- push @config_set_m,
- $back_config_set->Label(-textvariable => \$changeddefaults{"w32_multi_user"}{'display'});
+ $settings_label{'w32_multi_user'} = $back_config_set->Label(-textvariable => \$changeddefaults{"w32_multi_user"}{'display'});
+ push @config_set_m, $settings_label{'w32_multi_user'};
push @config_set_r,
$back_config_set->Button(-text => __("Toggle"),
-command => sub { toggle_setting("w32_multi_user"); });
@@ -1235,8 +1229,8 @@ sub do_general_settings {
push @config_set_l,
$back_config_set->Label(-text => __("Change file associations"), -anchor => "w");
- push @config_set_m,
- $back_config_set->Label(-textvariable => \$changeddefaults{'file_assocs'}{'display'});
+ $settings_label{'file_assocs'} = $back_config_set->Label(-textvariable => \$changeddefaults{'file_assocs'}{'display'});
+ push @config_set_m, $settings_label{'file_assocs'};
push @config_set_r,
$back_config_set->Button(-text => __("Change"),
-command => sub { select_file_assocs($sw); });
@@ -1355,6 +1349,7 @@ sub do_paper_settings {
}
$l{$p} = $back_config_pap->Label(-text => __("Default paper for") . " $p", -anchor => "w");
$m{$p} = $back_config_pap->Label(-textvariable => \$changedpaper{$p}, -anchor => "w");
+ $settings_label{$p} = $m{$p};
$r{$p} = $back_config_pap->Button(-text => __("Change"),
-command => sub { select_paper($sw,$p); }, -anchor => "w");
$l{$p}->grid( $m{$p}, $r{$p},
@@ -1662,6 +1657,7 @@ sub menu_multi_location {
}
}
}
+
if ($differs) {
# print "current repos:\n";
# for my $ref (@edit_repos) {
@@ -1678,12 +1674,13 @@ sub menu_multi_location {
$changeddefaults{'location'}{'display'} = __("multiple repositories");
} else {
$changeddefaults{'location'}{'display'} = $changeddefaults{'location'}{'value'};
- $location_button->configure(
- -command => undef);
}
} else {
# print "Nothing happend!\n";
}
+ $location_button->configure(-background =>
+ ($changeddefaults{'location'}{'value'} eq $defaults{'location'} ?
+ $bgcolor : 'red'));
$sw->destroy;
})->pack(-side => 'left',-padx => "2m", -pady => "2m");
my $cancelbutton = $f->Button(-text => __("Cancel"),
@@ -1701,6 +1698,13 @@ sub toggle_setting() {
my $new = ($old ? 0 : 1);
$changeddefaults{$key}{'display'} = ($new ? __("Yes") : __("No"));
$changeddefaults{$key}{'value'} = $new;
+ if (defined($settings_label{$key})) {
+ if ($defaults{$key} ne $changeddefaults{$key}{'value'}) {
+ $settings_label{$key}->configure(-background => 'red');
+ } else {
+ $settings_label{$key}->configure(-background => $bgcolor);
+ }
+ }
}
@@ -1720,9 +1724,13 @@ sub change_paper {
if ($prog eq "all") {
for my $k (keys %changedpaper) {
$changedpaper{$k} = $pap;
+ $settings_label{$k}->configure(-background =>
+ ($changedpaper{$k} eq $currentpaper{$k} ? $bgcolor : 'red'));
}
} else {
$changedpaper{$prog} = $pap;
+ $settings_label{$prog}->configure(-background =>
+ ($changedpaper{$prog} eq $currentpaper{$prog} ? $bgcolor : 'red'));
}
}
@@ -1751,7 +1759,8 @@ sub select_autobackup {
my $foo = $mw->Toplevel(-title => __("Auto backup setting"));
$foo->transient($mw);
$foo->grab();
- my $var = $defaults{"autobackup"};
+ #my $var = $defaults{"autobackup"};
+ my $var = $changeddefaults{"autobackup"}{'value'};
my $opt = $foo->BrowseEntry(-label => __("Auto backup setting"),
-variable => \$var);
my @al;
@@ -1770,6 +1779,9 @@ sub select_autobackup {
$var =~ s/ .*$//;
$changeddefaults{"autobackup"}{'value'} = $var;
$changeddefaults{"autobackup"}{'display'} = $var;
+ $settings_label{'autobackup'}->configure(
+ -background =>
+ ($var eq $defaults{"autobackup"} ? $bgcolor : 'red'));
$foo->destroy;
}
)->pack(-side => "left", -padx => "2m", -pady => "2m");
@@ -2418,17 +2430,17 @@ sub cb_handle_symlinks {
$tp->Label(-text => __("Link destination for programs"), @a_w)->grid(
$tp->Label(-textvariable => \$changeddefaults{"sys_bin"}{'display'}, @a_w),
$tp->Button(-text => __("Change"),
- -command => sub { edit_link_dir($sw, "sys_bin"); }),
+ -command => sub { edit_dir_option ($sw, "sys_bin"); }),
-sticky => 'w');
$tp->Label(-text => __("Link destination for info docs"), @a_w)->grid(
$tp->Label(-textvariable => \$changeddefaults{"sys_info"}{'display'}, @a_w),
$tp->Button(-text => __("Change"),
- -command => sub { edit_link_dir($sw, "sys_info"); }),
+ -command => sub { edit_dir_option ($sw, "sys_info"); }),
-sticky => 'w');
$tp->Label(-text => __("Link destination for man pages"), @a_w)->grid(
$tp->Label(-textvariable => \$changeddefaults{"sys_man"}{'display'}, @a_w),
$tp->Button(-text => __("Change"),
- -command => sub { edit_link_dir($sw, "sys_man"); }),
+ -command => sub { edit_dir_option ($sw, "sys_man"); }),
-sticky => 'w');
my $md = $sw->Frame;
@@ -2457,17 +2469,54 @@ sub cb_handle_symlinks {
-command => sub { $sw->destroy; })->pack(-side => 'left', -padx => "3m");
}
-sub edit_link_dir {
+sub edit_dir_option {
my $sw = shift;
my $what = shift;
- my $dir = $sw->chooseDirectory();
- if (defined($dir) && ($defaults{$what} ne $dir)) {
- # see warning concerning UTF8 or other encoded dir names!!
+ my $dir = cb_edit_string_or_dir($sw, $what, $changeddefaults{$what}{'value'});
+ if (defined($dir)) {
$changeddefaults{$what}{'value'} = $dir;
$changeddefaults{$what}{'display'} = $dir;
+ $settings_label{$what}->configure(
+ -background => ($defaults{$what} eq $dir ? $bgcolor : 'red'));
}
}
-
+
+sub cb_edit_string_or_dir {
+ my ($mw, $what, $cur) = @_;
+ my $done;
+ my $val;
+ my $sw = $mw->Toplevel(-title => __("Edit directory"));
+ $sw->transient($mw);
+ $sw->withdraw;
+ $sw->Label(-text => __("New value for") . " $what:")->pack(@p_ii);
+ my $entry = $sw->Entry(-text => $cur, -width => 30);
+ $entry->pack();
+ $sw->Button(-text => __("Choose Directory"),
+ -command => sub {
+ my $var = $sw->chooseDirectory();
+ if (defined($var)) {
+ $entry->delete(0,"end");
+ $entry->insert(0,$var);
+ }
+ })->pack;
+ my $f = $sw->Frame;
+ my $okbutton = $f->Button(-text => __("Ok"),
+ -command => sub { $val = $entry->get; $done = 1; })->pack(@left, @p_ii);
+ my $cancelbutton = $f->Button(-text => __("Cancel"),
+ -command => sub { $val = undef; $done = 1 })->pack(@right, @p_ii);
+ $f->pack(-expand => 1);
+ $sw->bind('<Return>', [ $okbutton, 'Invoke' ]);
+ $sw->bind('<Escape>', [ $cancelbutton, 'Invoke' ]);
+ my $old_focus = $sw->focusSave;
+ my $old_grab = $sw->grabSave;
+ $sw->Popup;
+ $sw->grab;
+ $sw->waitVariable(\$done);
+ $sw->grabRelease if Tk::Exists($sw);
+ $sw->destroy if Tk::Exists($sw);
+ return $val;
+}
+
sub cb_edit_location {
my $key = shift;
my $val;
@@ -2480,7 +2529,7 @@ sub cb_edit_location {
my $f1 = $sw->Frame;
$f1->Button(-text => __("Choose Directory"),
-command => sub {
- my $var = $sw->chooseDirectory;
+ my $var = $sw->chooseDirectory();
if (defined($var)) {
$entry->delete(0,"end");
$entry->insert(0,$var);