gtk.PrintSettings
Prev | The gtk Class Reference | Next

## gtk.PrintSettings

gtk.PrintSettings — Stores print settings (new in PyGTK 2.10)

## Synopsis

    class gtk.PrintSettings(gobject.GObject):
        gtk.PrintSettings()
        def copy()
        def has_key(key)
        def get(key)
        def set(key, value)
        def unset(key)
        def foreach(func, user_data=None)
        def get_bool(key)
        def set_bool(key, value)
        def get_double(key)
        def get_double_with_default(key, def)
        def set_double(key, value)
        def get_length(key, unit)
        def set_length(key, value, unit)
        def get_int(key)
        def get_int_with_default(key, def)
        def set_int(key, value)
        def get_printer()
        def set_printer(printer)
        def get_orientation()
        def set_orientation(orientation)
        def get_paper_size()
        def set_paper_size(paper_size)
        def get_paper_width(unit)
        def set_paper_width(width, unit)
        def get_paper_height(unit)
        def set_paper_height(height, unit)
        def get_use_color()
        def set_use_color(use_color)
        def get_collate()
        def set_collate(collate)
        def get_reverse()
        def set_reverse(reverse)
        def get_duplex()
        def set_duplex(duplex)
        def get_quality()
        def set_quality(quality)
        def get_n_copies()
        def set_n_copies(num_copies)
        def get_number_up()
        def set_number_up(number_up)
        def get_resolution()
        def set_resolution(resolution)
        def get_scale()
        def set_scale(scale)
        def get_print_pages()
        def set_print_pages(pages)
        def get_page_ranges(num_ranges)
        def set_page_ranges(page_ranges, num_ranges)
        def get_page_set()
        def set_page_set(page_set)
        def get_default_source()
        def set_default_source(default_source)
        def get_media_type()
        def set_media_type(media_type)
        def get_dither()
        def set_dither(dither)
        def get_finishings()
        def set_finishings(finishings)
        def get_output_bin()
        def set_output_bin(output_bin)

## Ancestry

    +-- gobject.GObject
      +-- gtk.PrintSettings

## gtk.PrintSettings Signal Prototypes

gobject.GObject Signal Prototypes

## Description

A `gtk.PrintSettings` object represents the settings of a print dialog in a system-independent way. The main use for this object is that once you've printed you can get a settings object that represents the settings the user chose, and the next time you print you can pass that object in so that the user doesn't have to re-set all his settings.

Its also possible to enumerate the settings so that you can easily save the settings for the next time your app runs, or even store them in a document. The predefined keys try to use shared values as much as possible so that moving such a document between systems still works.

Printing support was added in GTK+ 2.10.

## Constructor

### gtk.PrintSettings

        gtk.PrintSettings()

Returns : | a new `gtk.PrintSettings` object

### Note

This constructor is available in PyGTK 2.10 and above.

Creates a new `gtk.PrintSettings` object.

## Methods

### gtk.PrintSettings.copy

        def copy()

Returns : | a newly allocated copy of the print settings

### Note

This method is available in PyGTK 2.10 and above.

Returns a copy of this `gtk.PrintSettings` object.

### gtk.PrintSettings.has_key

        def has_key(key)

`key` : | a key
Returns : | `TRUE`, if `key` has a value

### Note

This method is available in PyGTK 2.10 and above.

Returns `TRUE`, if a value is associated with `key`.

### gtk.PrintSettings.get

        def get(key)

`key` : | a key
Returns : | the string value for `key`

### Note

This method is available in PyGTK 2.10 and above.

Looks up the string value associated with `key`.

### gtk.PrintSettings.set

        def set(key, value)

`key` : | a key
`value` : | a string value, or `None`

### Note

This method is available in PyGTK 2.10 and above.

Associates `value` with `key`.

### gtk.PrintSettings.unset

        def unset(key)

`key` : | a key

### Note

This method is available in PyGTK 2.10 and above.

Removes any value associated with `key`. This has the same effect as setting the value to `None`.

### gtk.PrintSettings.foreach

        def foreach(func, user_data=None)

`func` : | the function to call
`user_data` : | user data for `func`

### Note

This method is available in PyGTK 2.10 and above.

Calls `func` for each key-value pair.

The signature of `func` is:

      def func(key, value, data):

where `key` and `value` are the key-value pair and `data` is `user_data`.

### gtk.PrintSettings.get_bool

        def get_bool(key)

`key` : | a key
Returns : | `TRUE`, if `key` maps to a true value.

### Note

This method is available in PyGTK 2.10 and above.

Returns the boolean represented by the value that is associated with `key`.

### gtk.PrintSettings.set_bool

        def set_bool(key, value)

`key` : | a key
`value` : | a boolean

### Note

This method is available in PyGTK 2.10 and above.

Sets `key` to the boolean value specified by `value`..

### gtk.PrintSettings.get_double

        def get_double(key)

`key` : | a key
Returns : | the double value of `key`

### Note

This method is available in PyGTK 2.10 and above.

Returns the double value associated with `key`, or 0.

