File: install

package info (click to toggle)
libnewt-perl 1.08-9
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 404 kB
  • ctags: 656
  • sloc: ansic: 4,488; perl: 766; makefile: 43
file content (36 lines) | stat: -rwxr-xr-x 844 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl -w

use strict;
use Newt qw(:anchors :macros);

Newt::Init();
Newt::Cls();
Newt::DrawRootText(0, 0, "Installation example");
my @packages = ("Main", "Add-in 1", "Add-in 2", "Examples", "Extensions", 
		"Blah, blah");

my $i = 1;
my $alert = Newt::Panel(1, 2, 'Installation')
  ->Add(0, 0, Newt::Label('Installation complete'), 0, 0, 0, 0, 1)
  ->Add(0, 1, OK_BUTTON);
my $label = Newt::Label('Starting installation...');
my $scale = Newt::Scale(60, scalar(@packages));
my $main = Newt::Panel(1,2, 'Installation')
  ->Add(0, 0, $label, NEWT_ANCHOR_LEFT, 0, 0, 0, 1)
  ->Add(0, 1, $scale)
  ->Draw();

Newt::Refresh();
sleep 1;

foreach (@packages) {
  $main->Draw();
  Newt::Refresh();
  $label->Set("Installing component: $_");
  $scale->Set($i);
  select(undef, undef, undef, 0.25);
  $i++;
}

$alert->Run();
Newt::Finished();