Gtk.Printer

g GObject.Object GObject.Object Gtk.Printer Gtk.Printer GObject.Object->Gtk.Printer

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (name, backend, virtual_)

accepts_pdf ()

accepts_ps ()

compare (b)

get_backend ()

get_capabilities ()

get_default_page_size ()

get_description ()

get_hard_margins ()

get_hard_margins_for_paper_size (paper_size)

get_icon_name ()

get_job_count ()

get_location ()

get_name ()

get_state_message ()

has_details ()

is_accepting_jobs ()

is_active ()

is_default ()

is_paused ()

is_virtual ()

list_papers ()

request_details ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

accepting-jobs

bool

r

accepts-pdf

bool

r/w/co

accepts-ps

bool

r/w/co

icon-name

str

r

is-virtual

bool

r/w/co

job-count

int

r

location

str

r

name

str

r/w/co

paused

bool

r

state-message

str

r

Signals

Inherited:

GObject.Object (1)

Name

Short Description

details-acquired

Emitted in response to a request for detailed information about a printer from the print backend.

Fields

Inherited:

GObject.Object (1)

Class Details

class Gtk.Printer(**kwargs)
Bases:

GObject.Object

Abstract:

No

A GtkPrinter object represents a printer.

You only need to deal directly with printers if you use the non-portable [class`Gtk`.PrintUnixDialog] API.

A GtkPrinter allows to get status information about the printer, such as its description, its location, the number of queued jobs, etc. Most importantly, a GtkPrinter object can be used to create a [class`Gtk`.PrintJob] object, which lets you print to the printer.

classmethod new(name, backend, virtual_)[source]
Parameters:
  • name (str) – the name of the printer

  • backend (Gtk.PrintBackend) – a GtkPrintBackend

  • virtual (bool) – whether the printer is virtual

Returns:

a new GtkPrinter

Return type:

Gtk.Printer

Creates a new GtkPrinter.

accepts_pdf()[source]
Returns:

True if self accepts PDF

Return type:

bool

Returns whether the printer accepts input in PDF format.

accepts_ps()[source]
Returns:

True if self accepts PostScript

Return type:

bool

Returns whether the printer accepts input in PostScript format.

compare(b)[source]
Parameters:

b (Gtk.Printer) – another GtkPrinter

Returns:

0 if the printer match, a negative value if self < b, or a positive value if self > b

Return type:

int

Compares two printers.

get_backend()[source]
Returns:

the backend of self

Return type:

Gtk.PrintBackend

Returns the backend of the printer.

get_capabilities()[source]
Returns:

the printer’s capabilities

Return type:

Gtk.PrintCapabilities

Returns the printer’s capabilities.

This is useful when you’re using GtkPrintUnixDialog’s manual-capabilities setting and need to know which settings the printer can handle and which you must handle yourself.

This will return 0 unless the printer’s details are available, see [method`Gtk`.Printer.has_details] and [method`Gtk`.Printer.request_details].

get_default_page_size()[source]
Returns:

a newly allocated GtkPageSetup with default page size of the printer.

Return type:

Gtk.PageSetup

Returns default page size of self.

get_description()[source]
Returns:

the description of self

Return type:

str

Gets the description of the printer.

get_hard_margins()[source]
Returns:

True iff the hard margins were retrieved

top:

a location to store the top margin in

bottom:

a location to store the bottom margin in

left:

a location to store the left margin in

right:

a location to store the right margin in

Return type:

(bool, top: float, bottom: float, left: float, right: float)

Retrieve the hard margins of self.

These are the margins that define the area at the borders of the paper that the printer cannot print to.

Note: This will not succeed unless the printer’s details are available, see [method`Gtk`.Printer.has_details] and [method`Gtk`.Printer.request_details].

get_hard_margins_for_paper_size(paper_size)[source]
Parameters:

paper_size (Gtk.PaperSize) – a GtkPaperSize

Returns:

True iff the hard margins were retrieved

top:

a location to store the top margin in

bottom:

a location to store the bottom margin in

