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)
def to_file(file_name)
def get_number_up_layout()
def set_number_up_layout(number_up_layout)
def load_file(file_name)
def get_resolution_x()
def get_resolution_y()
def set_resolution_xy(resolution_x, resolution_y)
def get_printer_lpi()
def set_printer_lpi(lpi)
Functions

    def gtk.print_settings_new_from_file(file_name)

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.

gtk.PrintSettings.to_file

    def to_file(file_name)

filename :

the file to save to.

Returns :

True on sucess.

Note

This method is available in PyGTK 2.12 and above.

This function saves the print settings from settings to file_name.

gtk.PrintSettings.get_number_up_layout

    def get_number_up_layout()

Returns :

layout of page in number-up mode.

Note

This method is available in PyGTK 2.16 and above.

gtk.PrintSettings.set_number_up_layout

    def set_number_up_layout(number_up_layout)

number_up_layout :

a GtkNumberUpLayout constant value.

Note

This method is available in PyGTK 2.16 and above.

Sets the value of GtkNumberUpLayout.

gtk.PrintSettings.load_file

    def load_file(file_name)

file_name :

the filename to read the settings from.

Returns :

True on success.

Note

This method is available in PyGTK 2.16 and above.

Reads the print settings from file_name. See gtk.PrintSettings.to_file.

gtk.PrintSettings.get_resolution_x

    def get_resolution_x()

Returns :

the horizontal resolution in dpi.

Note

This method is available in PyGTK 2.16 and above.

The get_resolution_x() method gets the value of gtk.PRINT_SETTINGS_RESOLUTION_X.

gtk.PrintSettings.get_resolution_y

    def get_resolution_y()

Returns :

the vertical resolution in dpi.

Note

This method is available in PyGTK 2.16 and above.

The get_resolution_y() method gets the value of gtk.PRINT_SETTINGS_RESOLUTION_Y.

gtk.PrintSettings.set_resolution_xy

    def set_resolution_xy(resolution_x, resolution_y)

resolution_x :

the horizontal resolution in dpi.

resolution_y :

the vertical resolution in dpi.

Note

This method is available in PyGTK 2.16 and above.

The set_resolution_xy() method sets the values of gtk.PRINT_SETTINGS_RESOLUTION, gtk.PRINT_SETTINGS_RESOLUTION_X and gtk.PRINT_SETTINGS_RESOLUTION_Y.

gtk.PrintSettings.get_printer_lpi

    def get_printer_lpi()

Returns :

the resolution in lpi (lines per inch).

Note

This method is available in PyGTK 2.16 and above.

The get_printer_lpi() method gets the value of gtk.PRINT_SETTINGS_PRINTER_LPI.

gtk.PrintSettings.set_printer_lpi

    def set_printer_lpi(lpi)

lpi :

the resolution in lpi (lines per inch).

Note

This method is available in PyGTK 2.16 and above.

The set_printer_lpi() method sets the value of gtk.PRINT_SETTINGS_PRINTER_LPI.

Functions

gtk.print_settings_new_from_file

    def gtk.print_settings_new_from_file(file_name)

file_name :

the filename to read the settings from.

Returns :

the restored gtk.PrintSettings

Note

This function is available in PyGTK 2.12 and above.

Reads the print settings from filename. Returns a new gtk.PrintSettings object with the restored settings, or None if an error occurred. See gtk.PrintSettings.to_file().