Pagina 1 di 2

livello inchiostro

Inviato: mercoledì 28 luglio 2010, 18:07
da gzn89
dopo una esperienza con windows seven, sono ritornato al mio caro ubuntu.
solo che ho un problema con la stampante, cioè non riesco a vedere il livello di inchiostro. in automatico ubuntu mi riconosce sia la stampante e sia lo scanner (è una multifunzione) solo che non mi fa vedere il livello di inchiostro il che è un problema. come posso risolverlo?
stampante: epson stylus dx3800.
grazie a tutti

Re: livello inchiostro

Inviato: mercoledì 28 luglio 2010, 18:14
da culungioni
gzn89 ha scritto: dopo una esperienza con winzoz seven, sono ritornato al mio caro ubuntu.
solo che ho un problema con la stampante, cioè non riesco a vedere il livello di inchiostro. in automatico ubuntu mi riconosce sia la stampante e sia lo scanner (è una multifunzione) solo che non mi fa vedere il livello di inchiostro il che è un problema. come posso risolverlo?
stampante: epson stylus dx3800.
grazie a tutti
Ciao,
Prova su:
Sistema > Amministrazione > Stampa > Proprietà > Livelli di inchiostro

Re: livello inchiostro

Inviato: giovedì 29 luglio 2010, 15:54
da gzn89
ti ringrazio per la risposta ma mi dice questo:
Gli indicatore di livello non sono disponibili per questo modello.
posso fare pulisci testine, ma non posso vedere il livello di inchiostro.
esiste qualche programma?

Re: livello inchiostro

Inviato: martedì 3 agosto 2010, 21:04
da jacko on tour
ho una stampante Epson D78 (e uso i driver della D68) ..per il livello degli inchiostri prova questo tentativo... a me funziona..
da terminale digita

Codice: Seleziona tutto

sudo apt-get install ink
e dopo l'installazione

Codice: Seleziona tutto

ink -p usb
per gli usi successivi ovviamente basta solo quest'ultimo comando

Re: livello inchiostro

Inviato: mercoledì 4 agosto 2010, 0:07
da culungioni
jacko on tour ha scritto: ho una stampante Epson D78 (e uso i driver della D68) ..per il livello degli inchiostri prova questo tentativo... a me funziona..
da terminale digita

Codice: Seleziona tutto

sudo apt-get install ink
e dopo l'installazione

Codice: Seleziona tutto

ink -p usb
per gli usi successivi ovviamente basta solo quest'ultimo comando
Ciao e grazie per la dritta jacko,
ink funziona anche con la mia HP Photosmart C4480
NB
Senza sudo non mi funziona...

Codice: Seleziona tutto

sudo ink -p usb

Re: livello inchiostro

Inviato: domenica 26 settembre 2010, 13:57
da dring
per i livelli di inchiostro delle stampanti è utile QInk:
http://linuxfreedomforlive.blogspot.com/2010/09/ubuntu-controllare-il-livello-d-della.html

le stampanti supportate sono qui Liblinklevel:
http://libinklevel.sourceforge.net/#supported

Re: livello inchiostro

Inviato: sabato 27 agosto 2011, 19:30
da rubyo
Ciao,riesumo questo post perchè volendo vedere anchio i livelli dell'inchiostro della mia Epson Stylus Photo P50 ho installato questo programma,però non mi vede la stampante...
In effetti nella pagina delle stampanti supportate la mia non c'è... :'(
...ma almeno non la trovo in quelle non supportate.. :)
http://libinklevel.sourceforge.net/#unsupported
In alternativa mi era stato già suggerito tempo fa un'opzione da terminale che ora non ricordo...
Ho provato anche da terminale
andrea@andrea-ubuntu:~$ escputil -e -r /dev/usb/lp0
Escputil version 5.2.6, Copyright (C) 2000-2006 Robert Krawitz
Escputil comes with ABSOLUTELY NO WARRANTY; for details type 'escputil -l'
This is free software, and you are welcome to redistribute it
under certain conditions; type 'escputil -l' for details.

Impossibile aprire /dev/usb/lp0 in lettura/scrittura: Permesso negato
andrea@andrea-ubuntu:~$
Ho trovato  il comando che mi era stato consigliato ma mi da errore:
http://forum.ubuntu-it.org/viewtopic.php?t=471804
andrea@andrea-ubuntu:~$ sudo ink -p usb
Unknown IEEE 1284.4 error number 66
Could not read from printer.
Could not get ink level.
andrea@andrea-ubuntu:~$

Re: livello inchiostro

Inviato: sabato 27 agosto 2011, 22:01
da cristian_c
rubyo ha scritto: Ciao,riesumo questo post perchè volendo vedere anchio i livelli dell'inchiostro della mia Epson Stylus Photo P50 ho installato questo programma,però non mi vede la stampante...
In effetti nella pagina delle stampanti supportate la mia non c'è... :'(
...ma almeno non la trovo in quelle non supportate.. :)
http://libinklevel.sourceforge.net/#unsupported
In alternativa mi era stato già suggerito tempo fa un'opzione da terminale che ora non ricordo...
Ho provato anche da terminale
andrea@andrea-ubuntu:~$ escputil -e -r /dev/usb/lp0
Escputil version 5.2.6, Copyright (C) 2000-2006 Robert Krawitz
Escputil comes with ABSOLUTELY NO WARRANTY; for details type 'escputil -l'
This is free software, and you are welcome to redistribute it
under certain conditions; type 'escputil -l' for details.

