gtkunixprint.PrintJob — an object that represents a print job (new in PyGTK 2.10)
class gtkunixprint.PrintJob( |
|
def callback( |
This class is available in PyGTK 2.10 and above.
A gtkunixprint.PrintJob
object represents a job that is sent to a printer. You only need to deal
directly with print jobs if you use the non-portable gtkunixprint.PrintUnixDialog
API.
Use the get_surface
()
method to obtain the cairo surface onto which the pages must be
drawn. Use the send
()
method to send the finished job to the printer. If you don't use cairo
gtkunixprint.PrintJob
also supports printing of manually generated postscript, via the set_source_file
()
method.
gtkunixprint.PrintJob(title
, printer
, settings
, page_setup
)
| the job title |
| a gtkunixprint.Printer |
| a gtk.PrintSettings |
| a gtk.PageSetup |
Returns : | a new gtkunixprint.PrintJob |
This constructor is available in PyGTK 2.10 and above.
Creates a new gtkunixprint.PrintJob
.
def get_settings()
Returns : | the settings of the print job |
This method is available in PyGTK 2.10 and above.
The get_settings
() method returns the
gtk.PrintSettings
of the print job.
def get_printer()
Returns : | the printer of the print job |
This method is available in PyGTK 2.10 and above.
The get_printer
() method returns the
gtkunixprint.Printer
of the print job.
def get_title()
Returns : | the title of the print job |
This method is available in PyGTK 2.10 and above.
The get_title
() method returns the
print job title.
def get_status()
Returns : | the status of the print job |
This method is available in PyGTK 2.10 and above.
The get_status
() method returns the
status of the print job.
def set_source_file(filename
)
| the file to be printed |
Returns : | False if an error
occurred |
This method is available in PyGTK 2.10 and above.
The set_source_file
() method makes the
gtkunixprint.PrintJob
send the existing document specified by
filename
to the printing system. The file can
be in any format understood by the platforms printing system
(typically PostScript, but on many platforms PDF may work too).
def get_surface()
Returns : | the cairo surface of the print job |
This method is available in PyGTK 2.10 and above.
The get_surface
() method returns a
cairo surface onto which the pages of the print job should be
rendered.
def set_track_print_status(track_status
)
| if True track the status of
the print job after sending |
This method is available in PyGTK 2.10 and above.
The set_track_print_status
() method
enable or disables tracking of the print job status based on the value
specified by track_status
. If
track_status
is True
, the
print job will try to continue report on the status of the print job
in the printer queues and printer. This can allow your application to
show things like "out of paper" issues, and when the print job
actually reaches the printer.
This method is often implemented using some form of polling, so tracking should not be enabled unless needed.
def get_track_print_status()
Returns : | True if print job status
will be reported after printing |
This method is available in PyGTK 2.10 and above.
The get_track_print_status
() method
returns wheter jobs will be tracked after printing. For details, see
the set_track_print_status()
method.
def send(callback
, user_data
=None)
| the function to call when the job completes |
| user data that gets passed to
callback |
Returns : | False if an error
occurred |
This method is available in PyGTK 2.10 and above.
The send
() method sends the print job
off to the printer and registers the function specified by
callback
ro be called when the job
completes.
The signature of callback
is:
def callback(print_job, data, errormsg):
where data
is
user_data
and errormsg
is a message indicating what problem has occurred or
None
if no error has occurred.
def callback(gtkprintjob
, user_param1
, ...
)
| the gtkprintjob that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "status-changed" signal is emitted when the status of a job
changes. The signal handler can use the get_status
()
method to obtain the new status.