diff options
author | Norbert Preining <preining@logic.at> | 2008-05-07 07:46:02 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-05-07 07:46:02 +0000 |
commit | 62d6017985d0976b6f45c79dedd79a7b6cbd4a85 (patch) | |
tree | 8293d7bb2d75929b9ae857bd7f7144e1869e1d44 /Master/texmf | |
parent | 46b4ac344b7247b1d59514ed10a2a0afdc1cda4e (diff) |
update GUI
git-svn-id: svn://tug.org/texlive/trunk@7912 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rw-r--r-- | Master/texmf/scripts/texlive/tlmgrgui/gui-install.pl | 18 | ||||
-rw-r--r-- | Master/texmf/scripts/texlive/tlmgrgui/gui-update.pl | 125 | ||||
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl | 76 |
3 files changed, 191 insertions, 28 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-install.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-install.pl index 0817727c6f3..2fd3b20afd5 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui/gui-install.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-install.pl @@ -155,24 +155,6 @@ our $back_f1_buttons_install = $back_f1_buttons->Button(-text => "Install", $back_f1_buttons_install->pack(-expand => 1, -fill => "both", -padx => "2m", -pady => "2m"); -############### - -sub menu_edit_location { - my $key = shift; - my $val = $location; - my $sw = $mw->Toplevel(-title => "Change Location"); - $sw->Label(-text => "New location: ")->pack; - my $entry = $sw->Entry(-text => $location, -width => 30); - $entry->pack; - my $f = $sw->Frame; - $f->Button(-text => 'ok', - -command => sub { $location = $entry->get; - init_install_media($location) ; - $sw->destroy })->pack(-side => 'left'); - $f->Button(-text => 'cancel', - -command => sub { $sw->destroy })->pack(-side => 'right'); - $f->pack(-expand => 'x'); -} 1; diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-update.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-update.pl new file mode 100644 index 00000000000..f49943563fe --- /dev/null +++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-update.pl @@ -0,0 +1,125 @@ +# $Id$ +# +# Copyright 2009 Tomasz Luczak, Norbert Preining +# +# GUI for tlmgr +# + + +####################### 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 => 3, + -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(-width => 30, + -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 => "y", -expand => 1); + +######################## row 2 col 3 +## CD-ROM +our $back_up_f23 = $back_up->Labelframe(-text => "Installation Source"); +$back_up_f23->grid(-row => 2, -column => 2, -sticky => "nswe", + -padx => "2m", -pady => "1m"); + +## CD-ROM +our $back_up_f23_b = $back_up_f23->Button(-text => "Change", + -command => sub { menu_edit_location(); }); +our $back_up_f23_l = $back_up_f23->Label(-width => 30, -textvariable => \$location, -relief => "sunken", -anchor => "w"); +$back_up_f23_b->pack(-side => "left", -padx => "2m", -pady => "2m"); +$back_up_f23_l->pack(-side => "left", -padx => "2m", -pady => "2m", + -expand => 1, -fill => "x"); + + +####################### row 3 col 3 +## text: info +our $back_up_f33 = $back_up->Labelframe(-text => "Info on the selected item"); +$back_up_f33->grid(-row => 3, -column => 2, -sticky => "nswe", + -padx => "2m", -pady => "1m"); + + + +our $back_up_f33_scry; +our $back_up_f33_t = $back_up_f33->Text(-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"); + +$back_up_f33_t->pack(-expand => 1, -fill => "both"); + +############### +our $back_up_buttons = $back_up->Labelframe(); ### -text => "Buttons"); +$back_up_buttons->grid(-row => 4, -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"); + + +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 8f462802ca9..191ece1b41f 100755 --- a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl @@ -50,10 +50,12 @@ our $back_f2; our $back_f3; our $back_arch; our $back_config; +our $back_up; our $localtlpdb = TeXLive::TLPDB->new ("root" => "$Master"); die("cannot find tlpdb!") unless (defined($localtlpdb)); our @alllocalpackages = setup_list(0,$localtlpdb->list_packages); +our @updatepackages; setup_programs("$Master/tlpkg/installer", $localtlpdb->option_platform); our $location; @@ -71,6 +73,7 @@ our $tlmediatlpdb; our @allpackages; init_install_media($location); +@updatepackages = create_update_list(); # wm title . "tlmgr 2008" our $mw = MainWindow->new(-title => "tlmgr 2008"); @@ -79,30 +82,33 @@ our $mw = MainWindow->new(-title => "tlmgr 2008"); our $top = $mw->Frame; -# button .top.b1 -text "Adding packages" -command { -# pack forget .back.f2 -# pack .back.f1 -# } - our $b1 = $top->Button(-text => "Adding packages", -command => sub { $back_f2->packForget; $back_f3->packForget; $back_arch->packForget; $back_config->packForget; + $back_up->packForget; $back_f1->pack; }); -# button .top.b2 -text "Removing packages" -command { -# pack forget .back.f1 -# pack .back.f2 -# } +our $bu = $top->Button(-text => "Updating packages", + -command => sub { + $back_f2->packForget; + $back_f3->packForget; + $back_arch->packForget; + $back_config->packForget; + $back_f1->packForget; + $back_up->pack; + }); + our $b2 = $top->Button(-text => "Removing packages", -command => sub { $back_f1->packForget; $back_f3->packForget; $back_arch->packForget; $back_config->packForget; + $back_up->packForget; $back_f2->pack; }); @@ -112,6 +118,7 @@ our $b3 = $top->Button(-text => "Uninstallation", $back_f2->packForget; $back_arch->packForget; $back_config->packForget; + $back_up->packForget; $back_f3->pack; }); @@ -121,6 +128,7 @@ our $b4 = $top->Button(-text => "Architectures", $back_f2->packForget; $back_f3->packForget; $back_config->packForget; + $back_up->packForget; $back_arch->pack; }); our $b5 = $top->Button(-text => "Configuration", @@ -129,6 +137,7 @@ our $b5 = $top->Button(-text => "Configuration", $back_f2->packForget; $back_f3->packForget; $back_arch->packForget; + $back_up->packForget; $back_config->pack; }); @@ -139,6 +148,7 @@ our $quit = $top->Button(-text => "Quit", # pack .top.b1 .top.b2 -side left $b1->pack(-side => 'left'); $b2->pack(-side => 'left'); +$bu->pack(-side => 'left'); # arch support not be done via tlmgr on win32 $b3->pack(-side => 'left'); if (!win32()) { @@ -156,7 +166,7 @@ $back_f2 = $back->Frame; $back_f3 = $back->Frame; $back_arch = $back->Frame; $back_config = $back->Frame; - +$back_up = $back->Frame; # pack .top .back -side top -fill both -expand 1 @@ -164,6 +174,7 @@ $top->pack(-side => 'top', -fill => 'both', -expand => 1); $back->pack(-side => 'top', -fill => 'both', -expand => 1); require("gui-install.pl"); +require("gui-update.pl"); require("gui-remove.pl"); require("gui-uninstall.pl"); if (!win32()) { @@ -318,6 +329,13 @@ sub install_selected_packages { } } +sub update_selected_packages { + if (@_) { + run_program_show_output("tlmgr", "--location", "$location", "update", @_); + reinit_local_tlpdb(); + } +} + sub remove_selected_packages { if (@_) { run_program_show_output("tlmgr", "--location", "$location", "remove", @_); @@ -330,6 +348,25 @@ sub reinit_local_tlpdb { die("cannot find tlpdb!") unless (defined($localtlpdb)); @alllocalpackages = setup_list(0,$localtlpdb->list_packages); @allpackages = setup_list(1,$tlmediatlpdb->list_packages); + @updatepackages = create_update_list(); +} + +sub create_update_list { + my @ret; + foreach my $lp ($localtlpdb->list_packages) { + my $lrev = $localtlpdb->get_package($lp)->revision; + my $up = $tlmediatlpdb->get_package($lp); + my $urev; + if ($up) { + $urev = $up->revision; + } else { + $urev = 0; + } + if ($urev > $lrev) { + push @ret, $lp; + } + } + return @ret; } sub setup_list { @@ -358,6 +395,25 @@ sub setup_list { return(@ret); } + +sub menu_edit_location { + my $key = shift; + my $val = $location; + my $sw = $mw->Toplevel(-title => "Change Location"); + $sw->Label(-text => "New location: ")->pack; + my $entry = $sw->Entry(-text => $location, -width => 30); + $entry->pack; + my $f = $sw->Frame; + $f->Button(-text => 'ok', + -command => sub { $location = $entry->get; + init_install_media($location) ; + $sw->destroy })->pack(-side => 'left'); + $f->Button(-text => 'cancel', + -command => sub { $sw->destroy })->pack(-side => 'right'); + $f->pack(-expand => 'x'); +} + + __END__ |