summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-05-03 14:41:01 +0000
committerNorbert Preining <preining@logic.at>2008-05-03 14:41:01 +0000
commit24269c7193b55a79ac840754ff239c7f87acfd00 (patch)
treef31d647a1b361a1c8e56b1b0ee8284aaccc5bf65 /Master
parent393d6d06e24b64afbfd69018124b4bab980999ea (diff)
working version ...
git-svn-id: svn://tug.org/texlive/trunk@7821 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/guinb1.pl41
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/guinb1.tcl84
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/guinb2.pl46
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/guinb2.tcl70
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl78
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.tcl24
6 files changed, 118 insertions, 225 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/guinb1.pl b/Master/texmf/scripts/texlive/tlmgrgui/guinb1.pl
index 674a2268735..9e2420e0ed8 100644
--- a/Master/texmf/scripts/texlive/tlmgrgui/guinb1.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui/guinb1.pl
@@ -55,10 +55,11 @@ our $back_f1_f21_f_l = $back_f1_f21_f->Label(-text => "Search");
# return 1
# }
our $back_f1_f21_f_e = $back_f1_f21_f->Entry(
- -validate => "key", -validatecommand => sub { print "TO BE DONE\n"; });
+ -validate => "key",
+ -validatecommand => sub { validate_search_input($back_f1_f21_lb, $back_f1_f33_t, $_[0], @allpackages); });
# button .back.f1.f21.f.b -text "Next" -command {}
our $back_f1_f21_f_b = $back_f1_f21_f->Button(-text => "Next",
- -command => sub { print "TO BE DONE\n"; });
+ -command => sub { find_next_search_match($back_f1_f21_lb, $back_f1_f21_f_e, $back_f1_f33_t, @allpackages); });
# pack .back.f1.f21.f.l .back.f1.f21.f.e .back.f1.f21.f.b \
# -anchor w -side left -padx 1m -pady 1m
$back_f1_f21_f_l->pack(-anchor => "w", -side => "left", -padx => "1m", -pady => "1m");
@@ -77,18 +78,7 @@ $back_f1_f21_lb = $back_f1_f21->Listbox(-width => 30, -height => 24,
-yscrollcommand => sub { $back_f1_f21_scry->set(@_); },
-xscrollcommand => sub { $back_f1_f21_scrx->set(@_); } );
$back_f1_f21_lb->bind('<<ListboxSelect>>',
- sub { my @selind = $back_f1_f21_lb->curselection;
- return if (!@selind);
- my $pkgname = $allpackages[$selind[0]];
- $pkgname =~ s/^\s*(\(i\) )?//;
- my $tlp = $tlmediatlpdb->get_package($pkgname);
- my $longdesc = $tlmediatlpdb->get_package($pkgname)->longdesc;
- my $shortdesc = $tlmediatlpdb->get_package($pkgname)->shortdesc;
- $longdesc || $longdesc = "(no short description available)";
- $shortdesc || $shortdesc = "(no long description available)";
- $back_f1_f33_t->delete("0.0", "end");
- $back_f1_f33_t->insert("0.0", "$shortdesc\n\n$longdesc");
- });
+ sub { update_info_window ($back_f1_f21_lb, $back_f1_f33_t, @allpackages); });
# scrollbar .back.f1.f21.scrx -command ".back.f1.f21.lb xview" -orient horizontal
$back_f1_f21_scrx = $back_f1_f21->Scrollbar(
-command => sub { $back_f1_f21_lb->xview(@_); }, -orient => "horizontal");
@@ -112,12 +102,19 @@ $back_f1_f22->grid(-row => 2, -column => 2, -rowspan =>2,
-sticky => "nswe", -pady => "1m");
## Buttons
-# button .back.f1.f22.b1 -text "Search" -command {}
-our $back_f1_f22_b1 = $back_f1_f22->Button(-text => "Search");
-# button .back.f1.f22.b2 -text "Install" -command {}
-our $back_f1_f22_b2 = $back_f1_f22->Button(-text => "Install");
-# button .back.f1.f22.b3 -text "Info" -command {}
-our $back_f1_f22_b3 = $back_f1_f22->Button(-text => "Info");
+# button .back.f1.f22.b1 -text "Install" -command {}
+our $back_f1_f22_b1 = $back_f1_f22->Button(-text => "Install",
+ -command => sub { my @l = $back_f1_f21_lb->curselection;
+ my @pl;
+ foreach my $i (@l) {
+ my $foo = $allpackages[$i];
+ $foo =~ s/^\s*(\(i\) )?//;
+ push @pl, $foo;
+ }
+ install_selected_packages(@pl); });
+# button .back.f1.f22.b2 -text "Info" -command {}
+our $back_f1_f22_b2 = $back_f1_f22->Button(-text => "Quit",
+ -command => sub { $mw->destroy; exit(0); });
# pack .back.f1.f22.b1 .back.f1.f22.b2 .back.f1.f22.b3 \
# -side top -anchor center -padx 2m -pady 2m
@@ -125,13 +122,11 @@ $back_f1_f22_b1->pack(-side => "top", -anchor => "center",
-padx => "2m", -pady => "2m");
$back_f1_f22_b2->pack(-side => "top", -anchor => "center",
-padx => "2m", -pady => "2m");
-$back_f1_f22_b3->pack(-side => "top", -anchor => "center",
- -padx => "2m", -pady => "2m");
######################## row 2 col 3
## CD-ROM
# labelframe .back.f1.f23 -text "CD/DVD"
-our $back_f1_f23 = $back_f1->Labelframe(-text => "Location");
+our $back_f1_f23 = $back_f1->Labelframe(-text => "Installation Source");
# grid .back.f1.f23 -row 2 -column 3 -sticky nswe -padx 2m -pady 1m
$back_f1_f23->grid(-row => 2, -column => 3, -sticky => "nswe",
-padx => "2m", -pady => "1m");
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/guinb1.tcl b/Master/texmf/scripts/texlive/tlmgrgui/guinb1.tcl
deleted file mode 100644
index 66fbde6431f..00000000000
--- a/Master/texmf/scripts/texlive/tlmgrgui/guinb1.tcl
+++ /dev/null
@@ -1,84 +0,0 @@
-# -*-Tcl-*-
-### TL install packages
-## 2005-2008 Tomasz Luczak tlu@technodat.com.pl
-# $Id$
-####################################### GUI add packages
-frame .back.f1
-####################### row 1
-
-frame .back.f1.f1 -relief ridge -borderwidth 2
-label .back.f1.f1.l -text "Adding packages" \
- -foreground blue -font {helvetica 10 bold}
-label .back.f1.f1.l1 -text "Use Ctrl or Shift or drag to select more"
-grid .back.f1.f1 -row 1 -column 1 -columnspan 3 -padx 2m -pady 2m -sticky nwe
-pack .back.f1.f1.l .back.f1.f1.l1 -side top
-
-####################### row 2 col 1
-# listbox: packages
-labelframe .back.f1.f21 -text "Select packages to install"
-grid .back.f1.f21 -row 2 -column 1 -rowspan 2 \
- -sticky nswe -padx 2m -pady 1m
-# search field
-frame .back.f1.f21.f
-pack .back.f1.f21.f -pady 1m
-label .back.f1.f21.f.l -text "Search"
-entry .back.f1.f21.f.e -validate key -validatecommand {
- set searchListAdd [.back.f1.f21.lb get 0 end]
- set listPositionAdd [lsearch $searchListAdd " %P*"]
- if {$listPositionAdd ne -1} then {
- .back.f1.f21.lb yview $listPositionAdd
- .back.f1.f21.lb selection set $listPositionAdd
- }
- return 1
-}
-button .back.f1.f21.f.b -text "Next" -command {}
-pack .back.f1.f21.f.l .back.f1.f21.f.e .back.f1.f21.f.b \
- -anchor w -side left -padx 1m -pady 1m
-
-listbox .back.f1.f21.lb -width 40 -height 24 \
- -selectmode extended \
- -yscrollcommand ".back.f1.f21.scry set" \
- -xscrollcommand ".back.f1.f21.scrx set"
-scrollbar .back.f1.f21.scrx -command ".back.f1.f21.lb xview" -orient horizontal
-scrollbar .back.f1.f21.scry -command ".back.f1.f21.lb yview" -orient vertical
-pack .back.f1.f21.scrx -side bottom -fill x
-pack .back.f1.f21.scry -side right -fill y
-pack .back.f1.f21.lb -fill y -expand 1
-###################### row2 col 2
-# Buttons
-labelframe .back.f1.f22 -text "Buttons"
-grid .back.f1.f22 -row 2 -column 2 -rowspan 2 \
- -sticky nswe -pady 1m
-
-## Buttons
-button .back.f1.f22.b1 -text "Search" -command {}
-button .back.f1.f22.b2 -text "Install" -command {}
-button .back.f1.f22.b3 -text "Info" -command {}
-
-pack .back.f1.f22.b1 .back.f1.f22.b2 .back.f1.f22.b3 \
- -side top -anchor center -padx 2m -pady 2m
-
-######################## row 2 col 3
-## CD-ROM
-labelframe .back.f1.f23 -text "CD/DVD"
-grid .back.f1.f23 -row 2 -column 3 -sticky nswe -padx 2m -pady 1m
-
-## CD-ROM
-button .back.f1.f23.b -text "CD/DVD" -command {}
-label .back.f1.f23.l -width 30 -textvariable dircd -relief sunken -anchor w
-pack .back.f1.f23.b -side left -padx 2m -pady 2m
-pack .back.f1.f23.l -side left -padx 2m -pady 2m -expand 1 -fill x
-
-####################### row 3 col 3
-## text: info
-labelframe .back.f1.f33 -text "Info on the selected item"
-grid .back.f1.f33 -row 3 -column 3 -sticky nswe -padx 2m -pady 1m
-
-text .back.f1.f33.t -width 65 -wrap word \
- -yscrollcommand ".back.f1.f33.scry set"
-.back.f1.f33.t insert end "\nAttention. Please check if a CD drive with the TeX Live CD\n is properly selected.\n\nFirst fill in the list using the \"Search\" button, then select an item and click the \"Install\" or \"Info\" button."
-scrollbar .back.f1.f33.scry -command ".back.f1.f33.t yview" -orient vertical
-pack .back.f1.f33.scry -side right -fill y
-pack .back.f1.f33.t -expand 1 -fill y
-
-# EOF
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/guinb2.pl b/Master/texmf/scripts/texlive/tlmgrgui/guinb2.pl
index 6a229852dab..85a8cbcce79 100644
--- a/Master/texmf/scripts/texlive/tlmgrgui/guinb2.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui/guinb2.pl
@@ -52,10 +52,11 @@ our $back_f2_f21_f_l = $back_f2_f21_f->Label(-text => "Search");
# return 1
# }
our $back_f2_f21_f_e = $back_f2_f21_f->Entry(
- -validate => "key", -validatecommand => sub { } );
+ -validate => "key",
+ -validatecommand => sub { validate_search_input($back_f2_f21_lb, $back_f2_f23_t, $_[0], @alllocalpackages); } );
# button .back.f2.f21.f.b -text "Next" -command {}
our $back_f2_f21_f_b = $back_f2_f21_f->Button(-text => "Next",
- -command => sub {});
+ -command => sub { find_next_search_match($back_f2_f21_lb, $back_f2_f21_f_e, $back_f2_f23_t, @alllocalpackages); });
# pack .back.f2.f21.f.l .back.f2.f21.f.e .back.f2.f21.f.b -anchor w -side left -padx 1m -pady 1m
$back_f2_f21_f_l->pack(-anchor => "w", -side => "left",
-padx => "1m", -pady => "1m");
@@ -76,19 +77,7 @@ our $back_f2_f21_lb = $back_f2_f21->Listbox(-width => 30, -height => 24,
-yscrollcommand => sub { $back_f2_f21_scry->set(@_); },
-xscrollcommand => sub { $back_f2_f21_scrx->set(@_); });
$back_f2_f21_lb->bind('<<ListboxSelect>>',
- sub { my @selind = $back_f2_f21_lb->curselection;
- return if (!@selind);
- my $pkgname = $allpackages[$selind[0]];
- $pkgname =~ s/^\s*(\(i\) )?//;
- my $tlp = $tlmediatlpdb->get_package($pkgname);
- $longdesc = $tlmediatlpdb->get_package($pkgname)->longdesc;
- $back_f2_f23_t->delete("0.0", "end");
- if (defined($longdesc)) {
- $back_f2_f23_t->insert("0.0", "$longdesc");
- } else {
- $back_f2_f23_t->insert("0.0", "");
- }
- });
+ sub { update_info_window ($back_f2_f21_lb, $back_f2_f23_t, @alllocalpackages); });
# scrollbar .back.f2.f21.scrx -command ".back.f2.f21.lb xview" -orient horizontal
$back_f2_f21_scrx = $back_f2_f21->Scrollbar(
-command => sub { $back_f2_f21_lb->xview(@_); }, -orient => "horizontal");
@@ -109,18 +98,24 @@ our $back_f2_f22 = $back_f2->Labelframe(-text => "Buttons");
# grid .back.f2.f22 -row 2 -column 2 -sticky nswe -pady 1m
$back_f2_f22->grid(-row => 2, -column => 2, -sticky => "nswe", -pady => "1m");
-# button .back.f2.f22.b1 -text "Search" -command {}
-our $back_f2_f22_b1 = $back_f2_f22->Button(-text => "Search", -command => sub {});
-# button .back.f2.f22.b2 -text "Remove" -command {}
-our $back_f2_f22_b2 = $back_f2_f22->Button(-text => "Remove", -command => sub {});
-# button .back.f2.f22.b3 -text "Info" -command {}
-our $back_f2_f22_b3 = $back_f2_f22->Button(-text => "Info", -command => sub {});
+# button .back.f2.f22.b1 -text "Remove" -command {}
+our $back_f2_f22_b1 = $back_f2_f22->Button(-text => "Remove",
+ -command => sub { my @l = $back_f2_f21_lb->curselection;
+ my @pl;
+ foreach my $i (@l) {
+ my $foo = $alllocalpackages[$i];
+ $foo =~ s/^\s*(\(i\) )?//;
+ push @pl, $foo;
+ }
+ remove_selected_packages(@pl); });
+# button .back.f2.f22.b2 -text "Quit" -command {}
+our $back_f2_f22_b2 = $back_f2_f22->Button(-text => "Quit",
+ -command => sub { $mw->destroy; exit(0); });
# pack .back.f2.f22.b1 .back.f2.f22.b2 .back.f2.f22.b3 \
# -side top -anchor center -padx 2m -pady 2m
$back_f2_f22_b1->pack(-side => "top", -anchor => "center", -padx => "2m", -pady => "2m");
$back_f2_f22_b2->pack(-side => "top", -anchor => "center", -padx => "2m", -pady => "2m");
-$back_f2_f22_b3->pack(-side => "top", -anchor => "center", -padx => "2m", -pady => "2m");
####################### row 2 col 3
# text: info
@@ -147,4 +142,9 @@ $back_f2_f23_t->pack(-expand => 1, -fill => "both");
# EOF
-
+### Local Variables:
+### perl-indent-level: 2
+### tab-width: 2
+### indent-tabs-mode: nil
+### End:
+# vim:set tabstop=2 expandtab: #
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/guinb2.tcl b/Master/texmf/scripts/texlive/tlmgrgui/guinb2.tcl
deleted file mode 100644
index 661517d303b..00000000000
--- a/Master/texmf/scripts/texlive/tlmgrgui/guinb2.tcl
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*-Tcl-*-
-### TL remove packages
-## 2005-2008 Tomasz Luczak tlu@technodat.com.pl
-# $Id$
-####################################### GUI remove packages
-frame .back.f2
-####################### row 1
-
-frame .back.f2.f1 -relief ridge -borderwidth 2
-label .back.f2.f1.l -text "Removing packages" \
- -foreground blue -font {helvetica 10 bold}
-label .back.f2.f1.l1 -text "Use Ctrl or Shift or drag to select more"
-
-grid .back.f2.f1 -row 1 -column 1 -columnspan 3 -padx 2m -pady 2m -sticky nwe
-pack .back.f2.f1.l .back.f2.f1.l1 -side top
-
-####################### row 2 col 1
-# list of packages
-labelframe .back.f2.f21 -text "Select packages for removal"
-grid .back.f2.f21 -row 2 -column 1 -sticky nswe -padx 2m -pady 1m
-# search field
-frame .back.f2.f21.f
-pack .back.f2.f21.f -pady 1m
-label .back.f2.f21.f.l -text "Search"
-entry .back.f2.f21.f.e -validate key -validatecommand {
- set searchListRm [.back.f2.f21.lb get 0 end]
- set listPositionRm [lsearch $searchListRm " %P*"]
- if {$listPositionRm ne -1} then {
- .back.f2.f21.lb yview $listPositionRm
- .back.f2.f21.lb selection set $listPositionRm
- }
- return 1
-}
-button .back.f2.f21.f.b -text "Next" -command {}
-pack .back.f2.f21.f.l .back.f2.f21.f.e .back.f2.f21.f.b -anchor w -side left -padx 1m -pady 1m
-
-listbox .back.f2.f21.lb -width 40 -height 24 \
- -selectmode extended \
- -yscrollcommand ".back.f2.f21.scry set" \
- -xscrollcommand ".back.f2.f21.scrx set"
-scrollbar .back.f2.f21.scrx -command ".back.f2.f21.lb xview" -orient horizontal
-scrollbar .back.f2.f21.scry -command ".back.f2.f21.lb yview" -orient vertical
-pack .back.f2.f21.scrx -side bottom -fill x
-pack .back.f2.f21.scry -side right -fill y
-pack .back.f2.f21.lb -fill y -expand 1
-###################### row2 col 2
-# buttons
-labelframe .back.f2.f22 -text "Buttons"
-grid .back.f2.f22 -row 2 -column 2 -sticky nswe -pady 1m
-
-button .back.f2.f22.b1 -text "Search" -command {}
-button .back.f2.f22.b2 -text "Remove" -command {}
-button .back.f2.f22.b3 -text "Info" -command {}
-
-pack .back.f2.f22.b1 .back.f2.f22.b2 .back.f2.f22.b3 \
- -side top -anchor center -padx 2m -pady 2m
-
-####################### row 2 col 3
-# text: info
-labelframe .back.f2.f23 -text "Info on the selected item"
-set f323 .back.f2.f23
-grid .back.f2.f23 -row 2 -column 3 -sticky nswe -padx 2m -pady 1m
-text $f323.t -width 65 -wrap word \
- -yscrollcommand "$f323.scry set"
-$f323.t insert end "\nAttention: to display package information, the CD drive with the TeX Live CD should be selected in the \"Add packages\" tab.\n\nFirst fill in the list using the \"Search\" button, then select an item and click the \"Remove\" button to remove the package."
-scrollbar $f323.scry -command "$f323.t yview" -orient vertical
-pack $f323.scry -side right -fill y
-pack $f323.t -expand 1 -fill both
-
-# EOF
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl
index 1951db56434..23fabeea21f 100644
--- a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl
@@ -13,7 +13,7 @@ BEGIN {
$^W = 1;
$Master = `kpsewhich -var-value=SELFAUTOPARENT`;
chomp($Master);
- unshift (@INC, "$Master/tlpkg", "$Master/texmf/script/texlive/tlmgrgui");
+ unshift (@INC, "$Master/tlpkg", "$Master/texmf/scripts/texlive/tlmgrgui");
}
use TeXLive::TLMedia;
@@ -92,6 +92,82 @@ sub init_install_media {
}
}
+sub validate_search_input {
+ my ($w, $iw, $str, @l) = @_;
+ my $found = -1;
+ for (my $i = 0; $i < @l; $i++) {
+ my $pkg = $l[$i];
+ $pkg =~ s/^\s*(\(i\) )?//;
+ if ($pkg =~ m;$str;i) {
+ $found = $i;
+ last;
+ }
+ }
+ if ($found >= 0) {
+ $w->selectionClear(0,"end");
+ $w->yview($found);
+ $w->selectionSet($found);
+ update_info_window($w, $iw, @l);
+ } else {
+ $w->selectionClear(0,"end");
+ }
+ return(1);
+}
+
+sub find_next_search_match {
+ my ($w, $e, $iw, @l) = @_;
+ # first get the current selection
+ my @cursel = $w->curselection;
+ my $str = $e->get;
+ my $found = -1;
+ for (my $i = $cursel[0] + 1; $i < @l; $i++) {
+ my $pkg = $l[$i];
+ $pkg =~ s/^\s*(\(i\) )?//;
+ if ($pkg =~ m;$str;i) {
+ $found = $i;
+ last;
+ }
+ }
+ if ($found >= 0) {
+ $w->selectionClear(0,"end");
+ $w->yview($found);
+ $w->selectionSet($found);
+ update_info_window($w, $iw, @l);
+ }
+}
+
+sub update_info_window {
+ my ($lb, $iw, @l) = @_;
+ my @selind = $lb->curselection;
+ return if (!@selind);
+ my $pkgname = $l[$selind[0]];
+ $pkgname =~ s/^\s*(\(i\) )?//;
+ my $tlp = $tlmediatlpdb->get_package($pkgname);
+ my $longdesc = $tlmediatlpdb->get_package($pkgname)->longdesc;
+ my $shortdesc = $tlmediatlpdb->get_package($pkgname)->shortdesc;
+ $longdesc || ($longdesc = "(no long description available)");
+ $shortdesc || ($shortdesc = "(no short description available)");
+ $iw->delete("0.0", "end");
+ $iw->insert("0.0", "$shortdesc\n\n$longdesc");
+}
+
+sub install_selected_packages {
+ system("tlmgr","install", @_);
+ reinit_local_tlpdb();
+}
+
+sub remove_selected_packages {
+ system("tlmgr", "remove", @_);
+ reinit_local_tlpdb();
+}
+
+sub reinit_local_tlpdb {
+ $localtlpdb = TeXLive::TLPDB->new ("root" => "$Master");
+ die("cannot find tlpdb!") unless (defined($localtlpdb));
+ @alllocalpackages = filter_out($localtlpdb->list_packages);
+ @allpackages = filter_out($tlmediatlpdb->list_packages);
+}
+
sub filter_out {
my @ret;
foreach my $p (@_) {
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.tcl b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.tcl
deleted file mode 100644
index 04537c05abb..00000000000
--- a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui2.tcl
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-# the next line restarts using wish \
-exec wish "$0" "$@"
-
-wm title . "tlmgr 2008"
-
-frame .top
-button .top.b1 -text "Adding packages" -command {
- pack forget .back.f2
- pack .back.f1
-}
-button .top.b2 -text "Removing packages" -command {
- pack forget .back.f1
- pack .back.f2
-}
-pack .top.b1 .top.b2 -side left
-frame .back -borderwidth 2
-pack .top .back -side top -fill both -expand 1
-
-source guinb1.tcl
-source guinb2.tcl
-
-pack .back.f1
-# EOF \ No newline at end of file