summaryrefslogtreecommitdiff
path: root/Master/texmf
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-05-09 20:50:38 +0000
committerNorbert Preining <preining@logic.at>2008-05-09 20:50:38 +0000
commit4247427f7d809752ce5077f36c4babdb8a1095e3 (patch)
tree3786523cdeba187cbf940a8c2d11ca8c5cbb66c4 /Master/texmf
parent5dfc00f7636c15dd68683b55cdefa4be39599097 (diff)
rehaul of tlmgrgui
git-svn-id: svn://tug.org/texlive/trunk@7989 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl198
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/gui-install.pl123
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/gui-remove.pl126
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui/gui-update.pl120
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl132
5 files changed, 251 insertions, 448 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl b/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl
new file mode 100644
index 00000000000..8f7a77bed49
--- /dev/null
+++ b/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl
@@ -0,0 +1,198 @@
+# guinb1.pl
+# $Id: gui-install.pl 7929 2008-05-08 05:35:51Z preining $
+#
+# Copyright 2008 Tomasz Luczak, Norbert Preining
+#
+# GUI for tlmgr
+#
+
+
+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;
+ if (!@cursel) {
+ push @cursel, 0;
+ }
+ 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;
+ my $longdesc;
+ my $shortdesc;
+ if (defined($tlmediatlpdb)) {
+ $tlp = $tlmediatlpdb->get_package($pkgname);
+ } else {
+ $tlp = $localtlpdb->get_package($pkgname);
+ }
+ if (defined($tlp)) {
+ $longdesc = $tlp->longdesc;
+ $shortdesc = $tlp->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 do_listframe {
+ my ($f, $title, $listref, $buttonsref) = @_;
+
+ # row 1, column 1-2
+ my $f_title = $f->Frame(-relief => 'ridge', -borderwidth => 2);
+ $f_title->Label( -text => $title,
+ -foreground => "blue",
+ -font => "helvetica 10 bold"
+ )->pack(-side => "top");
+ $f_title->Label( -text => "Use Ctrl or Shift or drag to select more"
+ )->pack(-side => "top");
+ $f_title->grid( -row => 1, -column => 1, -columnspan => 2,
+ -padx => "2m", -pady => "2m", -sticky => "we");
+
+ # column 1, row 2-3
+
+ my $f_listf = $f->Labelframe(-text => "Select packages");
+ $f_listf->grid( -row => 2, -column => 1, -rowspan => 2,
+ -sticky => "nswe", -padx => "2m", -pady => "1m");
+
+ my $f_listf_lb;
+ my $f_textf_text;
+ my $f_listf_searchf = $f_listf->Frame;
+ $f_listf_searchf->pack(-pady => "1m");
+ my $f_listf_searchf_label =
+ $f_listf_searchf->Label(-text => "Search")->pack( -anchor => "w",
+ -side => "left",
+ -padx => "1m",
+ -pady => "1m");
+ my $f_listf_searchf_entry = $f_listf_searchf->Entry( -validate => "key",
+ -validatecommand =>
+ sub { validate_search_input($f_listf_lb,
+ $f_textf_text,
+ $_[0],
+ @$listref); });
+ my $f_listf_searchf_button = $f_listf_searchf->Button(-text => "Next",
+ -command => sub { find_next_search_match($f_listf_lb,
+ $f_listf_searchf_entry,
+ $f_textf_text,
+ @$listref); });
+ $f_listf_searchf_entry->pack(
+ -anchor => "w", -side => "left", -padx => "1m", -pady => "1m");
+ $f_listf_searchf_button->pack(
+ -anchor => "w", -side => "left", -padx => "1m", -pady => "1m");
+
+ my $f_listf_scry;
+ my $f_listf_scrx;
+ $f_listf_lb = $f_listf->Listbox(
+ -listvariable => $listref,
+ -selectmode => "extended",
+ -yscrollcommand => sub { $f_listf_scry->set(@_); },
+ -xscrollcommand => sub { $f_listf_scrx->set(@_); } );
+ $f_listf_lb->bind('<<ListboxSelect>>',
+ sub { update_info_window ($f_listf_lb, $f_textf_text, @$listref); });
+ $f_listf_scrx = $f_listf->Scrollbar(
+ -command => sub { $f_listf_lb->xview(@_); }, -orient => "horizontal");
+ $f_listf_scry = $f_listf->Scrollbar(
+ -command => sub { $f_listf_lb->yview(@_); }, -orient => "vertical");
+ $f_listf_scrx->pack(-side => "bottom", -fill => "x");
+ $f_listf_scry->pack(-side => "right", -fill => "y", -expand => 0);
+ $f_listf_lb->pack(-fill => "both", -expand => 1);
+
+ # row 2 column 2
+ my $f_textf = $f->Labelframe(-text => "Info on the selected item");
+ $f_textf->grid(-row => 2, -column => 2, -sticky => "nswe",
+ -padx => "2m", -pady => "1m");
+
+ my $f_textf_scry;
+ $f_textf_text = $f_textf->ROText(-width => 45, -wrap => "word",
+ -yscrollcommand => sub { $f_textf_scry->set(@_); });
+ $f_textf_text->insert("end", "\nAttention. Please check if a DVD drive with the TeX Live DVD\nor the correct network address is properly selected.\n\nFirst fill in the list using the \"Search\" button, then select one or more items and click \"Install\" button.");
+
+ $f_textf_scry = $f_textf->Scrollbar(
+ -command => sub { $f_textf_t->yview(@_); }, -orient => "vertical");
+
+ $f_textf_scry->pack(-side => "right", -fill => "y", -expand => 0);
+ $f_textf_text->pack(-expand => 1, -fill => "both");
+
+ # row 3 column 2
+ my $f_buttonf = $f->Labelframe();
+ $f_buttonf->grid(-row => 3, -column => 2,
+ -padx => "2m", -pady => "2m", -sticky => "we");
+
+ foreach my $k (keys %$buttonsref) {
+ $f_buttonf->Button(-text => $buttonsref->{$k}{'-text'},
+ -command => sub { my @l = $f_listf_lb->curselection;
+ my @pl;
+ foreach my $i (@l) {
+ my @all = @$listref;
+ my $foo = $all[$i];
+ $foo =~ s/^\s*(\(i\) )?//;
+ push @pl, $foo;
+ }
+ my $coderef = $buttonsref->{$k}{'-command'};
+ my @allargs;
+ if (defined($buttonsref->{$k}{'-args'})) {
+ push @allargs, @{$buttonsref->{$k}{'-args'}};
+ }
+ push @allargs, @pl;
+ &$coderef(@allargs);
+ })->pack( -expand => 0, -fill => "both",
+ -padx => "2m", -pady => "2m");
+ }
+ $f->gridRowconfigure(1,-weight => 0);
+ $f->gridRowconfigure(2,-weight => 1);
+ $f->gridRowconfigure(3,-weight => 0);
+ $f->gridColumnconfigure(1,-weight => 1);
+ $f->gridColumnconfigure(2,-weight => 1);
+}
+
+1;
+
+### 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/gui-install.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-install.pl
deleted file mode 100644
index 3fce0ad2881..00000000000
--- a/Master/texmf/scripts/texlive/tlmgrgui/gui-install.pl
+++ /dev/null
@@ -1,123 +0,0 @@
-# guinb1.pl
-# $Id$
-#
-# Copyright 2008 Tomasz Luczak, Norbert Preining
-#
-# GUI for tlmgr
-#
-
-
-our $back_f1 = $back->add("install",-label => "Installation");
-$screens{"install"} = $back_f1;
-
-
-####################### row 1
-
-# frame .back.f1.f1 -relief ridge -borderwidth 2
-our $back_f1_f1 = $back_f1->Frame(-relief => 'ridge', -borderwidth => 2);
-# label .back.f1.f1.l -text "Adding packages" \
-# -foreground blue -font {helvetica 10 bold}
-our $back_f1_f1_l = $back_f1_f1->Label(-text => 'Adding packages',
- -foreground => "blue", -font => "helvetica 10 bold");
-# label .back.f1.f1.l1 -text "Use Ctrl or Shift or drag to select more"
-our $back_f1_f1_l1 = $back_f1_f1->Label(-text => "Use Ctrl or Shift or drag to select more");
-$back_f1_f1->grid(-row => 1, -column => 1, -columnspan => 2,
- -padx => "2m", -pady => "2m", -sticky => "we");
-# pack .back.f1.f1.l .back.f1.f1.l1 -side top
-$back_f1_f1_l->pack(-side => "top");
-$back_f1_f1_l1->pack(-side => "top");
-
-
-####################### row 2 col 1
-# listbox: packages
-#labelframe .back.f1.f21 -text "Select packages to install"
-our $back_f1_f21 = $back_f1->Labelframe(-text => "Select packages to install");
-$back_f1_f21->grid(-row => 2, -column => 1, -rowspan => 2,
- -sticky => "nswe", -padx => "2m", -pady => "1m");
-
-
-# search field
-our $back_f1_f21_f = $back_f1_f21->Frame;
-$back_f1_f21_f->pack(-pady => "1m");
-our $back_f1_f21_f_l = $back_f1_f21_f->Label(-text => "Search");
-our $back_f1_f21_f_e = $back_f1_f21_f->Entry(
- -validate => "key",
- -validatecommand => sub { validate_search_input($back_f1_f21_lb, $back_f1_f33_t, $_[0], @allpackages); });
-our $back_f1_f21_f_b = $back_f1_f21_f->Button(-text => "Next",
- -command => sub { find_next_search_match($back_f1_f21_lb, $back_f1_f21_f_e, $back_f1_f33_t, @allpackages); });
-$back_f1_f21_f_l->pack(-anchor => "w", -side => "left", -padx => "1m", -pady => "1m");
-$back_f1_f21_f_e->pack(-anchor => "w", -side => "left", -padx => "1m", -pady => "1m");
-$back_f1_f21_f_b->pack(-anchor => "w", -side => "left", -padx => "1m", -pady => "1m");
-
-our $back_f1_f21_scry;
-our $back_f1_f21_scrx;
-$back_f1_f21_lb = $back_f1_f21->Listbox(
- -listvariable => \@allpackages,
- -selectmode => "extended",
- -yscrollcommand => sub { $back_f1_f21_scry->set(@_); },
- -xscrollcommand => sub { $back_f1_f21_scrx->set(@_); } );
-$back_f1_f21_lb->bind('<<ListboxSelect>>',
- sub { update_info_window ($back_f1_f21_lb, $back_f1_f33_t, @allpackages); });
-$back_f1_f21_scrx = $back_f1_f21->Scrollbar(
- -command => sub { $back_f1_f21_lb->xview(@_); }, -orient => "horizontal");
-$back_f1_f21_scry = $back_f1_f21->Scrollbar(
- -command => sub { $back_f1_f21_lb->yview(@_); }, -orient => "vertical");
-$back_f1_f21_scrx->pack(-side => "bottom", -fill => "x");
-# pack .back.f1.f21.scry -side right -fill y
-$back_f1_f21_scry->pack(-side => "right", -fill => "y", -expand => 0);
-$back_f1_f21_lb->pack(-fill => "both", -expand => 1);
-
-####################### row 3 col 3
-## text: info
-our $back_f1_f33 = $back_f1->Labelframe(-text => "Info on the selected item");
-$back_f1_f33->grid(-row => 2, -column => 2, -sticky => "nswe",
- -padx => "2m", -pady => "1m");
-
-
-
-our $back_f1_f33_scry;
-our $back_f1_f33_t = $back_f1_f33->ROText(-width => 45, -wrap => "word",
- -yscrollcommand => sub { $back_f1_f33_scry->set(@_); });
-$back_f1_f33_t->insert("end", "\nAttention. Please check if a DVD drive with the TeX Live DVD\nor the correct network address is properly selected.\n\nFirst fill in the list using the \"Search\" button, then select one or more items and click \"Install\" button.");
-
-$back_f1_f33_scry = $back_f1_f33->Scrollbar(
- -command => sub { $back_f1_f33_t->yview(@_); }, -orient => "vertical");
-
-$back_f1_f33_scry->pack(-side => "right", -fill => "y", -expand => 0);
-$back_f1_f33_t->pack(-expand => 1, -fill => "both");
-
-###############
-our $back_f1_buttons = $back_f1->Labelframe(); ### -text => "Buttons");
-$back_f1_buttons->grid(-row => 3, -column => 2,
- -padx => "2m", -pady => "2m", -sticky => "we");
-
-## Buttons
-# button .back.f1.f22.b1 -text "Install" -command {}
-our $back_f1_buttons_install = $back_f1_buttons->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); });
-$back_f1_buttons_install->pack(-expand => 0, -fill => "both",
- -padx => "2m", -pady => "2m");
-
-
-$back_f1->gridRowconfigure(1,-weight => 0);
-$back_f1->gridRowconfigure(2,-weight => 1);
-$back_f1->gridRowconfigure(3,-weight => 0);
-$back_f1->gridColumnconfigure(1,-weight => 1);
-$back_f1->gridColumnconfigure(2,-weight => 1);
-
-
-1;
-
-### 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/gui-remove.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-remove.pl
deleted file mode 100644
index c7184da69d7..00000000000
--- a/Master/texmf/scripts/texlive/tlmgrgui/gui-remove.pl
+++ /dev/null
@@ -1,126 +0,0 @@
-# guinb2.pl
-# $Id$
-#
-# Copyright 2008 Tomasz Luczak, Norbert Preining
-#
-# GUI for tlmgr
-#
-
-our $back_f2 = $back->add("remove", -label => "Removing packages");
-$screens{"remove"} = $back_f2;
-
-####################### row 1
-
-our $back_f2_f1 = $back_f2->Frame(-relief => "ridge", -borderwidth => 2);
-$back_f2_f1_l = $back_f2_f1->Label(-text => "Removing packages",
- -foreground => "blue", -font => "helvetica 10 bold");
-our $back_f2_f1_l1 = $back_f2_f1->Label(-text => "Use Ctrl or Shift or drag to select more");
-
-$back_f2_f1->grid(-row => 1, -column => 1, -columnspan => 2,
- -padx => "2m", -pady => "2m", -sticky => "we");
-$back_f2_f1_l->pack(-side => "top");
-$back_f2_f1_l1->pack(-side => "top");
-
-####################### row 2 col 1
-# list of packages
-our $back_f2_f21 = $back_f2->Labelframe(-text => "Select packages for removal");
-$back_f2_f21->grid(-row => 2, -column => 1, -sticky => "nswe",
- -rowspan => 2, -padx => "2m", -pady => "1m");
-# search field
-our $back_f2_f21_f = $back_f2_f21->Frame();
-$back_f2_f21_f->pack(-pady => "1m");
-our $back_f2_f21_f_l = $back_f2_f21_f->Label(-text => "Search");
-our $back_f2_f21_f_e = $back_f2_f21_f->Entry(
- -validate => "key",
- -validatecommand => sub { validate_search_input($back_f2_f21_lb, $back_f2_f23_t, $_[0], @alllocalpackages); } );
-our $back_f2_f21_f_b = $back_f2_f21_f->Button(-text => "Next",
- -command => sub { find_next_search_match($back_f2_f21_lb, $back_f2_f21_f_e, $back_f2_f23_t, @alllocalpackages); });
-$back_f2_f21_f_l->pack(-anchor => "w", -side => "left",
- -padx => "1m", -pady => "1m");
-$back_f2_f21_f_e->pack(-anchor => "w", -side => "left",
- -padx => "1m", -pady => "1m");
-$back_f2_f21_f_b->pack(-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"
-our $back_f2_f21_scry;
-our $back_f2_f21_scrx;
-our $back_f2_f21_lb = $back_f2_f21->Listbox(
- -listvariable => \@alllocalpackages,
- -selectmode => "extended",
- -yscrollcommand => sub { $back_f2_f21_scry->set(@_); },
- -xscrollcommand => sub { $back_f2_f21_scrx->set(@_); });
-$back_f2_f21_lb->bind('<<ListboxSelect>>',
- 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");
-# scrollbar .back.f2.f21.scry -command ".back.f2.f21.lb yview" -orient vertical
-$back_f2_f21_scry = $back_f2_f21->Scrollbar(
- -command => sub { $back_f2_f21_lb->yview(@_); }, -orient => "vertical");
-$back_f2_f21_scrx->pack(-side => "bottom", -fill => "x");
-$back_f2_f21_scry->pack(-side => "right", -fill => "y");
-$back_f2_f21_lb->pack(-fill => "both", -expand => 1);
-
-
-####################### row 2 col 3
-# text: info
-# labelframe .back.f2.f23 -text "Info on the selected item"
-our $back_f2_f23 = $back_f2->Labelframe(-text => "Info on the selected item");
-$back_f2_f23->grid(-row => 2, -column => 2, -sticky => "nswe",
- -padx => "2m", -pady => "1m",
- -ipadx => "2m", -ipady => "2m");
-# set f323 .back.f2.f23
-# text $f323.t -width 65 -wrap word \
-# -yscrollcommand "$f323.scry set"
-our $back_f2_f23_scry;
-our $back_f2_f23_t = $back_f2_f23->ROText(-width => 45, -wrap => "word",
- -yscrollcommand => sub { $back_f2_f23_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."
-$back_f2_f23_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
-$back_f2_f23_scry = $back_f2_f23->Scrollbar(
- -command => sub { $back_f2_f23_t->yview(@_); }, -orient => "vertical");
-# pack $f323.scry -side right -fill y
-$back_f2_f23_scry->pack(-side => "right", -fill => "y");
-# pack $f323.t -expand 1 -fill both
-$back_f2_f23_t->pack(-expand => 1, -fill => "both");
-
-######################
-# buttons
-# labelframe .back.f2.f22 -text "Buttons"
-our $back_f2_buttons = $back_f2->Labelframe(); ### -text => "Buttons");
-$back_f2_buttons->grid(-row => 3, -column => 2, -sticky => "nswe",
- -padx => "2m", -pady => "2m");
-
-our $back_f2_buttons_b1 = $back_f2_buttons->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); });
-$back_f2_buttons_b1->pack(-side => "top", -anchor => "center", -padx => "2m", -pady => "2m", -expand => 1, -fill => "both");
-
-
-
-$back_f2->gridRowconfigure(1,-weight => 0);
-$back_f2->gridRowconfigure(2,-weight => 1);
-$back_f2->gridRowconfigure(3,-weight => 0);
-$back_f2->gridColumnconfigure(1,-weight => 1);
-$back_f2->gridColumnconfigure(2,-weight => 1);
-
-1;
-
-# 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/gui-update.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-update.pl
deleted file mode 100644
index e24487e3816..00000000000
--- a/Master/texmf/scripts/texlive/tlmgrgui/gui-update.pl
+++ /dev/null
@@ -1,120 +0,0 @@
-# $Id$
-#
-# Copyright 2008 Tomasz Luczak, Norbert Preining
-#
-# GUI for tlmgr
-#
-
-our $back_up = $back->add("update", -label => "Update");
-$screens{"update"} = $back_up;
-
-####################### row 1
-
-our $back_up_f1 = $back_up->Frame(-relief => 'ridge', -borderwidth => 2);
-our $back_up_f1_l = $back_up_f1->Label(-text => 'Updating packages',
- -foreground => "blue", -font => "helvetica 10 bold");
-our $back_up_f1_l1 = $back_up_f1->Label(-text => "Use Ctrl or Shift or drag to select more");
-$back_up_f1->grid(-row => 1, -column => 1, -columnspan => 2,
- -padx => "2m", -pady => "2m", -sticky => "nwe");
-# pack .back.f1.f1.l .back.f1.f1.l1 -side top
-$back_up_f1_l->pack(-side => "top");
-$back_up_f1_l1->pack(-side => "top");
-
-
-####################### row 2 col 1
-# listbox: packages
-our $back_up_f21 = $back_up->Labelframe(-text => "Select packages to update");
-$back_up_f21->grid(-row => 2, -column => 1, -rowspan => 2,
- -sticky => "nswe", -padx => "2m", -pady => "1m");
-
-
-# search field
-our $back_up_f21_f = $back_up_f21->Frame;
-$back_up_f21_f->pack(-pady => "1m");
-our $back_up_f21_f_l = $back_up_f21_f->Label(-text => "Search");
-our $back_up_f21_f_e = $back_up_f21_f->Entry(
- -validate => "key",
- -validatecommand => sub { validate_search_input($back_up_f21_lb, $back_up_f33_t, $_[0], @updatepackages); });
-our $back_up_f21_f_b = $back_up_f21_f->Button(-text => "Next",
- -command => sub { find_next_search_match($back_up_f21_lb, $back_up_f21_f_e, $back_up_f33_t, @updatepackages); });
-$back_up_f21_f_l->pack(-anchor => "w", -side => "left", -padx => "1m", -pady => "1m");
-$back_up_f21_f_e->pack(-anchor => "w", -side => "left", -padx => "1m", -pady => "1m");
-$back_up_f21_f_b->pack(-anchor => "w", -side => "left", -padx => "1m", -pady => "1m");
-
-our $back_up_f21_scry;
-our $back_up_f21_scrx;
- # there was -height => 24, below
-$back_up_f21_lb = $back_up_f21->Listbox(
- -listvariable => \@updatepackages,
- -selectmode => "extended",
- -yscrollcommand => sub { $back_up_f21_scry->set(@_); },
- -xscrollcommand => sub { $back_up_f21_scrx->set(@_); } );
-$back_up_f21_lb->bind('<<ListboxSelect>>',
- sub { update_info_window ($back_up_f21_lb, $back_up_f33_t, @updatepackages); });
-$back_up_f21_scrx = $back_up_f21->Scrollbar(
- -command => sub { $back_up_f21_lb->xview(@_); }, -orient => "horizontal");
-$back_up_f21_scry = $back_up_f21->Scrollbar(
- -command => sub { $back_up_f21_lb->yview(@_); }, -orient => "vertical");
-$back_up_f21_scrx->pack(-side => "bottom", -fill => "x");
-$back_up_f21_scry->pack(-side => "right", -fill => "y");
-$back_up_f21_lb->pack(-fill => "both", -expand => 1);
-
-####################### row 3 col 3
-## text: info
-our $back_up_f33 = $back_up->Labelframe(-text => "Info on the selected item");
-$back_up_f33->grid(-row => 2, -column => 2, -sticky => "nswe",
- -padx => "2m", -pady => "1m");
-
-
-
-our $back_up_f33_scry;
-our $back_up_f33_t = $back_up_f33->ROText(-width => 45, -wrap => "word",
- -yscrollcommand => sub { $back_up_f33_scry->set(@_); });
-$back_up_f33_t->insert("end", "\nAttention. Please check if a DVD drive with the TeX Live DVD\nor the correct network address is properly selected.\n\nFirst fill in the list using the \"Search\" button, then select one or more items and click \"Update all\" or \"Update selected\" button.\n\nNote that only packages which have newer revisions available are shown in the list on the left.");
-
-$back_up_f33_scry = $back_up_f33->Scrollbar(
- -command => sub { $back_up_f33_t->yview(@_); }, -orient => "vertical");
-
-$back_up_f33_scry->pack(-side => "right", -fill => "y", -expand => 0);
-
-$back_up_f33_t->pack(-expand => 1, -fill => "both");
-
-###############
-our $back_up_buttons = $back_up->Labelframe(); ### -text => "Buttons");
-$back_up_buttons->grid(-row => 3, -column => 2,
- -padx => "2m", -pady => "2m", -sticky => "nswe");
-
-## Buttons
-our $back_up_buttons_updatesel = $back_up_buttons->Button(-text => "Update selected",
- -command => sub { my @l = $back_up_f21_lb->curselection;
- my @pl;
- foreach my $i (@l) {
- my $foo = $updatepackages[$i];
- $foo =~ s/^\s*(\(i\) )?//;
- push @pl, $foo;
- }
- update_selected_packages(@pl); });
-our $back_up_buttons_updateall = $back_up_buttons->Button(-text => "Update all",
- -command => sub { update_selected_packages("--all"); });
-$back_up_buttons_updatesel->pack(-expand => 1, -fill => "both",
- -padx => "2m", -pady => "2m");
-$back_up_buttons_updateall->pack(-expand => 1, -fill => "both",
- -padx => "2m", -pady => "2m");
-
-
-
-$back_up->gridRowconfigure(1,-weight => 0);
-$back_up->gridRowconfigure(2,-weight => 1);
-$back_up->gridRowconfigure(3,-weight => 0);
-$back_up->gridColumnconfigure(1,-weight => 1);
-$back_up->gridColumnconfigure(2,-weight => 1);
-
-
-1;
-
-### 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/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl
index e3750da140b..139ae6f4fa5 100755
--- a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl
@@ -108,14 +108,46 @@ our $back = $mw->NoteBook(-borderwidth => 2, -dynamicgeometry => 1);
$top->pack(-side => 'top', -fill => 'x', -expand => 0);
$back->pack(-side => 'top', -fill => 'both', -expand => 1);
-require("gui-install.pl");
-require("gui-update.pl");
-require("gui-remove.pl");
+require ("do_listframe.pl");
+# install screen
+our $back_f1 = $back->add("install",-label => "Installation");
+$screens{"install"} = $back_f1;
+do_listframe($back_f1,
+ "Adding packages",
+ \@allpackages,
+ { install => { -text => "Install selected",
+ -command => \&install_selected_packages}}
+ );
+# update screen
+our $back_up = $back->add("update", -label => "Update");
+$screens{"update"} = $back_up;
+do_listframe($back_up,
+ "Updating packages",
+ \@updatepackages,
+ { updateall => { -text => "Update all",
+ -command => \&update_selected_packages,
+ -args => [ "--all" ]
+ },
+ updatesel => { -text => "Update selected",
+ -command => \&update_selected_packages
+ }}
+ );
+# remove screen
+our $back_f2 = $back->add("remove", -label => "Remove");
+$screens{"remove"} = $back_f2;
+do_listframe($back_f2,
+ "Removing packages",
+ \@alllocalpackages,
+ { remove => { -text => "Remove selected",
+ -command => \&remove_selected_packages}}
+ );
+# uninstall screen
require("gui-uninstall.pl");
# arch support not be done via tlmgr on win32
if (!win32()) {
require("gui-arch.pl");
}
+# config screen
require("gui-config.pl");
run_update_functions();
@@ -147,78 +179,6 @@ 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;
- if (!@cursel) {
- push @cursel, 0;
- }
- 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;
- my $longdesc;
- my $shortdesc;
- if (defined($tlmediatlpdb)) {
- $tlp = $tlmediatlpdb->get_package($pkgname);
- } else {
- $tlp = $localtlpdb->get_package($pkgname);
- }
- if (defined($tlp)) {
- $longdesc = $tlp->longdesc;
- $shortdesc = $tlp->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 run_program_show_output {
my $td = $mw->Toplevel(-title => "$_[1] process");
my ($tf,$ys);
@@ -296,7 +256,7 @@ sub update_selected_packages {
sub remove_selected_packages {
if (@_) {
- run_program_show_output("tlmgr", "--location", "$location", "remove", @_);
+ run_program_show_output("tlmgr", "remove", @_);
reinit_local_tlpdb();
}
}
@@ -305,12 +265,15 @@ sub reinit_local_tlpdb {
$localtlpdb = TeXLive::TLPDB->new ("root" => "$Master");
die("cannot find tlpdb!") unless (defined($localtlpdb));
@alllocalpackages = setup_list(0,$localtlpdb->list_packages);
- @allpackages = setup_list(1,$tlmediatlpdb->list_packages);
+ if (defined($tlmediatlpdb)) {
+ @allpackages = setup_list(1,$tlmediatlpdb->list_packages);
+ }
create_update_list();
}
sub create_update_list {
- my @ret;
+ my @ret = ();
+ my @archret = ();
if (defined($tlmediatlpdb)) {
foreach my $lp ($localtlpdb->list_packages) {
next if ($lp =~ m/00texlive-installation.config/);
@@ -323,9 +286,20 @@ sub create_update_list {
$urev = 0;
}
if ($urev > $lrev) {
- push @ret, $lp;
+ if ($lp =~ m/\./) {
+ push @archret, $lp;
+ } else {
+ push @ret, $lp;
+ }
}
}
+ foreach my $p (@archret) {
+ my $foundparent = 0;
+ foreach my $q (@ret) {
+ $foundparent = 1 if ($p =~ m/^$q\./);
+ }
+ push @ret, $p unless $foundparent;
+ }
} else {
@ret = ();
}