Impossibile aprire /dev/usb/lp0 in lettura/scrittura: Permesso negato
andrea@andrea-ubuntu:~$
Ho trovato  il comando che mi era stato consigliato ma mi da errore:
http://forum.ubuntu-it.org/viewtopic.php?t=471804
andrea@andrea-ubuntu:~$ sudo ink -p usb
Unknown IEEE 1284.4 error number 66
Could not read from printer.
Could not get ink level.
andrea@andrea-ubuntu:~$
riguardo escputil, hai seguito il wiki? :D

Re: livello inchiostro

Inviato: sabato 27 agosto 2011, 22:20
da rubyo
Cavoli ora ho riprovato col comando e il livello ora me lo da...
andrea@andrea-ubuntu:~$ sudo ink -p usb
ink 0.5.1 (c) 2010 Markus Heinz

EPSON Epson Stylus Photo P50

Yellow:                         6%
Photoblack:                     9%
Light Cyan:                    21%
Light Magenta:                 21%
Magenta:                       21%
Cyan:                          21%
andrea@andrea-ubuntu:~$
...che sarà mai successo??? ???

Re: livello inchiostro

Inviato: sabato 27 agosto 2011, 23:15
da cristian_c
rubyo ha scritto: Cavoli ora ho riprovato col comando e il livello ora me lo da...
andrea@andrea-ubuntu:~$ sudo ink -p usb
ink 0.5.1 (c) 2010 Markus Heinz

EPSON Epson Stylus Photo P50

Yellow:                         6%
Photoblack:                     9%
Light Cyan:                    21%
Light Magenta:                 21%
Magenta:                       21%
Cyan:                          21%
andrea@andrea-ubuntu:~$
...che sarà mai successo??? ???
Hardware/StampantiScanner/StrumentiStampanti  ;D
Se al primo tentativo dovesse apparire un messaggio di errore come questo:

ink v0.4.1 � 2007 Markus Heinz

Unknown IEEE 1284.4 error number 66
Could not read from printer.
Could not get ink level.

provare a ripetere nuovamente il comando.
la guida l'ho scritta io e pensa che mi ero pure dimenticato di questo passaggio  (rotfl)

Re: livello inchiostro

Inviato: domenica 28 agosto 2011, 11:32
da Diabolik62
ci sarebbe anche questo script per le epson

Codice: Seleziona tutto

#!/usr/bin/perl -w
#######################################
#
#  Escputil Gtk Perl FrontEnd
# 
#  Copyright (C) Justin Ribeiro <ribeiro@J5studios.com>
#  Project Page - http://www.j5studios.com/escputl/index.php  
# 	  
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License
#   as published by the Free Software Foundation; either version 2 of
#   the License or (at your option) any later version.
#   
#   This program is distributed in the hope that it will be
#   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
#   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#   
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
#   USA
#
#   02/06/2003
#	JDR - Need to fix align functionality.  Been disabled for the time being.
# 
#  This software is a front end to Robert Krawitz's superb program
#  escputil, which is part of the gimp-print project.  You'll need
#  escputil to use this program, because this script is only a 
#  simple Gtk Perl frontend to escputil.
# 
#  This program was written because I wanted a small little script to 
#  get ink levels, that didn't require many dependencies.  While I was
#  at it, I added some buttons for functions such as test print, cleaning 
#  heads and print head alignment.  
#
#  You must set the variables below for your specific printer.  
#  Tested with:
#
#	Epson Stylus Photo 785EPX  
#  	Epson Stylus C42UX
#  
#  Simply chmod +x this file, and you should be able to run it.
#
#  Feel free to make changes and additions;  I'm open to suggestions
#  and fixes.  Released under the GPL License.  Use at your own risk. 
#
#######################################
#  
#  Ported to Gtk2 by LuYu. 15 12 2003
#  
#  

#######################################
use Gtk2 '-init';
use strict;

######################################
#
# Set these variables
#
######################################

# The name of your printer
my $PrinterName = "Epson Stylus Color670";	

# Raw printer device (i.e. If USB: /dev/usb/lp0 If Parallel: /dev/lpd0)
my $RawDevice = "/dev/usb/lp0";		

# If USB printer, set to 1
my $USBp = "1";

# Path to escputil
# Default usually is /usr/local/bin/escputil
# Could be also /usr/bin/escputil
# run " which escputil " without quotes on command line to find your path.
#
my $escputil = "/usr/bin/escputil";
######################################


