/usr/share/perl5/XMLTV/ProgressBar/Tk.pm is in libxmltv-perl 0.5.70-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | # A wrapper around Tk::ProgressBar
package XMLTV::ProgressBar::Tk;
use strict;
use Tk;
use Tk::ProgressBar;
my $main_window;
my $tk_progressbar;
my $pid;
my $unused;
sub new {
my $class = shift;
my $self = {};
bless $self, $class;
$self->_init(@_);
}
sub _init {
my $self = shift;
# Term::ProgressBar V1 Compatibility
if (@_==2) {
return $self->_init({count => $_[1], name => $_[0],
term_width => 50, bar_width => 50,
major_char => '#', minor_char => '',
lbrack => '', rbrack => '',
term => 0, })
}
my %params = %{$_[0]};
my $main_window = MainWindow->new;
$main_window->title("Please Wait");
$main_window->minsize(qw(400 250));
$main_window->geometry('+250+150');
my $top_frame = $main_window->Frame()->pack;
my $middle_frame = $main_window->Frame()->pack( -fill => "x" );
my $bottom_frame = $main_window->Frame()->pack(-side => 'bottom');
$top_frame->Label(-height => 2)->pack;
$top_frame->Label(-text => $params{name})->pack;
my $tk_progressbar = $middle_frame->ProgressBar(
-width => 20,
-height => 300,
-from => 0,
-to => $params{count},
-variable => \$unused
)->pack( -fill=>"x", -pady => 24, -padx => 8 );
$self->{main_window} = $main_window;
$self->{tk_progressbar} = $tk_progressbar;
$main_window->update();
return $self;
}
sub update {
my $self = shift;
my $set_to_value = shift;
if (not $set_to_value) {
$set_to_value = $self->{tk_progressbar}->value + 1;
}
$self->{tk_progressbar}->value( $set_to_value );
$self->{main_window}->update();
}
sub finish {
my $self = shift;
$self->{main_window}->destroy();
}
1;
|