diff options
author | Norbert Preining <preining@logic.at> | 2008-05-28 15:30:42 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-05-28 15:30:42 +0000 |
commit | 3830b77c9141c060fd7e79f64f00b7481ddb9548 (patch) | |
tree | f221efa7dcb400af450f115db0eb71534cf642c3 | |
parent | 87ba328ba2dac3363c694c815b5e55bf7680419e (diff) |
tlmgrgui: add debug button, rework the scrolling thingies, fix output
in info window to decent line length, add D/DD in front of logging output
git-svn-id: svn://tug.org/texlive/trunk@8386 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl | 53 | ||||
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl | 53 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 6 |
3 files changed, 70 insertions, 42 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl b/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl index 2f4757eaf85..d76de8e9f73 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl @@ -72,10 +72,31 @@ sub update_info_window { $longdesc = $tlp->longdesc; $shortdesc = $tlp->shortdesc; } - $longdesc || ($longdesc = "(no long description available)"); - $shortdesc || ($shortdesc = "(no short description available)"); + my $text = ""; + if ($shortdesc) { + $text .= $shortdesc; + $text .= "\n\n"; + } + if ($longdesc) { + my @words = split /\s+/, $longdesc; + my $i = 0; + while (@words) { + my $w = shift @words; + my $l = length($w); + if ($i + $l + 1 < 45) { + $text .= " $w"; + $i += $l + 1; + } else { + $text .= "\n$w"; + $i = $l; + } + } + } + if ($text eq "") { + $text = "(no description available)"; + } $iw->delete("0.0", "end"); - $iw->insert("0.0", "$shortdesc\n\n$longdesc"); + $iw->insert("0.0", "$text"); } sub do_listframe { @@ -123,21 +144,13 @@ sub do_listframe { $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( + $f_listf_lb = $f_listf->Scrolled("Listbox", -listvariable => $listref, -selectmode => "extended", - -yscrollcommand => sub { $f_listf_scry->set(@_); }, - -xscrollcommand => sub { $f_listf_scrx->set(@_); } ); + -scrollbars => "osoe" + ); $f_listf_lb->bind('<<ListboxSelect>>', sub { update_info_window ($f_listf_lb, $f_textf_text, @$listref); }); - $f_listf_scrx = $f_listf->Scrollbar( - -command => [ xview => $f_listf_lb ], -orient => "horizontal"); - $f_listf_scry = $f_listf->Scrollbar( - -command => [ yview => $f_listf_lb ], -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 @@ -145,15 +158,11 @@ sub do_listframe { $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\nPlease check using \"Change\" button if a DVD drive\nwith the TeX Live DVD or the correct network address is properly selected,\nthen press \"Load\" button."); + $f_textf_text = $f_textf->Scrolled("ROText", + -scrollbars => "osoe", + -width => 45, -wrap => "none"); + $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\nPlease check using \"Change\" button if a DVD drive\nwith the TeX Live DVD or the correct network address\nis properly selected,\nthen press \"Load\" button."); - $f_textf_scry = $f_textf->Scrollbar( - -command => [ yview => $f_textf_text ], -orient => "vertical"); - - $f_textf_scry->pack(-side => "right", -fill => "y", -expand => 0); $f_textf_text->pack(-expand => 1, -fill => "both"); # row 3 column 2 diff --git a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl index 1c6fd96c99c..90d0db8266e 100755 --- a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl @@ -53,6 +53,8 @@ GetOptions("location=s" => \$opt_location, our @update_function_list; +our $debugmode = 0; + our $localtlpdb = TeXLive::TLPDB->new ("root" => "$Master"); die("cannot find tlpdb!") unless (defined($localtlpdb)); our @alllocalpackages = setup_list(0,$localtlpdb->list_packages); @@ -102,9 +104,19 @@ $quit->pack(-side => 'right'); $top->Label(-text => "Current installation source: ")->pack(-side => 'left'); $top->Label(-textvariable => \$location, -relief => "sunken")->pack(-side => 'left'); -$top->Button(-text => "Load", -command => sub { run_update_functions(); })->pack(-side => 'left'); -$top->Button(-text => "Change", -command => sub { menu_edit_location(); })->pack(-side => 'left'); +$balloon->attach( + $top->Button(-text => "Load", -command => sub { run_update_functions(); })->pack(-side => 'left'), + -balloonmsg => "Press this button to load the database from the specified location."); + +$balloon->attach( + $top->Button(-text => "Change", -command => sub { menu_edit_location(); })->pack(-side => 'left'), + -balloonmsg => "Change the installation source"); + +$balloon->attach( + $top->Checkbutton(-text => "debug", + -variable => \$debugmode)->pack(-side => 'left'), + -balloonmsg => "Turn on debug mode when calling tlmgr."); # frame .back -borderwidth 2 our $back = $mw->NoteBook(-borderwidth => 2, -dynamicgeometry => 1); @@ -190,20 +202,13 @@ sub init_install_media { sub run_program_show_output { my $td = $mw->Toplevel(-title => "$_[1] process"); - my ($tf,$ys); - my $f1 = $td->Frame; - $ys = $f1->Scrollbar(-command => sub { $tf->yview(@_); }, - -orient => "vertical"); - $tf = $f1->Text(-width => 50, -wrap => "word", - -yscrollcommand => sub { $ys->set(@_); }); - $ys->pack(-side => "right", -fill => "y"); - $tf->pack(-expand => 1, -fill => "both"); - $f1->pack; - my $f2 = $td->Frame; - my $ok = $f2->Button(-text => "OK", -padx => "3m", -pady => "3m", + my $tf = $td->Scrolled("ROText", -width => 50, + -wrap => "none", + -scrollbars => "osoe" + )->pack(-expand => 1, -fill => "both"); + my $ok = $td->Button(-text => "OK", -padx => "3m", -pady => "3m", -command => sub { $td->destroy; }); # start the installation, read the output - $f2->pack; for (my $i = 0; $i < 100; $i++) { Tk::DoOneEvent(Tk::Event::DONT_WAIT); } @@ -252,7 +257,11 @@ Please wait, the output will appear here when ready.\n"); sub install_selected_packages { if (@_) { my @execlist; - push @execlist, "tlmgr", "--location", "$location", "install"; + push @execlist, "tlmgr", "--location", "$location"; + if ($debugmode) { + push @execlist, "-v"; + } + push @execlist, "install"; if ($opt_nodepends) { push @execlist, "--no-depends"; } @@ -264,7 +273,13 @@ sub install_selected_packages { sub update_selected_packages { if (@_) { - run_program_show_output("tlmgr", "--location", "$location", "update", @_); + my @execlist; + push @execlist, "tlmgr", "--location", "$location"; + if ($debugmode) { + push @execlist, "-v"; + } + push @execlist, "update", @_; + run_program_show_output(@execlist); reinit_local_tlpdb(); } } @@ -272,7 +287,11 @@ sub update_selected_packages { sub remove_selected_packages { if (@_) { my @execlist; - push @execlist, "tlmgr", "remove"; + if ($debugmode) { + push @execlist, "tlmgr", "-v", "remove"; + } else { + push @execlist, "tlmgr", "remove"; + } if ($opt_nodepends) { push @execlist, "--no-depends"; } diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 2f4994aadee..ec77cdc4a40 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -1265,11 +1265,11 @@ sub info { } sub debug { - logit(\*STDOUT, 1, @_); + logit(\*STDOUT, 1, "D:", @_); } sub ddebug { - logit(\*STDOUT, 2, @_); + logit(\*STDOUT, 2, "DD:", @_); } sub tlwarn { @@ -1286,7 +1286,7 @@ sub process_logging_options { $::opt_quiet = 0; # check all the command line options for occurrences of -q and -v # do not report errors - my $oldconfig = Getopt::Long::Configure(qw(pass_through)); + my $oldconfig = Getopt::Long::Configure(qw(pass_through permute)); GetOptions("v+" => \$::opt_verbosity, "q" => \$::opt_quiet); Getopt::Long::Configure($oldconfig); } |