left:

a location to store the left margin in

right:

a location to store the right margin in

Return type:

(bool, top: float, bottom: float, left: float, right: float)

Retrieve the hard margins of self for paper_size.

These are the margins that define the area at the borders of the paper that the printer cannot print to.

Note: This will not succeed unless the printer’s details are available, see [method`Gtk`.Printer.has_details] and [method`Gtk`.Printer.request_details].

get_icon_name()[source]
Returns:

the icon name for self

Return type:

str

Gets the name of the icon to use for the printer.

get_job_count()[source]
Returns:

the number of jobs on self

Return type:

int

Gets the number of jobs currently queued on the printer.

get_location()[source]
Returns:

the location of self

Return type:

str

Returns a description of the location of the printer.

get_name()[source]
Returns:

the name of self

Return type:

str

Returns the name of the printer.

get_state_message()[source]
Returns:

the state message of self

Return type:

str

Returns the state message describing the current state of the printer.

has_details()[source]
Returns:

True if self details are available

Return type:

bool

Returns whether the printer details are available.

is_accepting_jobs()[source]
Returns:

True if self is accepting jobs

Return type:

bool

Returns whether the printer is accepting jobs

is_active()[source]
Returns:

True if self is active

Return type:

bool

Returns whether the printer is currently active (i.e. accepts new jobs).

is_default()[source]
Returns:

True if self is the default

Return type:

bool

Returns whether the printer is the default printer.

is_paused()[source]
Returns:

True if self is paused

Return type:

bool

Returns whether the printer is currently paused.

A paused printer still accepts jobs, but it is not printing them.

is_virtual()[source]
Returns:

True if self is virtual

Return type:

bool

Returns whether the printer is virtual (i.e. does not represent actual printer hardware, but something like a CUPS class).

list_papers()[source]
Returns:

a newly allocated list of newly allocated ``GtkPageSetup``s.

Return type:

[Gtk.PageSetup]

Lists all the paper sizes self supports.

This will return and empty list unless the printer’s details are available, see [method`Gtk`.Printer.has_details] and [method`Gtk`.Printer.request_details].

request_details()[source]

Requests the printer details.

When the details are available, the [signal`Gtk`.Printer::details-acquired] signal will be emitted on self.

Signal Details

Gtk.Printer.signals.details_acquired(printer, success)
Signal Name:

details-acquired

Flags:

RUN_LAST

Parameters:
  • printer (Gtk.Printer) – The object which received the signal

  • success (bool) – True if the details were successfully acquired

Emitted in response to a request for detailed information about a printer from the print backend.

The success parameter indicates if the information was actually obtained.

Property Details

Gtk.Printer.props.accepting_jobs
Name:

accepting-jobs

Type:

bool

Default Value:

True

Flags:

READABLE

True if the printer is accepting jobs.

Gtk.Printer.props.accepts_pdf
Name:

accepts-pdf

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

True if this printer can accept PDF.

Gtk.Printer.props.accepts_ps
Name:

accepts-ps

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

True if this printer can accept PostScript.

Gtk.Printer.props.icon_name
Name:

icon-name

Type:

str

Default Value:

'printer'

Flags:

READABLE

Icon name to use for the printer.

Gtk.Printer.props.is_virtual
Name:

is-virtual

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

False if this represents a real hardware device.

Gtk.Printer.props.job_count
Name:

job-count

Type:

int

Default Value:

0

Flags:

READABLE

Number of jobs queued in the printer.

Gtk.Printer.props.location
Name:

location

Type:

str

Default Value:

''

Flags:

READABLE

Information about the location of the printer.

Gtk.Printer.props.name
Name:

name

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The name of the printer.

Gtk.Printer.props.paused
Name:

paused

Type:

bool

Default Value:

False

Flags:

READABLE

True if this printer is paused.

A paused printer still accepts jobs, but it does not print them.

Gtk.Printer.props.state_message
Name:

state-message

Type:

str

Default Value:

''

Flags:

READABLE

String giving the current status of the printer.