From 9379d6d49d5ca31c3f45b03ffcf916020ec7bfc3 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 5 May 2008 15:50:09 +0000 Subject: new layout for tlmgr, and support for architectures command git-svn-id: svn://tug.org/texlive/trunk@7863 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/texlive/tlmgr.pl | 1 + Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl | 78 ++++++++++++++++++++++ .../texmf/scripts/texlive/tlmgrgui/gui-install.pl | 59 +++++++--------- .../texmf/scripts/texlive/tlmgrgui/gui-remove.pl | 52 ++++++--------- .../scripts/texlive/tlmgrgui/gui-uninstall.pl | 2 +- Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl | 35 ++++++++-- 6 files changed, 155 insertions(+), 72 deletions(-) create mode 100644 Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 70fdadc9e44..841d9bc71d6 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -656,6 +656,7 @@ sub action_arch { # install the necessary win32 stuff merge_into (\%ret, $tlmediasrc->install_package("bin-tlperl.win32", $localtlpdb, 1, 1)); merge_into (\%ret, $tlmediasrc->install_package("bin-tlgs.win32", $localtlpdb, 1, 1)); + merge_into (\%ret, $tlmediasrc->install_package("bin-tlpsv.win32", $localtlpdb, 1, 1)); } } else { die "Unknown option for arch: $what"; diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl new file mode 100644 index 00000000000..bcaed926f0c --- /dev/null +++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl @@ -0,0 +1,78 @@ +# gui-arch.pl +# $Id$ +# +# Copyright 2009 Tomasz Luczak, Norbert Preining +# +# GUI for tlmgr +# + + +# frame .back.f1 +$back_arch = $back->Frame; + +# this will be loaded only on unix systems! +# + +my @archsavail; +my @archsinstalled; +my %archs; + +init_archs(); + +$back_arch->Label(-text => "Select architectures to be added (removal not possible)")->pack(-padx => "5m", -pady => "5m"); +foreach my $a (@archsavail) { + $back_arch->Checkbutton(-command => sub { check_on_removal($a); }, + -variable => \$archs{$a}, + -text => platform_desc($a) + )->pack(-anchor => 'w'); +} + +my $f = $back_arch->Frame; +$f->pack(-padx => "10m", -pady => "5m"); +$f->Button(-text => "Apply changes", -command => sub { apply_changes(); })->pack(-side => 'left', -padx => "3m"); +$f->Button(-text => "Reset changes", -command => sub { init_archs(); })->pack(-side => 'left', -padx => "3m"); + +sub init_archs { + @archsavail = $tlmediatlpdb->available_architectures; + @archsinstalled = $localtlpdb->available_architectures; + foreach my $a (@archsavail) { + $archs{$a} = 0; + if (grep(/^$a$/,@archsinstalled)) { + $archs{$a} = 1; + } + } +} + +sub check_on_removal { + my $a = shift; + if (!$archs{$a} && grep(/^$a$/,@archsinstalled)) { + # removal not supported + $archs{$a} = 1; + $f->Dialog(-title => "info", + -text => "Removals of archs currently not supported!", + -buttons => [ "Ok" ])->Show; + } +} + + +sub apply_changes { + my @todo; + foreach my $a (@archsavail) { + next if grep(/^$a$/,@archsinstalled); + push @todo, $a if $archs{$a}; + } + if (@todo) { + run_program_show_output("tlmgr", "arch", "add", @todo); + reinit_local_tlpdb(); + init_archs(); + } +} + +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 index 9e2420e0ed8..a1e23abda73 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui/gui-install.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-install.pl @@ -20,8 +20,8 @@ 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"); -# grid .back.f1.f1 -row 1 -column 1 -columnspan 3 -padx 2m -pady 2m -sticky nwe -$back_f1_f1->grid(-row => 1, -column => 1, -columnspan => 3, +# grid .back.f1.f1 -row 1 -column 1 -columnspan 2 -padx 2m -pady 2m -sticky nwe +$back_f1_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_f1_f1_l->pack(-side => "top"); @@ -34,7 +34,7 @@ $back_f1_f1_l1->pack(-side => "top"); our $back_f1_f21 = $back_f1->Labelframe(-text => "Select packages to install"); # grid .back.f1.f21 -row 2 -column 1 -rowspan 2 \ # -sticky nswe -padx 2m -pady 1m -$back_f1_f21->grid(-row => 2, -column => 1, -rowspan => 2, +$back_f1_f21->grid(-row => 2, -column => 1, -rowspan => 3, -sticky => "nswe", -padx => "2m", -pady => "1m"); @@ -92,43 +92,12 @@ $back_f1_f21_scry->pack(-side => "right", -fill => "y"); # pack .back.f1.f21.lb -fill y -expand 1 $back_f1_f21_lb->pack(-fill => "y", -expand => 1); -###################### row2 col 2 -# Buttons -# labelframe .back.f1.f22 -text "Buttons" -our $back_f1_f22 = $back_f1->Labelframe(-text => "Buttons"); -# grid .back.f1.f22 -row 2 -column 2 -rowspan 2 \ -# -sticky nswe -pady 1m -$back_f1_f22->grid(-row => 2, -column => 2, -rowspan =>2, - -sticky => "nswe", -pady => "1m"); - -## Buttons -# 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 -$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"); - ######################## row 2 col 3 ## CD-ROM # labelframe .back.f1.f23 -text "CD/DVD" 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", +$back_f1_f23->grid(-row => 2, -column => 2, -sticky => "nswe", -padx => "2m", -pady => "1m"); ## CD-ROM @@ -149,7 +118,7 @@ $back_f1_f23_l->pack(-side => "left", -padx => "2m", -pady => "2m", # labelframe .back.f1.f33 -text "Info on the selected item" our $back_f1_f33 = $back_f1->Labelframe(-text => "Info on the selected item"); # grid .back.f1.f33 -row 3 -column 3 -sticky nswe -padx 2m -pady 1m -$back_f1_f33->grid(-row => 3, -column => 3, -sticky => "nswe", +$back_f1_f33->grid(-row => 3, -column => 2, -sticky => "nswe", -padx => "2m", -pady => "1m"); @@ -174,6 +143,24 @@ $back_f1_f33_scry->pack(-side => "right", -fill => "y"); # pack .back.f1.f33.t -expand 1 -fill y $back_f1_f33_t->pack(-expand => 1, -fill => "both"); +############### +our $back_f1_buttons = $back_f1->Labelframe(); ### -text => "Buttons"); +$back_f1_buttons->grid(-row => 4, -column => 2, + -padx => "2m", -pady => "2m", -sticky => "nswe"); + +## 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 => 1, -fill => "both", + -padx => "2m", -pady => "2m"); ############### diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-remove.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-remove.pl index 85a8cbcce79..d3117090d89 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui/gui-remove.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-remove.pl @@ -32,9 +32,8 @@ $back_f2_f1_l1->pack(-side => "top"); # list of packages # labelframe .back.f2.f21 -text "Select packages for removal" our $back_f2_f21 = $back_f2->Labelframe(-text => "Select packages for removal"); -# grid .back.f2.f21 -row 2 -column 1 -sticky nswe -padx 2m -pady 1m $back_f2_f21->grid(-row => 2, -column => 1, -sticky => "nswe", - -padx => "2m", -pady => "1m"); + -rowspan => 2, -padx => "2m", -pady => "1m"); # search field # frame .back.f2.f21.f our $back_f2_f21_f = $back_f2_f21->Frame(); @@ -91,39 +90,14 @@ $back_f2_f21_scrx->pack(-side => "bottom", -fill => "x"); $back_f2_f21_scry->pack(-side => "right", -fill => "y"); $back_f2_f21_lb->pack(-fill => "y", -expand => 1); -###################### row2 col 2 -# buttons -# labelframe .back.f2.f22 -text "Buttons" -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 "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"); ####################### 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"); -# grid .back.f2.f23 -row 2 -column 3 -sticky nswe -padx 2m -pady 1m -$back_f2_f23->grid(-row => 2, -column => 3, -sticky => "nswe", - -padx => "2m", -pady => "1m"); +$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" @@ -140,6 +114,24 @@ $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"); + # EOF ### Local Variables: diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl index 5753d589399..572d7311892 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl @@ -1,5 +1,5 @@ # gui-uninstall.pl -# $Id: gui-uninstall.pl 7821 2008-05-03 14:41:01Z preining $ +# $Id$ # # Copyright 2009 Tomasz Luczak, Norbert Preining # diff --git a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl index 9dc6341fef8..8b8ad45fe91 100755 --- a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl @@ -19,7 +19,7 @@ BEGIN { use TeXLive::TLMedia; use TeXLive::TLPDB; use TeXLive::TLConfig; -use TeXLive::TLUtils qw(setup_programs); +use TeXLive::TLUtils qw(setup_programs platform_desc); use Getopt::Long qw(:config no_autoabbrev require_order); use Tk; use Tk::Dialog; @@ -36,6 +36,8 @@ GetOptions("location=s" => \$opt_location, our $back_f1; our $back_f2; +our $back_f3; +our $back_arch; our $localtlpdb = TeXLive::TLPDB->new ("root" => "$Master"); die("cannot find tlpdb!") unless (defined($localtlpdb)); @@ -74,6 +76,7 @@ our $b1 = $top->Button(-text => "Adding packages", -command => sub { $back_f2->packForget; $back_f3->packForget; + $back_arch->packForget; $back_f1->pack; }); @@ -85,6 +88,7 @@ our $b2 = $top->Button(-text => "Removing packages", -command => sub { $back_f1->packForget; $back_f3->packForget; + $back_arch->packForget; $back_f2->pack; }); @@ -92,12 +96,28 @@ our $b3 = $top->Button(-text => "Uninstallation", -command => sub { $back_f1->packForget; $back_f2->packForget; + $back_arch->packForget; $back_f3->pack; }); + +our $b4 = $top->Button(-text => "Architectures", + -command => sub { + $back_f1->packForget; + $back_f2->packForget; + $back_f3->packForget; + $back_arch->pack; + }); + +our $quit = $top->Button(-text => "Quit", + -command => sub { $mw->destroy; exit(0); }); + # pack .top.b1 .top.b2 -side left $b1->pack(-side => 'left'); $b2->pack(-side => 'left'); $b3->pack(-side => 'left'); +$b4->pack(-side => 'left'); + +$quit->pack(-side => 'right'); # frame .back -borderwidth 2 our $back = $mw->Frame(-borderwidth => 2); @@ -109,6 +129,7 @@ $back->pack(-side => 'top', -fill => 'both', -expand => 1); require("gui-install.pl"); require("gui-remove.pl"); require("gui-uninstall.pl"); +require("gui-arch.pl"); # pack .back.f1 $back_f1->pack; @@ -248,13 +269,17 @@ Please wait, the output will appear here when ready.\n"); } sub install_selected_packages { - run_program_show_output("tlmgr", "install", @_); - reinit_local_tlpdb(); + if (@_) { + run_program_show_output("tlmgr", "install", @_); + reinit_local_tlpdb(); + } } sub remove_selected_packages { - run_program_show_output("tlmgr", "remove", @_); - reinit_local_tlpdb(); + if (@_) { + run_program_show_output("tlmgr", "remove", @_); + reinit_local_tlpdb(); + } } sub reinit_local_tlpdb { -- cgit v1.2.3