######################################
# Editing below this line could be a hazard....
######################################
my $false = 0;
my $true = 1;
my $Uvar = "";
my $window;
my $box1;
my $box2;
my $label;
my $button1; # Test
my $button2; # Clean
my $button3; # Align
my $frame;    # Ink Level Frame
my $table;     # Printer Name 1x2	
my $table2;   # Ink Levels 4x2

##### Ink Levels and Labels Vars
my @percents;
my $in; 
my $labelB;
my $labelC;
my $labelM;
my $labelY;
my $progressB;
my $progressC;
my $progressM;
my $progressY;
my $percentageB;
my $percentageC;
my $percentageM;
my $percentageY;

##### Sub Confirm Windows Vars
my $dialogCD;
my $buttonOK;
my $buttonCA;
my $labelNW;
my $labelNL;
my $labelBP;
my $labelNN;

##### Sub error_message Vars
my $dialogEW;
my $buttonEW;
my $labelEW;
my $title;
my $message;

my $PrinterModel = "";

# Set the -u if we need it
if ($USBp == "1"){
	my $Uvar = "-u";
} else {
	my $Uvar = "";
}


# Create the window
my $window = Gtk2::Window->new( "toplevel" );
# $window = new Gtk2::Window( "toplevel" );
$window->signal_connect ( destroy => sub { Gtk2->main_quit; } );

# $window->signal_connect( "delete_event", sub { Gtk2->exit( 0 ); } );

$window->set_title( "$PrinterName" );
#$window->set_usize( 225, 225 );
#$window->border_width( 5 );

$box1 = new Gtk2::VBox( $false, 5 );
$box1->show();

$box2 = new Gtk2::VBox( $false, 10 );
#$box2->border_width( 0 );
$box1->pack_start( $box2, $false, $false, 0 );
$box2->show();
$window->add( $box1 );

$table = new Gtk2::Table( 1, 2, $true );
$box2->pack_start( $table, $true, $true, 0 ); 

# create a label
$label = new Gtk2::Label( " $PrinterName " );
$label->set_justify( 'left' );
$table->attach( $label, 0, 2, 0, 1, "fill", "fill", 0,0 );
$label->show();

$table->show();

$box2 = new Gtk2::HBox( $false, 10 );
#$box2->border_width( 5 );
$box1->pack_start( $box2, $false, $true, 0 );
$box2->show();

# Create test page print button
$button1 = new Gtk2::Button( "Test" );
$button1->signal_connect( "clicked",  \&confirm_test_print);

$box2->pack_start( $button1, $true, $true, 0 );
$button1->show();
$window->show();

# Create clean print head button
$button2 = new Gtk2::Button( "Clean" );
$button2->signal_connect( "clicked", \&confirm_clean_heads );

$box2->pack_start( $button2, $true, $true, 0 );
$button2->show();
$window->show();

# Create align print head button
$button3 = new Gtk2::Button( "Align" );
$button3->signal_connect( "clicked", \&confirm_align_heads );

#$box2->pack_start( $button3, $true, $true, 0 );
#$button3->show();
$window->show();

# Ink Levels Frame
$frame = new Gtk2::Frame( "Ink Levels" );
$table2 = new Gtk2::Table( 4, 2, $false );
$table2->set_row_spacings( "10" );
$table2->set_col_spacings( "5" ); 

# create Black Ink Label
$labelB = new Gtk2::Label("Black ");
$labelB->set_justify( 'left' );
$table2->attach( $labelB, 0, 1, 0, 1, "fill", "fill", 0,0 );
$labelB->show();

# create a Cyan Ink Label
$labelC = new Gtk2::Label("Cyan ");
$labelC->set_justify( 'left' );
$table2->attach( $labelC, 0, 1, 1, 2, "fill", "fill", 0,0 );
$labelC->show();

# create a Magenta Ink Label
$labelM = new Gtk2::Label("Magenta ");
$labelM->set_justify( 'right' );
$table2->attach( $labelM, 0, 1, 2, 3, "fill", "fill", 0,0 );
$labelM->show();

# create a Yellow Ink Label
$labelY = new Gtk2::Label("Yellow ");
$labelY->set_justify( 'left' );
$table2->attach( $labelY, 0, 1, 3, 4, "fill", "fill", 0,0 );
$labelY->show();

# get percents
my @output = `$escputil -r $RawDevice -u -i -q`;
   foreach $in (@output){
 	$in =~ s/\n//g ;
 	$in =~ s/[A-z]//g;
  	$in =~ s/ //g;
  	unshift(@percents, $in);
    }

######
# create Black ProgressBar
$percentageB = $percents[3];
# if ( $percents[3] == 100 )
# {
#   $percentageB = "1.0";
# }

# else
# {
#   $percentageB = "0." . $percents[3];
# }
$progressB = new Gtk2::ProgressBar;
$progressB->set_fraction( $percentageB/100 );
$progressB->set_text( "$percentageB %" );
$table2->attach( $progressB, 1, 2, 0, 1, "fill", "fill", 0,0 );
$progressB->show();