### gtk.PrintSettings.get_double_with_default

        def get_double_with_default(key, def)

`key` : | a key
`def` : | the default value
Returns : | the floating point number associated with `key`

### Note

This method is available in PyGTK 2.10 and above.

Returns the floating point number represented by the value that is associated with `key`, or `def` if the value does not represent a floating point number.

### gtk.PrintSettings.set_double

        def set_double(key, value)

`key` : | a key
`value` : | a double value

### Note

This method is available in PyGTK 2.10 and above.

Sets `key` to the given double value.

### gtk.PrintSettings.get_length

        def get_length(key, unit)

`key` : | a key
`unit` : | the unit of the return value
Returns : | the length value of `key`, converted to `unit`

### Note

This method is available in PyGTK 2.10 and above.

Returns the value associated with `key`, interpreted as a length. The returned value is converted to the units specified by `unit`.

### gtk.PrintSettings.set_length

        def set_length(key, value, unit)

`key` : | a key
`value` : | a length
`unit` : | the unit of `length`

### Note

This method is available in PyGTK 2.10 and above.

Associates a length in units of `unit` with `key`.

### gtk.PrintSettings.get_int

        def get_int(key)

`key` : | a key
Returns : | the integer value of `key`

### Note

This method is available in PyGTK 2.10 and above.

Returns the integer value of `key`, or 0.

### gtk.PrintSettings.get_int_with_default

        def get_int_with_default(key, def)

`key` : | a key
`def` : | the default value
Returns : | the integer value of `key`

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of `key`, interpreted as an integer, or the default value specified by `def`.

### gtk.PrintSettings.set_int

        def set_int(key, value)

`key` : | a key
`value` : | an integer

### Note

This method is available in PyGTK 2.10 and above.

Sets `key` to the given integer value.

### gtk.PrintSettings.get_printer

        def get_printer()

Returns : | the printer name

### Note

This method is available in PyGTK 2.10 and above.

Convenience method to obtain the value of the "printer" key.

### gtk.PrintSettings.set_printer

        def set_printer(printer)

`printer` : | the printer name

### Note

This method is available in PyGTK 2.10 and above.

Convenience function to set the "printer" key the value specified by `printer`.

### gtk.PrintSettings.get_orientation

        def get_orientation()

Returns : | the orientation

### Note

This method is available in PyGTK 2.10 and above.

Get the value of the "orientation" key, converted to one of the GTK Page Orientation Constants.

### gtk.PrintSettings.set_orientation

        def set_orientation(orientation)

`orientation` : | a page orientation

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "orientation" key to one of the GTK Page Orientation Constants specified by `orientation`.

### gtk.PrintSettings.get_paper_size

        def get_paper_size()

Returns : | the paper size

### Note

This method is available in PyGTK 2.10 and above.

Gets the value of the "paper-format" key, converted to a `gtk.PaperSize`.

### gtk.PrintSettings.set_paper_size

        def set_paper_size(paper_size)

`paper_size` : | a paper size

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "paper-format", "paper-width" and "paper-height" keys using the `gtk.PaperSize` specified by `paper_size`.

### gtk.PrintSettings.get_paper_width

        def get_paper_width(unit)

`unit` : | the unit for the return value
Returns : | the paper width, in units of `unit`

### Note

This method is available in PyGTK 2.10 and above.

Retuens the value of the "printer-width" key converted to the units specified by `unit`.

### gtk.PrintSettings.set_paper_width

        def set_paper_width(width, unit)

`width` : | the paper width
`unit` : | the units of `width`

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "printer-width" key using the units specified by `unit`.

### gtk.PrintSettings.get_paper_height

        def get_paper_height(unit)

`unit` : | the units for the return value
Returns : | the paper height, in units of `unit`

### Note

This method is available in PyGTK 2.10 and above.

Gets the value of the "paper-height" key converted to the units specified by `unit`.

### gtk.PrintSettings.set_paper_height

        def set_paper_height(height, unit)

`height` : | the paper height
`unit` : | the units of `height`

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "paper-height" key using the units specified by `unit`.

### gtk.PrintSettings.get_use_color

        def get_use_color()

Returns : | whether to use color

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "use-color" key. If `TRUE` color will be used when printing.

### gtk.PrintSettings.set_use_color

        def set_use_color(use_color)

`use_color` : | if `TRUE` use color

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "use-color" key to the value specified by `use_color`. If `use_color` is `TRUE` color will be used when printing.

### gtk.PrintSettings.get_collate

        def get_collate()

Returns : | `TRUE` if the printed pages are to be collated

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "collate" key.

### gtk.PrintSettings.set_collate

        def set_collate(collate)

`collate` : | if `TRUE`, collate the output

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "collate" key. If `collate` is `TRUE` the output pages will be collated.

### gtk.PrintSettings.get_reverse

        def get_reverse()

Returns : | `TRUE` if the order of the printed pages shoudl be reversed.

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "reverse" key.

### gtk.PrintSettings.set_reverse

        def set_reverse(reverse)

