summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2010-10-29 05:03:34 +0000
committerNorbert Preining <preining@logic.at>2010-10-29 05:03:34 +0000
commita1ae13adf97dd9cb943d9d3bb52300ebbbfe2025 (patch)
tree14bf5d80edbd4cbc98cdcac8af102b37b5c88643 /Master
parent909c5365c11d30f855cb78d0e2c777e41e5a86c3 (diff)
tlmgr gui:
- add support for searching taxonomies - don't change type of search if there is already a search string and we continue typing - show taxonomies on package details display git-svn-id: svn://tug.org/texlive/trunk@20244 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui.pl90
1 files changed, 84 insertions, 6 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui.pl
index 0046c0b6c51..f51be7f70cc 100644
--- a/Master/texmf/scripts/texlive/tlmgrgui.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui.pl
@@ -82,6 +82,7 @@ my @htype = qw/-relief ridge/;
# the list of packages as shown by TixGrid
#
my %Packages;
+my $taxonomy;
my $mw;
my $tlmgrrev;
my $menu;
@@ -111,6 +112,7 @@ my $show_collections = 1;
my $show_schemes = 1;
my $match_descriptions = 0;
my $match_filenames = 0;
+my $match_taxonomies = 0;
my $selection_value = 0;
@@ -194,6 +196,10 @@ sub guimain {
chomp($tlmgrrev);
setup_menu_system();
+ $taxonomy = load_taxonomy_datafile();
+ if (!defined($taxonomy)) {
+ info(__("Cannot load taxonomy file") . "\n");
+ }
do_rest_of_gui();
setup_list();
update_grid();
@@ -301,6 +307,10 @@ sub do_rest_of_gui {
$filter_match->Checkbutton(-text => __("descriptions"),
-command => \&update_grid,
-variable => \$match_descriptions)->pack(@a_w);
+ $filter_match->Checkbutton(-text => __("taxonomies"),
+ -command => \&update_grid,
+ -state => (defined($taxonomy) ? "normal" : "disabled"),
+ -variable => \$match_taxonomies)->pack(@a_w);
$filter_match->Checkbutton(-text => __("filenames"),
-command => \&update_grid,
-variable => \$match_filenames)->pack(@a_w);
@@ -309,13 +319,19 @@ sub do_rest_of_gui {
)->pack(@a_w, -padx => '2m', @x_x);
$match_entry->configure(-validate => 'key',
- -validatecommand => sub { my $new_val = shift;
+ -validatecommand => sub {
+ my ($new_val, undef, $old_val) = @_;
if (!$new_val) {
$match_descriptions = 0;
+ $match_taxonomies = 0;
$match_filenames = 0;
} else {
- $match_descriptions = 1;
- $match_filenames = 1;
+ # if something is already in the search field don't change selection
+ if (!$old_val) {
+ $match_descriptions = 1;
+ $match_taxonomies = 1 if (defined($taxonomy));
+ $match_filenames = 1;
+ }
}
update_grid(); return 1; });
@@ -346,6 +362,7 @@ sub do_rest_of_gui {
$show_schemes = 1;
$selection_value = 0;
$match_descriptions = 0;
+ $match_taxonomies = 0;
$match_filenames = 0;
update_grid();
})->pack(@x_x, @a_c);
@@ -652,6 +669,26 @@ sub show_extended_info {
$tf->Label(-text => $Packages{$p}{'remotecatalogueversion'}),
-sticky => "nw");
}
+ if (defined($Packages{$p}{'keyword'})) {
+ $tf->Label(-text => __("Keywords:"))->grid(
+ $tf->Label(-text => $Packages{$p}{'keyword'}),
+ -sticky => "nw");
+ }
+ if (defined($Packages{$p}{'functionality'})) {
+ $tf->Label(-text => __("Functionality:"))->grid(
+ $tf->Label(-text => $Packages{$p}{'functionality'}),
+ -sticky => "nw");
+ }
+ if (defined($Packages{$p}{'primary'})) {
+ $tf->Label(-text => __("Primary characterization:"))->grid(
+ $tf->Label(-text => $Packages{$p}{'primary'}),
+ -sticky => "nw");
+ }
+ if (defined($Packages{$p}{'secondary'})) {
+ $tf->Label(-text => __("Secondary characterization:"))->grid(
+ $tf->Label(-text => $Packages{$p}{'secondary'}),
+ -sticky => "nw");
+ }
if ($tlmediatlpdb) {
my @colls;
if ($tlp->category ne "Collection" && $tlp->category ne "Scheme") {
@@ -860,19 +897,29 @@ sub MatchesFilters {
# SPECIAL: If neiter description matching nor file name matching is
# selected, we do NOT do any checks at all. Somehow that is what
# feels right to me, but please correct me!
- if ($match_descriptions || $match_filenames) {
+ if ($match_descriptions || $match_taxonomies || $match_filenames) {
my $found = 0;
my $r = $match_entry->get;
+ if ($r eq "") {
+ return 0;
+ }
# check first for the default search type, the descriptions
if ($match_descriptions) {
- if ($Packages{$p}{'match_desc'} =~ m/$r/) {
+ if ($Packages{$p}{'match_desc'} =~ m/$r/i) {
$found = 1;
}
}
+ if (!$found) {
+ if ($match_taxonomies) {
+ if ($Packages{$p}{'taxonomy'} =~ m/$r/i) {
+ $found = 1;
+ }
+ }
+ }
# if we already dound, don't check the next condition!
if (!$found) {
if ($match_filenames) {
- if ($Packages{$p}{'match_files'} =~ m/$r/) {
+ if ($Packages{$p}{'match_files'} =~ m/$r/i) {
$found = 1;
}
}
@@ -1625,6 +1672,37 @@ sub populate_Packages {
$Packages{$p}{'match_desc'} .= ($tlp->shortdesc || "");
$Packages{$p}{'match_desc'} .= "\n";
$Packages{$p}{'match_desc'} .= ($tlp->longdesc || "");
+ #
+ # taxonomy matching
+ if (defined($taxonomy)) {
+ $Packages{$p}{'taxonomy'} = "";
+ if (defined($taxonomy->{'by-package'}{'keyword'}{$p})) {
+ $Packages{$p}{'keyword'} =
+ join(", ", @{$taxonomy->{'by-package'}{'keyword'}{$p}});
+ $Packages{$p}{'taxonomy'} .=
+ join('\n', @{$taxonomy->{'by-package'}{'keyword'}{$p}});
+ $Packages{$p}{'taxonomy'} .= '\n';
+ }
+ if (defined($taxonomy->{'by-package'}{'functionality'}{$p})) {
+ $Packages{$p}{'functionality'} =
+ join(' > ', @{$taxonomy->{'by-package'}{'functionality'}{$p}});
+ $Packages{$p}{'taxonomy'} .=
+ join('\n', @{$taxonomy->{'by-package'}{'functionality'}{$p}});
+ $Packages{$p}{'taxonomy'} .= '\n';
+ }
+ if (defined($taxonomy->{'by-package'}{'primary'}{$p})) {
+ $Packages{$p}{'primary'} = $taxonomy->{'by-package'}{'primary'}{$p};
+ $Packages{$p}{'taxonomy'} .= $taxonomy->{'by-package'}{'primary'}{$p};
+ $Packages{$p}{'taxonomy'} .= "\n";
+ }
+ if (defined($taxonomy->{'by-package'}{'secondary'}{$p})) {
+ $Packages{$p}{'secondary'} = $taxonomy->{'by-package'}{'secondary'}{$p};
+ $Packages{$p}{'taxonomy'} .= $taxonomy->{'by-package'}{'secondary'}{$p};
+ $Packages{$p}{'taxonomy'} .= "\n";
+ }
+ }
+ #
+ # file matching
my @all_f = $tlp->all_files;
if ($tlp->relocated) { for (@all_f) { s:^$RelocPrefix/:$RelocTree/:; } }
$Packages{$p}{'match_files'} = "@all_f";