# create Cyan ProgressBar
# if ($percents[0] == 100){
# $percentageC = "1.0";
# } else {
# $percentageC = "0." . $percents[0];
# }
$percentageC = $percents[2];
$progressC = new Gtk2::ProgressBar;
$progressC->set_fraction( $percentageC/100 );
$progressC->set_text( "$percentageC %" );
$table2->attach( $progressC, 1, 2, 1, 2, "fill", "fill", 0,0 );
$progressC->show();

# create Magenta ProgressBar
# if ($percents[1] == 100){
# $percentageM = "1.0";
# } else {
# $percentageM = "0." . $percents[1];
# }
$percentageM = $percents[1];
$progressM = new Gtk2::ProgressBar;
$progressM->set_fraction( $percentageM/100 );
$progressM->set_text( "$percentageM %" );
$table2->attach( $progressM, 1, 2, 2, 3, "fill", "fill", 0,0 );
$progressM->show();

# create Yellow ProgressBar
# if ($percents[0] == 100){
# $percentageY = "1.0";
# } else {
# $percentageY = "0." . $percents[2];
# }
$percentageY = $percents[0];
$progressY = new Gtk2::ProgressBar;
$progressY->set_fraction( $percentageY/100 );
$progressY->set_text( "$percentageY %" );
$table2->attach( $progressY, 1, 2, 3, 4, "fill", "fill", 0,0 );
$progressY->show();

$table->show();
$frame->add( $table2 );
$box1->pack_start( $frame, $false, $false, 0 );
$window->show_all();

# main Gtk2;
Gtk2->main;
exit( 0 );

# Confirm Test Print Message
sub confirm_test_print{

	$dialogCD = new Gtk2::Dialog();
 	$dialogCD->set_modal(1);
	$dialogCD->set_title("Confirm Test Print");
 	$buttonOK = new Gtk2::Button( "Continue" );
  	$buttonOK->signal_connect( "clicked", \&test_print );
   	$buttonCA = new Gtk2::Button( "Cancel" );
    	$buttonCA->signal_connect( "clicked", \&cancel );
     	$dialogCD->action_area->pack_start( $buttonOK, $true, $true, 0 );
      	$dialogCD->action_area->pack_start( $buttonCA, $true, $true, 0 );
       	$buttonOK->show();
       	$buttonCA->show();

       $labelNW = new Gtk2::Label( "\n You are about to print a test page. \n" );
       $labelNL = new Gtk2::Label( "Please make sure you have a piece of paper in the printer. \n" );
       $labelBP = new Gtk2::Label( "When you are ready, hit continue below. \n" );
       $dialogCD->vbox->pack_start( $labelNW, $true, $true, 0 );
       $dialogCD->vbox->pack_start( $labelNL, $true, $true, 0 );
       $dialogCD->vbox->pack_start( $labelBP, $true, $true, 0 );
       $labelNW->show();
       $labelNL->show();
       $labelBP->show();
       $dialogCD->show();
       main Gtk2;
}

# Confirm Clean Heads Message
sub confirm_clean_heads{

	$dialogCD = new Gtk2::Dialog();
 	$dialogCD->set_modal(1);
	$dialogCD->set_title("Confirm Clean Heads");
 	$buttonOK = new Gtk2::Button( "Continue" );
  	$buttonOK->signal_connect( "clicked", \&clean_heads );
   	$buttonCA = new Gtk2::Button( "Cancel" );
    	$buttonCA->signal_connect( "clicked", \&cancel );
     	$dialogCD->action_area->pack_start( $buttonOK, $true, $true, 0 );
      	$dialogCD->action_area->pack_start( $buttonCA, $true, $true, 0 );
       	$buttonOK->show();
       	$buttonCA->show();

       $labelNW = new Gtk2::Label( "\n You are about to clean the print heads. \n" );
       $labelBP = new Gtk2::Label( "When you are ready, hit continue below. \n" );
       $dialogCD->vbox->pack_start( $labelNW, $true, $true, 0 );
       $dialogCD->vbox->pack_start( $labelBP, $true, $true, 0 );
       $labelNW->show();
       $labelBP->show();
       $dialogCD->show();
       main Gtk2;
}

# Confirm Align Print Heads Message
sub confirm_align_heads{



	$dialogCD = new Gtk2::Dialog();
 	$dialogCD->set_modal(1);
	$dialogCD->set_title("Confirm Align Heads");
 	$buttonOK = new Gtk2::Button( "Continue" );
  	$buttonOK->signal_connect( "clicked", \&align_heads );
   	$buttonCA = new Gtk2::Button( "Cancel" );
    	$buttonCA->signal_connect( "clicked", \&cancel );
     	$dialogCD->action_area->pack_start( $buttonOK, $true, $true, 0 );
      	$dialogCD->action_area->pack_start( $buttonCA, $true, $true, 0 );
       	$buttonOK->show();
       	$buttonCA->show();

       $labelNW = new Gtk2::Label( "\n You are about to align the print heads." );
       $labelNN = new Gtk2::Label( "\n THIS CAN BE DANGEROUS IF NOT SETUP CORRECTLY!!!!" );
       $labelNL = new Gtk2::Label( "\n Please read the notice in this program before attempting! \n" );
       $labelBP = new Gtk2::Label( "When you are ready, hit continue below. \n" );
       $dialogCD->vbox->pack_start( $labelNW, $true, $true, 0 );
       $dialogCD->vbox->pack_start( $labelNN, $true, $true, 0 );
       $dialogCD->vbox->pack_start( $labelNL, $true, $true, 0 );
       $dialogCD->vbox->pack_start( $labelBP, $true, $true, 0 );
       $labelNW->show();
       $labelNN->show();
       $labelNL->show();
       $labelBP->show();
       $dialogCD->show();
       main Gtk2;
}

