home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / perl5 / Debconf / Element / Gnome / Progress.pm < prev    next >
Encoding:
Perl POD Document  |  2006-07-24  |  1.1 KB  |  60 lines

  1. #!/usr/bin/perl -w
  2. # This file was preprocessed, do not edit!
  3.  
  4.  
  5. package Debconf::Element::Gnome::Progress;
  6. use strict;
  7. use Gtk2;
  8. use utf8;
  9. use Debconf::Encoding qw(to_Unicode);
  10. use base qw(Debconf::Element::Gnome);
  11.  
  12.  
  13. sub _fraction {
  14.     my $this=shift;
  15.  
  16.     return (($this->progress_cur() - $this->progress_min()) / ($this->progress_max() - $this->progress_min()));
  17. }
  18.  
  19. sub start {
  20.     my $this=shift;
  21.     my $description=to_Unicode($this->question->description);
  22.     my $frontend=$this->frontend;
  23.  
  24.     $this->SUPER::init(@_);
  25.     $this->multiline(1);
  26.     $this->expand(1);
  27.  
  28.     $frontend->title($description);
  29.  
  30.     $this->widget(Gtk2::ProgressBar->new());
  31.     $this->widget->show;
  32.     $this->widget->set_text(' ');
  33.     $this->addwidget($this->widget);
  34.     $this->addhelp;
  35. }
  36.  
  37. sub set {
  38.     my $this=shift;
  39.     my $value=shift;
  40.  
  41.     $this->progress_cur($value);
  42.     $this->widget->set_fraction($this->_fraction);
  43. }
  44.  
  45. sub info {
  46.     my $this=shift;
  47.     my $question=shift;
  48.  
  49.     $this->widget->set_text(to_Unicode($question->description));
  50. }
  51.  
  52. sub stop {
  53.     my $this=shift;
  54.     my $frontend=$this->frontend;
  55.  
  56.     $frontend->title($frontend->requested_title);
  57. }
  58.  
  59. 1;
  60.