`reverse` : | if `TRUE` reverse the output

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "reverse" key. If `reverse` is `TRUE` the output pages willl be reversed.

### gtk.PrintSettings.get_duplex

        def get_duplex()

Returns : | the "duplex" key.

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "duplex" key - one of the GTK Print Duplex Constants.

### gtk.PrintSettings.set_duplex

        def set_duplex(duplex)

`duplex` : | one of the GTK Print Duplex Constants

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "duplex" key. `duplexp` must be one of the GTK Print Duplex Constants

### gtk.PrintSettings.get_quality

        def get_quality()

Returns : | the print quality

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "quality" key.

### gtk.PrintSettings.set_quality

        def set_quality(quality)

`quality` : | one of the GTK Print Quality Constants

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "quality" key. `quality` must be one of the GTK Print Quality Constants.

### gtk.PrintSettings.get_n_copies

        def get_n_copies()

Returns : | the number of copies to print

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "n-copies" key.

### gtk.PrintSettings.set_n_copies

        def set_n_copies(num_copies)

`num_copies` : | the number of copies

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "n-copies" key to the value specified by `num_copies`.

### gtk.PrintSettings.get_number_up

        def get_number_up()

Returns : | the number of pages per sheet

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "number-up" key which specifies the number of pages per sheet.

### gtk.PrintSettings.set_number_up

        def set_number_up(number_up)

`number_up` : | the number of pages per sheet

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "number-up" key. `number_up` specifies the number of document pages to be printed per sheet.

### gtk.PrintSettings.get_resolution

        def get_resolution()

Returns : | the resolution in dpi

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "resolution" key in dpi.

### gtk.PrintSettings.set_resolution

        def set_resolution(resolution)

`resolution` : | the resolution in dpi

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "resolution" key in dpi.

### gtk.PrintSettings.get_scale

        def get_scale()

Returns : | the scale in percent

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "scale" key as a float number.

### gtk.PrintSettings.set_scale

        def set_scale(scale)

`scale` : | the scale in percent

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "scale" key using the float number specified by `scale`.

### gtk.PrintSettings.get_print_pages

        def get_print_pages()

Returns : | which pages to print

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "print-pages" key as one if the GTK Print Pages Constants.

### gtk.PrintSettings.set_print_pages

        def set_print_pages(pages)

`pages` : | one if the GTK Print Pages Constants

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "print-pages" key to one of the GTK Print Pages Constants.

### gtk.PrintSettings.get_page_ranges

        def get_page_ranges()

Returns : | a list of [age ranges as 2-tuples

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "page-ranges" key as a list of 2-tuples containing the start and end page numbers of each range.

### gtk.PrintSettings.set_page_ranges

        def set_page_ranges(page_ranges, num_ranges)

`page_ranges` : | a sequence of page range 2-tuples

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "page-ranges" key to the value of `page_ranges` which should be a sequence of 2-tuples containing the start and end page numbers of each page range.

### gtk.PrintSettings.get_page_set

        def get_page_set()

Returns : | the set of pages to print

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "page-set" key which is one of the GTK Page Set Constants.

### gtk.PrintSettings.set_page_set

        def set_page_set(page_set)

`page_set` : | one of the GTK Page Set Constants

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "page-set" key to the value specified by `page_set` which should be one of the GTK Page Set Constants.

### gtk.PrintSettings.get_default_source

        def get_default_source()

Returns : | the default source

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "default-source" key.

### gtk.PrintSettings.set_default_source

        def set_default_source(default_source)

`default_source` : | the default source

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "default-source" key to the string specified by `default_source`.

### gtk.PrintSettings.get_media_type

        def get_media_type()

Returns : | the media type

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "media-type" key.

The set of media types is defined in PWG 5101.1-2002 PWG.

### gtk.PrintSettings.set_media_type

        def set_media_type(media_type)

`media_type` : | the media type

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "media-type" key.

The set of media types is defined in PWG 5101.1-2002 PWG.

### gtk.PrintSettings.get_dither

        def get_dither()

Returns : | the dithering that is used

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "dither" key.

### gtk.PrintSettings.set_dither

        def set_dither(dither)

`dither` : | the dithering that is used

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "dither" key to the string specified by `dither`.

### gtk.PrintSettings.get_finishings

        def get_finishings()

Returns : | the finishings

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "finishings" key.

### gtk.PrintSettings.set_finishings

        def set_finishings(finishings)

`finishings` : | the finishings

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "finishings" key to the string specified by `finishings`.

### gtk.PrintSettings.get_output_bin

        def get_output_bin()

Returns : | the output bin

### Note

This method is available in PyGTK 2.10 and above.

Returns the value of the "output-bin" key.

### gtk.PrintSettings.set_output_bin

        def set_output_bin(output_bin)

`output_bin` : | the output bin

### Note

This method is available in PyGTK 2.10 and above.

Sets the value of the "output-bin" key to the value specified by `output_bin`.

Prev | Up | Next
gtk.PrintOperationPreview | Home | gtk.ProgressBar