# Error Window
sub error_message{

	($title, $message) = @_;
       $dialogEW = new Gtk2::Dialog();
       $dialogEW->set_modal(1);
       $dialogEW->set_title("Error: $title");
       $buttonEW = new Gtk2::Button( "OK" );
       $buttonEW->signal_connect( "clicked", \&HideButtonEvent );
       $dialogEW->action_area->pack_start( $buttonEW, $true, $true, 0 );
       $buttonEW->show();

       $labelEW = new Gtk2::Label( "$message" );
       $dialogEW->vbox->pack_start( $labelEW, $true, $true, 0 );
       $labelEW->show();
       $dialogEW->show();
       main Gtk2;
}

# Test Print Command
sub test_print{
	my $test_print = `$escputil -r $RawDevice $Uvar -n -q`;
	$dialogCD->hide;
}

# Clean Heads Command
sub clean_heads{
	my $clean_heads = `$escputil -r $RawDevice $Uvar -c -q`;
	$dialogCD->hide;
}

# Align Heads Command
sub align_heads{
	if ($PrinterModel != ""){
	my $align_heads = `$escputil -m $PrinterModel -a -q`;
	$dialogCD->hide;
	} else {
	my $align_heads = `$escputil -r $RawDevice $Uvar -a -q`;
	$dialogCD->hide;
	}
}

# Cancel Command
sub cancel{
	$dialogCD->hide;
}

# Hide the Error Message Window
sub HideButtonEvent{
   $dialogEW->hide;
}
	



Re: livello inchiostro

Inviato: domenica 28 agosto 2011, 11:38
da cristian_c
Diabolik62 ha scritto: ci sarebbe anche questo script per le epson

Codice: Seleziona tutto

#!/usr/bin/perl -w
#######################################
#
#  Escputil Gtk Perl FrontEnd
# 
#  Copyright (C) Justin Ribeiro <ribeiro@J5studios.com>
#  Project Page - http://www.j5studios.com/escputl/index.php  
# 	  
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License
#   as published by the Free Software Foundation; either version 2 of
#   the License or (at your option) any later version.
#   
#   This program is distributed in the hope that it will be
#   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
#   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#   
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
#   USA
#
#   02/06/2003
#	JDR - Need to fix align functionality.  Been disabled for the time being.
# 
#  This software is a front end to Robert Krawitz's superb program
#  escputil, which is part of the gimp-print project.  You'll need
#  escputil to use this program, because this script is only a 
#  simple Gtk Perl frontend to escputil.
# 
#  This program was written because I wanted a small little script to 
#  get ink levels, that didn't require many dependencies.  While I was
#  at it, I added some buttons for functions such as test print, cleaning 
#  heads and print head alignment.  
#
#  You must set the variables below for your specific printer.  
#  Tested with:
#
#	Epson Stylus Photo 785EPX  
#  	Epson Stylus C42UX
#  
#  Simply chmod +x this file, and you should be able to run it.
#
#  Feel free to make changes and additions;  I'm open to suggestions
#  and fixes.  Released under the GPL License.  Use at your own risk. 
#
#######################################
#  
#  Ported to Gtk2 by LuYu. 15 12 2003
#  
#  

#######################################
use Gtk2 '-init';
use strict;

######################################
#
# Set these variables
#
######################################

# The name of your printer
my $PrinterName = "Epson Stylus Color670";	

# Raw printer device (i.e. If USB: /dev/usb/lp0 If Parallel: /dev/lpd0)
my $RawDevice = "/dev/usb/lp0";		

# If USB printer, set to 1
my $USBp = "1";

# Path to escputil
# Default usually is /usr/local/bin/escputil
# Could be also /usr/bin/escputil
# run " which escputil " without quotes on command line to find your path.
#
my $escputil = "/usr/bin/escputil";
######################################


######################################
# Editing below this line could be a hazard....
######################################
my $false = 0;
my $true = 1;
my $Uvar = "";
my $window;
my $box1;
my $box2;
my $label;
my $button1; # Test
my $button2; # Clean
my $button3; # Align
my $frame;    # Ink Level Frame
my $table;     # Printer Name 1x2	
my $table2;   # Ink Levels 4x2

##### Ink Levels and Labels Vars
my @percents;
my $in; 
my $labelB;
my $labelC;
my $labelM;
my $labelY;
my $progressB;
my $progressC;
my $progressM;
my $progressY;
my $percentageB;
my $percentageC;
my $percentageM;
my $percentageY;

