<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl -w
# This file was preprocessed, do not edit!


package Debconf::Element::Dialog::Progress;
use strict;
use base qw(Debconf::Element);


sub _communicate {
	my $this=shift;
	my $data=shift;
	my $dialoginput = $this-&gt;frontend-&gt;dialog_input_wtr;

	print $dialoginput $data;
}

sub _percent {
	my $this=shift;

	use integer;
	return (($this-&gt;progress_cur() - $this-&gt;progress_min()) * 100 / ($this-&gt;progress_max() - $this-&gt;progress_min()));
}

sub start {
	my $this=shift;

	$this-&gt;frontend-&gt;title($this-&gt;question-&gt;description);

	my ($text, $lines, $columns);
	if (defined $this-&gt;_info) {
		($text, $lines, $columns)=$this-&gt;frontend-&gt;sizetext($this-&gt;_info-&gt;description);
	} else {
		($text, $lines, $columns)=$this-&gt;frontend-&gt;sizetext(' ');
	}
	if ($this-&gt;frontend-&gt;screenwidth - $this-&gt;frontend-&gt;columnspacer &gt; $columns) {
		$columns = $this-&gt;frontend-&gt;screenwidth - $this-&gt;frontend-&gt;columnspacer;
	}

	my @params=('--gauge');
	push @params, $this-&gt;frontend-&gt;dashsep if $this-&gt;frontend-&gt;dashsep;
	push @params, ($text, $lines + $this-&gt;frontend-&gt;spacer, $columns, $this-&gt;_percent);

	$this-&gt;frontend-&gt;startdialog($this-&gt;question, 1, @params);

	$this-&gt;_lines($lines);
	$this-&gt;_columns($columns);
}

sub set {
	my $this=shift;
	my $value=shift;

	$this-&gt;progress_cur($value);
	$this-&gt;_communicate($this-&gt;_percent . "\n");

	return 1;
}

sub info {
	my $this=shift;
	my $question=shift;

	$this-&gt;_info($question);

	my ($text, $lines, $columns)=$this-&gt;frontend-&gt;sizetext($question-&gt;description);
	if ($lines &gt; $this-&gt;_lines or $columns &gt; $this-&gt;_columns) {
		$this-&gt;stop;
		$this-&gt;start;
	}


	$this-&gt;_communicate(
		sprintf("XXX\n%d\n%s\nXXX\n%d\n",
			$this-&gt;_percent, $text, $this-&gt;_percent));

	return 1;
}

sub stop {
	my $this=shift;

	$this-&gt;frontend-&gt;waitdialog;
	$this-&gt;frontend-&gt;title($this-&gt;frontend-&gt;requested_title);
}

1
</pre></body></html>