From 60a03f6dd42238553aa7947c22a8d3b9384130d6 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Wed, 8 Aug 2001 23:33:03 +0000 Subject: Different choosable test pages available now --- perl-install/printer.pm | 13 +++++++++++-- perl-install/printerdrake.pm | 42 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 49 insertions(+), 6 deletions(-) (limited to 'perl-install') diff --git a/perl-install/printer.pm b/perl-install/printer.pm index 12e11f260..e916ce6df 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -673,8 +673,17 @@ sub print_pages($@) { # Print the pages foreach (@pages) { - run_program::rooted($prefix, $lpr, "-s", $printer->{SPOOLER}, - "-P", $queue, $_); + my $page = $_; + # Only text and PostScript can be printed directly with all spoolers, + # images must be treated seperately + if ($page =~ /\.jpg$/) { + system(($::testing ? "$prefix" : "chroot $prefix/ ") . + "convert $page -page 427x654+100+65 PS:- | " . + "$lpr -s $printer->{SPOOLER} -P $queue"); + } else { + run_program::rooted($prefix, $lpr, "-s", $printer->{SPOOLER}, + "-P", $queue, $page); + } } sleep 5; #- allow lpr to send pages. # Check whether the job is queued diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm index 903766afb..e511fc1f6 100644 --- a/perl-install/printerdrake.pm +++ b/perl-install/printerdrake.pm @@ -417,7 +417,6 @@ sub setup_gsdriver { if ((keys %printer::thedb) == 0) { printer::read_printer_db($printer->{SPOOLER}); } - my $testpage = "/usr/share/printer-testpages/testprint.ps"; my $queue = $printer->{OLD_QUEUE}; $in->set_help('configurePrinterType') if $::isInstall; while (1) { @@ -655,14 +654,49 @@ sub setup_gsdriver { $printer->{complete} = 1; printer::configure_queue($printer); $printer->{complete} = 0; - - if ($in->ask_yesorno('', __("Do you want to print a test page?"), 1)) { + # print test pages + my $standard = 1; + my $altletter = 0; + my $alta4 = 0; + my $photo = 0; + my $ascii = 0; + if ($in->ask_from_entries_refH_powered + ({ title => __("Test pages"), + messages => __("Please select the test pages you want to print. +Note: the photo test page can take a rather long time to get printed. +In most cases it is enough to print the standard test page."), + cancel => __("No test pages"), + ok => __("Print")}, +[ +{ text => __("Standard test page"), type => 'bool', val => \$standard }, +{ text => __("Alternative test page (Letter)"), type => 'bool', + val => \$altletter }, +{ text => __("Alternative test page (A4)"), type => 'bool', val => \$alta4 }, +{ text => __("Photo test page"), type => 'bool', val => \$photo }, +{ text => __("Plain text test page"), type => 'bool', val => \$ascii } +])) { +# if ($in->ask_yesorno('', __("Do you want to print a test page?"), 1)) { my @lpq_output; { my $w = $in->wait_message('', _("Printing test page(s)...")); $upNetwork and do { &$upNetwork(); undef $upNetwork; sleep(1) }; - @lpq_output = printer::print_pages($printer, $testpage); + my $stdtestpage = "/usr/share/printer-testpages/testprint.ps"; + my $altlttestpage = "/usr/share/printer-testpages/testpage.ps"; + my $alta4testpage = "/usr/share/printer-testpages/testpage-a4.ps"; + my $phototestpage = "/usr/share/printer-testpages/photo-testpage.jpg"; + my $asciitestpage = "/usr/share/printer-testpages/testpage.asc"; + my @testpages; + # Install the filter to convert the photo test page to PS + $photo && $in->do_pkgs->install('ImageMagick'); + # set up list of pages to print + $standard && push (@testpages, $stdtestpage); + $altletter && push (@testpages, $altlttestpage); + $alta4 && push (@testpages, $alta4testpage); + $photo && push (@testpages, $phototestpage); + $ascii && push (@testpages, $asciitestpage); + # print the stuff + @lpq_output = printer::print_pages($printer, @testpages); } if (@lpq_output) { -- cgit v1.2.1