summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorpad <pad@mandriva.com>1999-09-03 18:45:13 +0000
committerpad <pad@mandriva.com>1999-09-03 18:45:13 +0000
commit3a93e932ca7e557ba6f62f9764acde9fec97051d (patch)
tree0cef54a8b755702a751627e3fd9dc5020f3d3ef1 /perl-install
parentcb44eccff1c9027ba26bd3a23a137ea6a083ae9d (diff)
downloaddrakx-3a93e932ca7e557ba6f62f9764acde9fec97051d.tar
drakx-3a93e932ca7e557ba6f62f9764acde9fec97051d.tar.gz
drakx-3a93e932ca7e557ba6f62f9764acde9fec97051d.tar.bz2
drakx-3a93e932ca7e557ba6f62f9764acde9fec97051d.tar.xz
drakx-3a93e932ca7e557ba6f62f9764acde9fec97051d.zip
printer is better
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/install2.pm7
-rw-r--r--perl-install/install_steps.pm6
-rw-r--r--perl-install/install_steps_interactive.pm116
-rw-r--r--perl-install/printer.pm10
4 files changed, 121 insertions, 18 deletions
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index ee52781af..af172d770 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -242,11 +242,16 @@ my $default = {
lang => 'us',
isUpgrade => 0,
installClass => 'beginner',
- printer => {
+ printer => {
+ complete => 0,
str_type => $printer::printer_type[0],
QUEUE => "lp",
SPOOLDIR => "/var/spool/lpd/lp",
+ DBENTRY => "DeskJet670",
+ PAPERSIZE => "legal",
+ CRLF => 0,
},
+
# keyboard => 'de',
# display => "192.168.1.9:0",
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 8a912f680..ebae0afec 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -185,7 +185,11 @@ sub servicesConfig {}
sub printerConfig {
my($o) = @_;
my $printer = $o->default("printer");
- printer::configure_queue($printer) if $printer;
+ if ($o->{printer}{complete}) {
+ pkgs::select($o->{packages}, $o->{packages}{'rhs-printfilters'});
+ $o->installPackages($o->{packages});
+ printer::configure_queue($printer) if $o->{printer}{complete};
+ }
}
sub setRootPassword($) {
diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm
index 5cf31678a..529693ddf 100644
--- a/perl-install/install_steps_interactive.pm
+++ b/perl-install/install_steps_interactive.pm
@@ -149,6 +149,7 @@ sub printerConfig($) {
$o->{printer}{want});
return if !$o->{printer}{want};
+ $o->{printer}{complete} = 0;
#std info
#Don't wait, if the user enter something, you must remember it
#($o->{default}{printer}{QUEUE}, $o->{default}{printer}{SPOOLDIR}) =
@@ -184,26 +185,117 @@ sub printerConfig($) {
$string .= _("I detect :");
$string .= join(", ", @port);
+ $o->{printer}{DEVICE} ||= $o->{default}{printer}{DEVICE};
-
-
+
+ $o->ask_from_entries_ref(_("Local Printer Device"),
+ $string,
+ [_("Printer Device:")],
+ [\$o->{printer}{DEVICE}],
+ );
+
} elsif ($o->{printer}{TYPE} eq "REMOTE") {
+
+ } elsif ($o->{printer}{TYPE} eq "SMB") {
+ } elsif ($o->{printer}{TYPE} eq "NCP") {
}
+
+# printer::set_prefix($o->{prefix});
+ printer::read_printer_db();
+ my @entries_db_short = sort keys %printer::thedb;
+ my @entry_db_description = map { $printer::thedb{$_}{DESCR} } @entries_db_short;
+ my %descr_to_db = map { $printer::thedb{$_}{DESCR}, $_ } @entries_db_short;
+ my %db_to_descr = reverse %descr_to_db;
+ $o->{printer}{DBENTRY} ||= $o->{default}{printer}{DBENTRY};
+ $o->{printer}{DBENTRY} =
+ $descr_to_db{
+ $o->ask_from_list_(_("Configure Printer"),
+ _("What type of printer do you have?"),
+ [@entry_db_description],
+ $db_to_descr{$o->{printer}{DBENTRY}},
+ )
+ };
+
+ my %db_entry = %{$printer::thedb{$o->{printer}{DBENTRY}}};
+
+
+ #paper size conf
+ $o->{printer}{PAPERSIZE} ||= $o->{default}{printer}{PAPERSIZE};
+ $o->{printer}{PAPERSIZE} =
+ $o->ask_from_list_(_("Paper Size"),
+ _("Paper Size"),
+ \@printer::papersize_type,
+ $o->{printer}{PAPERSIZE}
+ );
-# $entry =
-# do {
-#
-# }
-#
-# if ($type eq "local") {
-#
-# }
- printer::set_prefix($o->{prefix});
- printer::read_printer_db();
+ #resolution size conf
+ $o->{printer}{RESOLUTION} ||= $o->{default}{printer}{RESOLUTION};
+
+ my @list_res = @{$db_entry{RESOLUTION}};
+ my @res = map { "${$_}{XDPI}x${$_}{YDPI}" } @list_res;
+ if (@list_res) {
+ $o->{printer}{RESOLUTION} = $o->ask_from_list_(_("Resolution"),
+ _("Resolution"),
+ \@res,
+ $o->{printer}{RESOLUTION},
+ );
+ } else {
+ $o->{printer}{RESOLUTION} = "Default";
+ }
+
+
+ #Fix ster stepping
+ # MAJOR HACK
+ # if the printer is an HP, let's do stairstep correction
+ $o->{printer}{CRLF} = $db_entry{DESCR} =~ /HP/;
+
+ $o->{printer}{CRLF} ||= $o->{default}{printer}{CRLF};
+ $o->{printer}{CRLF}= $o->ask_yesorno(_("CRLF"),
+ _("Fix stair-stepping of text?"),
+ $o->{printer}{CRLF});
+
+ #color_depth
+ $o->{printer}{BITSPERPIXEL} ||= $o->{default}{printer}{BITSPERPIXEL};
+ my @list_col = @{$db_entry{BITSPERPIXEL}};
+ my @col = map { "$_->{DEPTH} $_->{DESCR}" } @list_col;
+ my %col_to_depth = map { ("$_->{DEPTH} $_->{DESCR}", $_->{DEPTH}) } @list_col;
+ my %depth_to_col = reverse %col_to_depth;
+
+ if (@list_col) {
+ my $is_uniprint = $db_entry{GSDRIVER} eq "uniprint";
+ if ($is_uniprint) {
+ $o->{printer}{BITSPERPIXEL} =
+ $col_to_depth{$o->ask_from_list_
+ (_("Configure Uniprint Driver"),
+ _("You may now configure the uniprint options for this printer."),
+ \@col,
+ $depth_to_col{$o->{printer}{BITSPERPIXEL}},
+ )};
+
+ } else {
+ $o->{printer}{BITSPERPIXEL} =
+ $col_to_depth{$o->ask_from_list_
+ (_("Configure Color Depth"),
+ _("You may now configure the color options for this printer."),
+ \@col,
+ $depth_to_col{$o->{printer}{BITSPERPIXEL}},
+ )};
+
+
+
+
+ }
+ } else {
+ $o->{default}{printer}{BITSPERPIXEL} = "Default";
+ }
+
+
+ # $o->{printer}{complete} = 1;
$o->SUPER::printerConfig;
+
}
diff --git a/perl-install/printer.pm b/perl-install/printer.pm
index fc6fe1f73..a6aac75bf 100644
--- a/perl-install/printer.pm
+++ b/perl-install/printer.pm
@@ -3,7 +3,7 @@ package printer;
use diagnostics;
use strict;
-use vars qw(%thedb %printer_type %printer_type_inv);
+use vars qw(%thedb %printer_type %printer_type_inv @papersize_type);
########################################################################################
# misc imports
@@ -133,7 +133,7 @@ my %ex_printcap_entry =
RESOLUTION => "NAxNA", #ghostscript resolution to use
PAPERSIZE => "letter", #Papersize
BITSPERPIXEL => "necp2x6", #ghostscript color option
- CRLF => "YES" , #Whether or not to do CR/LF xlation
+ CRLF => 1 , #Whether or not to do CR/LF xlation
TYPE => "LOCAL",
@@ -196,6 +196,8 @@ my $PRINTER_NCP = "NCP";
%printer_type_inv = reverse %printer_type;
+@papersize_type = qw(letter legal ledger a3 a4);
+
########################################################################################
# GLOBALS
@@ -417,7 +419,7 @@ sub configure_queue($) {
($filein, $file) = &$get_name_file("textonly.cfg");
%fieldname = ();
$fieldname{textonlyoptions} = "";
- $fieldname{crlftrans} = $entry->{CRLF};
+ $fieldname{crlftrans} = $entry->{CRLF} ? "YES" : "";
$fieldname{textsendeof} = "1";
create_config_file($filein, $file, %fieldname);
@@ -464,7 +466,7 @@ sub configure_queue($) {
"{}",
$dbentry->{ENTRY},
$entry->{BITSPERPIXEL},
- ($entry->{CRLF} eq "YES") ? "1" : "";
+ $entry->{CRLF} ? "1" : "";
print PRINTCAP "$entry->{QUEUE}:\\\n";