##### Sub Confirm Windows Vars
my $dialogCD;
my $buttonOK;
my $buttonCA;
my $labelNW;
my $labelNL;
my $labelBP;
my $labelNN;

##### Sub error_message Vars
my $dialogEW;
my $buttonEW;
my $labelEW;
my $title;
my $message;

my $PrinterModel = "";

# Set the -u if we need it
if ($USBp == "1"){
	my $Uvar = "-u";
} else {
	my $Uvar = "";
}


# Create the window
my $window = Gtk2::Window->new( "toplevel" );
# $window = new Gtk2::Window( "toplevel" );
$window->signal_connect ( destroy => sub { Gtk2->main_quit; } );

# $window->signal_connect( "delete_event", sub { Gtk2->exit( 0 ); } );

$window->set_title( "$PrinterName" );
#$window->set_usize( 225, 225 );
#$window->border_width( 5 );

$box1 = new Gtk2::VBox( $false, 5 );
$box1->show();

$box2 = new Gtk2::VBox( $false, 10 );
#$box2->border_width( 0 );
$box1->pack_start( $box2, $false, $false, 0 );
$box2->show();
$window->add( $box1 );

$table = new Gtk2::Table( 1, 2, $true );
$box2->pack_start( $table, $true, $true, 0 ); 

# create a label
$label = new Gtk2::Label( " $PrinterName " );
$label->set_justify( 'left' );
$table->attach( $label, 0, 2, 0, 1, "fill", "fill", 0,0 );
$label->show();

$table->show();

$box2 = new Gtk2::HBox( $false, 10 );
#$box2->border_width( 5 );
$box1->pack_start( $box2, $false, $true, 0 );
$box2->show();

# Create test page print button
$button1 = new Gtk2::Button( "Test" );
$button1->signal_connect( "clicked",  \&confirm_test_print);

$box2->pack_start( $button1, $true, $true, 0 );
$button1->show();
$window->show();

# Create clean print head button
$button2 = new Gtk2::Button( "Clean" );
$button2->signal_connect( "clicked", \&confirm_clean_heads );

$box2->pack_start( $button2, $true, $true, 0 );
$button2->show();
$window->show();

# Create align print head button
$button3 = new Gtk2::Button( "Align" );
$button3->signal_connect( "clicked", \&confirm_align_heads );

#$box2->pack_start( $button3, $true, $true, 0 );
#$button3->show();
$window->show();

# Ink Levels Frame
$frame = new Gtk2::Frame( "Ink Levels" );
$table2 = new Gtk2::Table( 4, 2, $false );
$table2->set_row_spacings( "10" );
$table2->set_col_spacings( "5" ); 

# create Black Ink Label
$labelB = new Gtk2::Label("Black ");
$labelB->set_justify( 'left' );
$table2->attach( $labelB, 0, 1, 0, 1, "fill", "fill", 0,0 );
$labelB->show();

# create a Cyan Ink Label
$labelC = new Gtk2::Label("Cyan ");
$labelC->set_justify( 'left' );
$table2->attach( $labelC, 0, 1, 1, 2, "fill", "fill", 0,0 );
$labelC->show();

# create a Magenta Ink Label
$labelM = new Gtk2::Label("Magenta ");
$labelM->set_justify( 'right' );
$table2->attach( $labelM, 0, 1, 2, 3, "fill", "fill", 0,0 );
$labelM->show();

# create a Yellow Ink Label
$labelY = new Gtk2::Label("Yellow ");
$labelY->set_justify( 'left' );
$table2->attach( $labelY, 0, 1, 3, 4, "fill", "fill", 0,0 );
$labelY->show();

# get percents
my @output = `$escputil -r $RawDevice -u -i -q`;
   foreach $in (@output){
 	$in =~ s/\n//g ;
 	$in =~ s/[A-z]//g;
  	$in =~ s/ //g;
  	unshift(@percents, $in);
    }

######
# create Black ProgressBar
$percentageB = $percents[3];
# if ( $percents[3] == 100 )
# {
#   $percentageB = "1.0";
# }

# else
# {
#   $percentageB = "0." . $percents[3];
# }
$progressB = new Gtk2::ProgressBar;
$progressB->set_fraction( $percentageB/100 );
$progressB->set_text( "$percentageB %" );
$table2->attach( $progressB, 1, 2, 0, 1, "fill", "fill", 0,0 );
$progressB->show();

# create Cyan ProgressBar
# if ($percents[0] == 100){
# $percentageC = "1.0";
# } else {
# $percentageC = "0." . $percents[0];
# }
$percentageC = $percents[2];
$progressC = new Gtk2::ProgressBar;
$progressC->set_fraction( $percentageC/100 );
$progressC->set_text( "$percentageC %" );
$table2->attach( $progressC, 1, 2, 1, 2, "fill", "fill", 0,0 );
$progressC->show();

