gtk.unixprint.PrintJob

gtk.unixprint.PrintJob — an object that represents a print job (new in PyGTK 2.10)

Synopsis

class gtk.unixprint.PrintJob(gobject.GObject):
    gtk.unixprint.PrintJob(title, printer, settings, page_setup)
def get_settings()
def get_printer()
def get_title()
def get_status()
def set_source_file(filename)
def get_surface()
def set_track_print_status(track_status)
def get_track_print_status()
def send(callback, user_data=None)

Ancestry

+-- gobject.GObject
  +-- gtk.unixprint.PrintJob

gtk.unixprint.PrintJob Properties

"page-setup"Read-Write-Construct OnlyThe Page Setup. Available in GTK+ 2.10.
"printer"Read-Write-Construct OnlyThe Printer to print the job to. Available in GTK+ 2.10.
"settings"Read-Write-Construct OnlyThe Printer Settings. Available in GTK+ 2.10.
"title"Read-Write-Construct OnlyTitle of the print job. Default value: None. Available in GTK+ 2.10.
"track-print-status"Read-Writeif TRUE the print job will continue to emit status-changed signals after the print data has been sent to the printer or print server. Available in GTK+ 2.10.

gtk.unixprint.PrintJob Signal Prototypes

gobject.GObject Signal Prototypes

"status-changed" def callback(printjob, user_param1, ...)

Description

Note

This class is available in PyGTK 2.10 and above.

A gtk.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 gtk.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 gtk.PrintJob also supports printing of manually generated postscript, via the set_source_file() method.

Constructor

gtk.unixprint.PrintJob

    gtk.unixprint.PrintJob(title, printer, settings, page_setup)
title :the job title
printer :a gtk.unixprint.Printer
settings :a gtk.PrintSettings
page_setup :a gtk.PageSetup
Returns :a new gtk.unixprint.PrintJob

Note

This constructor is available in PyGTK 2.10 and above.

Creates a new gtk.unixprint.PrintJob.

Methods

gtk.unixprint.PrintJob.get_settings

    def get_settings()
Returns :the settings of the print job

Note

This method is available in PyGTK 2.10 and above.

The get_settings() method returns the gtk.PrintSettings of the print job.

gtk.unixprint.PrintJob.get_printer

    def get_printer()
Returns :the printer of the print job

Note

This method is available in PyGTK 2.10 and above.

The get_printer() method returns the gtk.unixprint.Printer of the print job.

gtk.unixprint.PrintJob.get_title

    def get_title()
Returns :the title of the print job

Note

This method is available in PyGTK 2.10 and above.

The get_title() method returns the print job title.

gtk.unixprint.PrintJob.get_status

    def get_status()
Returns :the status of the print job

Note

This method is available in PyGTK 2.10 and above.

The get_status() method returns the status of the print job.

gtk.unixprint.PrintJob.set_source_file

    def set_source_file(filename)
filename :the file to be printed
Returns :FALSE if an error occurred

Note

This method is available in PyGTK 2.10 and above.

The set_source_file() method makes the gtk.unixprint.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).

gtk.unixprint.PrintJob.get_surface

    def get_surface()
Returns :the cairo surface of the print job

Note

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.

gtk.unixprint.PrintJob.set_track_print_status

    def set_track_print_status(track_status)
track_status :if TRUE track the status of the print job after sending

Note

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.

gtk.unixprint.PrintJob.get_track_print_status

    def get_track_print_status()
Returns :TRUE if print job status will be reported after printing

Note

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.

gtk.unixprint.PrintJob.send

    def send(callback, user_data=None)
callback :the function to call when the job completes
user_data :user data that gets passed to callback
Returns :FALSE if an error occurred

Note

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.

Signals

The "status-changed" Signal

    def callback(gtkprintjob, user_param1, ...)
gtkprintjob :the gtkprintjob that received the signal
user_param1 :the first user parameter (if any) specified with the connect() method
... :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.