# create Magenta ProgressBar
# if ($percents[1] == 100){
# $percentageM = "1.0";
# } else {
# $percentageM = "0." . $percents[1];
# }
$percentageM = $percents[1];
$progressM = new Gtk2::ProgressBar;
$progressM->set_fraction( $percentageM/100 );
$progressM->set_text( "$percentageM %" );
$table2->attach( $progressM, 1, 2, 2, 3, "fill", "fill", 0,0 );
$progressM->show();

# create Yellow ProgressBar
# if ($percents[0] == 100){
# $percentageY = "1.0";
# } else {
# $percentageY = "0." . $percents[2];
# }
$percentageY = $percents[0];
$progressY = new Gtk2::ProgressBar;
$progressY->set_fraction( $percentageY/100 );
$progressY->set_text( "$percentageY %" );
$table2->attach( $progressY, 1, 2, 3, 4, "fill", "fill", 0,0 );
$progressY->show();

$table->show();
$frame->add( $table2 );
$box1->pack_start( $frame, $false, $false, 0 );
$window->show_all();

# main Gtk2;
Gtk2->main;
exit( 0 );

# Confirm Test Print Message
sub confirm_test_print{

	$dialogCD = new Gtk2::Dialog();
 	$dialogCD->set_modal(1);
	$dialogCD->set_title("Confirm Test Print");
 	$buttonOK = new Gtk2::Button( "Continue" );
  	$buttonOK->signal_connect( "clicked", \&test_print );
   	$buttonCA = new Gtk2::Button( "Cancel" );
    	$buttonCA->signal_connect( "clicked", \&cancel );
     	$dialogCD->action_area->pack_start( $buttonOK, $true, $true, 0 );
      	$dialogCD->action_area->pack_start( $buttonCA, $true, $true, 0 );
       	$buttonOK->show();
       	$buttonCA->show();

       $labelNW = new Gtk2::Label( "\n You are about to print a test page. \n" );
       $labelNL = new Gtk2::Label( "Please make sure you have a piece of paper in the printer. \n" );
       $labelBP = new Gtk2::Label( "When you are ready, hit continue below. \n" );
       $dialogCD->vbox->pack_start( $labelNW, $true, $true, 0 );
       $dialogCD->vbox->pack_start( $labelNL, $true, $true, 0 );
       $dialogCD->vbox->pack_start( $labelBP, $true, $true, 0 );
       $labelNW->show();
       $labelNL->show();
       $labelBP->show();
       $dialogCD->show();
       main Gtk2;
}

# Confirm Clean Heads Message
sub confirm_clean_heads{

	$dialogCD = new Gtk2::Dialog();
 	$dialogCD->set_modal(1);
	$dialogCD->set_title("Confirm Clean Heads");
 	$buttonOK = new Gtk2::Button( "Continue" );
  	$buttonOK->signal_connect( "clicked", \&clean_heads );
   	$buttonCA = new Gtk2::Button( "Cancel" );
    	$buttonCA->signal_connect( "clicked", \&cancel );
     	$dialogCD->action_area->pack_start( $buttonOK, $true, $true, 0 );
      	$dialogCD->action_area->pack_start( $buttonCA, $true, $true, 0 );
       	$buttonOK->show();
       	$buttonCA->show();

       $labelNW = new Gtk2::Label( "\n You are about to clean the print heads. \n" );
       $labelBP = new Gtk2::Label( "When you are ready, hit continue below. \n" );
       $dialogCD->vbox->pack_start( $labelNW, $true, $true, 0 );
       $dialogCD->vbox->pack_start( $labelBP, $true, $true, 0 );
       $labelNW->show();
       $labelBP->show();
       $dialogCD->show();
       main Gtk2;
}

# Confirm Align Print Heads Message
sub confirm_align_heads{



	$dialogCD = new Gtk2::Dialog();
 	$dialogCD->set_modal(1);
	$dialogCD->set_title("Confirm Align Heads");
 	$buttonOK = new Gtk2::Button( "Continue" );
  	$buttonOK->signal_connect( "clicked", \&align_heads );
   	$buttonCA = new Gtk2::Button( "Cancel" );
    	$buttonCA->signal_connect( "clicked", \&cancel );
     	$dialogCD->action_area->pack_start( $buttonOK, $true, $true, 0 );
      	$dialogCD->action_area->pack_start( $buttonCA, $true, $true, 0 );
       	$buttonOK->show();
       	$buttonCA->show();

       $labelNW = new Gtk2::Label( "\n You are about to align the print heads." );
       $labelNN = new Gtk2::Label( "\n THIS CAN BE DANGEROUS IF NOT SETUP CORRECTLY!!!!" );
       $labelNL = new Gtk2::Label( "\n Please read the notice in this program before attempting! \n" );
       $labelBP = new Gtk2::Label( "When you are ready, hit continue below. \n" );
       $dialogCD->vbox->pack_start( $labelNW, $true, $true, 0 );
       $dialogCD->vbox->pack_start( $labelNN, $true, $true, 0 );
       $dialogCD->vbox->pack_start( $labelNL, $true, $true, 0 );
       $dialogCD->vbox->pack_start( $labelBP, $true, $true, 0 );
       $labelNW->show();
       $labelNN->show();
       $labelNL->show();
       $labelBP->show();
       $dialogCD->show();
       main Gtk2;
}

# Error Window
sub error_message{

	($title, $message) = @_;
       $dialogEW = new Gtk2::Dialog();
       $dialogEW->set_modal(1);
       $dialogEW->set_title("Error: $title");
       $buttonEW = new Gtk2::Button( "OK" );
       $buttonEW->signal_connect( "clicked", \&HideButtonEvent );
       $dialogEW->action_area->pack_start( $buttonEW, $true, $true, 0 );
       $buttonEW->show();

       $labelEW = new Gtk2::Label( "$message" );
       $dialogEW->vbox->pack_start( $labelEW, $true, $true, 0 );
       $labelEW->show();
       $dialogEW->show();
       main Gtk2;
}

# Test Print Command
sub test_print{
	my $test_print = `$escputil -r $RawDevice $Uvar -n -q`;
	$dialogCD->hide;
}

# Clean Heads Command
sub clean_heads{
	my $clean_heads = `$escputil -r $RawDevice $Uvar -c -q`;
	$dialogCD->hide;
}

# Align Heads Command
sub align_heads{
	if ($PrinterModel != ""){
	my $align_heads = `$escputil -m $PrinterModel -a -q`;
	$dialogCD->hide;
	} else {
	my $align_heads = `$escputil -r $RawDevice $Uvar -a -q`;
	$dialogCD->hide;
	}
}

# Cancel Command
sub cancel{
	$dialogCD->hide;
}

# Hide the Error Message Window
sub HideButtonEvent{
   $dialogEW->hide;
}
	


Fico lo script!  (good)

@rubyo,
se il rilevamento continua a funzionare con libinklevel puoi comunicare a markus heinz di inserire la tua stampante tra quelle supportate dalla libreria  (yes)

Re: livello inchiostro

Inviato: domenica 28 agosto 2011, 12:50
da Diabolik62
qualcuno sa dove inserire lo script o farlo partire gia con  i permessi dell'utente?mi spiego meglio se lo faccio partire con
sudo ~/nome script  parte se lo avvio senza password no

Re: livello inchiostro

Inviato: domenica 28 agosto 2011, 12:58
da cristian_c
Diabolik62 ha scritto: qualcuno sa dove inserire lo script o farlo partire gia con  i permessi dell'utente?mi spiego megli sel o facci partire con
sudo ~/nome script  parte se lo avvio sneza password no
non penso che vada messo in .bashrc  :-\ Ora non ricordo bene  :-[
Comunque ci vuole il sudo perché mi sembra che i monitor dei livelli vadano a scrivere sulla porta lp in /dev  :-\

Re: livello inchiostro

Inviato: domenica 28 agosto 2011, 13:26
da Mdfalcubo
Visto che il tuo hw funziona e che il problema riguarda più l'aspetto software o configurazione, sposto in software.

Re: livello inchiostro

Inviato: domenica 28 agosto 2011, 13:29
da Diabolik62
ho fatto questo procedura in maverick,copiato file della home in /etc/init.d/,dato nel teminale which escputil ,creato lanciatore sul pannello che prende script in /etc/init.d/,riavviato e lo script funziona, stessa procedura su lucid non funge ;D >:(

Re: livello inchiostro

Inviato: martedì 30 agosto 2011, 11:21
da rubyo
cristian_c ha scritto: @rubyo,
se il rilevamento continua a funzionare con libinklevel puoi comunicare a markus heinz di inserire la tua stampante tra quelle supportate dalla libreria  (yes)
Si l'ho fatto... ;)
Grazie degli aiuti....
:)

Re: livello inchiostro

Inviato: giovedì 10 novembre 2011, 20:26
da rubyo
Sono ancora alle prese con il comando a terminale che non mi da più i livelli dell'inchiostro della stampante.
Ho provato e riprovato (l'altra volta al max al terzo tentavivo funzionava) ma ancora ho questa risposta...
andrea@andrea-ubuntu:~$ sudo ink -p usb
[sudo] password for andrea:
Could not access '/dev/usb/lp0' or '/dev/usblp0'.
Could not get ink level.
naturalmente la stampante è collegata e funzionante... ;)

Che c'entri qualcosa l'aggiornamento di Ubuntu alla versione 11.10?
???

Re: livello inchiostro

Inviato: giovedì 10 novembre 2011, 20:39
da Mdfalcubo
Hai installato ink? Non penso che sia installato di default

Codice: Seleziona tutto

sudo apt-get install ink

Re: livello inchiostro

Inviato: giovedì 10 novembre 2011, 22:14
da rubyo
Grazie della risposta... ;)
Non era installato,ma stessa risposta a terminale... ???
andrea@andrea-ubuntu:~$ sudo ink -p usb
[sudo] password for andrea:
Could not access '/dev/usb/lp0' or '/dev/usblp0'.
Could not get ink level.