Gtk.PrintSettings


Gtk.PrintSettings — Stores print settings

Object Hierarchy:

    GObject
    ╰── Gtk.PrintSettings

Functions:

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.


Function Details:

new()

new () -> Gtk.PrintSettings

Creates a new Gtk.PrintSettings object.

  • Returns: a new Gtk.PrintSettings object

  • Since: 2.10


copy()

copy (self) -> Gtk.PrintSettings

Copies a Gtk.PrintSettings object.

  • Returns: a newly allocated copy of other.

  • Since: 2.10


has_key()

has_key (self, key:str) -> bool

Returns True, if a value is associated with key.

  • Returns: True, if keyhas a value

  • Since: 2.10


get()

get (self, key:str) -> str

Looks up the string value associated with key.

  • Returns: the string value for key

  • Since: 2.10


set()

set (self, key:str, value:str=None)

Associates value with key.

  • Since: 2.10

unset()

unset (self, key:str)

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

  • Since: 2.10

foreach()

foreach (self, func:Gtk.PrintSettingsFunc, user_data=None)

Calls func for each key-value pair of settings.

  • Since: 2.10

get_bool()

get_bool (self, key:str) -> bool

Returns the boolean represented by the valuethat is associated with key. The string “true” represents True, any other string FALSE.

  • Returns: True, if keymaps to a true value.

  • Since: 2.10


set_bool()

set_bool (self, key:str, value:bool)

Sets key to a boolean value.

  • Since: 2.10

get_double()

get_double (self, key:str) -> float

Returns the double value associated with key, or 0.

  • Returns: the double value of key

  • Since: 2.10


get_double_with_default()

get_double_with_default (self, key:str, def_:float) -> float

Returns the floating point number represented by the value that is associated with key, or default_valif the value does not represent a floating point number. Floating point numbers are parsed with g_ascii_strtod().

  • Returns: the floating point number associated with key

  • Since: 2.10


set_double()

set_double (self, key:str, value:float)

Sets key to a double value.

  • Since: 2.10

get_length()

get_length (self, key:str, unit:Gtk.Unit) -> float

Returns the value associated with key, interpretedas a length. The returned value is converted to units.

  • Returns: the length value of key, converted to unit

  • Since: 2.10


set_length()

set_length (self, key:str, value:float, unit:Gtk.Unit)

Associates a length in units of unit with key.

  • Since: 2.10

get_int()

get_int (self, key:str) -> int

Returns the integer value of key, or 0.

  • Returns: the integer value of key

  • Since: 2.10


get_int_with_default()

get_int_with_default (self, key:str, def_:int) -> int

Returns the value of key, interpreted asan integer, or the default value.

  • Returns: the integer value of key

  • Since: 2.10


set_int()

set_int (self, key:str, value:int)

Sets key to an integer value.

  • Since: 2.10

get_printer()

get_printer (self) -> str

Convenience function to obtain the value of GTK_PRINT_SETTINGS_PRINTER.

  • Returns: the printer name

  • Since: 2.10


set_printer()

set_printer (self, printer:str)

Convenience function to set GTK_PRINT_SETTINGS_PRINTERto printer.

  • Since: 2.10

get_orientation()

get_orientation (self) -> Gtk.PageOrientation

Get the value of GTK_PRINT_SETTINGS_ORIENTATION, converted to a Gtk.PageOrientation.

  • Returns: the orientation

  • Since: 2.10


set_orientation()

set_orientation (self, orientation:Gtk.PageOrientation)

Sets the value of GTK_PRINT_SETTINGS_ORIENTATION.

  • Since: 2.10

get_paper_size()

get_paper_size (self) -> Gtk.PaperSize

Gets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT, converted to a Gtk.PaperSize.

  • Returns: the paper size

  • Since: 2.10


set_paper_size()

set_paper_size (self, paper_size:Gtk.PaperSize)

Sets the value of GTK_PRINT_SETTINGS_PAPER_FORMAT,GTK_PRINT_SETTINGS_PAPER_WIDTH andGTK_PRINT_SETTINGS_PAPER_HEIGHT.

  • Since: 2.10

get_paper_width()

get_paper_width (self, unit:Gtk.Unit) -> float

Gets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH,converted to unit.

  • Returns: the paper width, in units of unit

  • Since: 2.10


set_paper_width()

set_paper_width (self, width:float, unit:Gtk.Unit)

Sets the value of GTK_PRINT_SETTINGS_PAPER_WIDTH.

  • Since: 2.10

get_paper_height()

get_paper_height (self, unit:Gtk.Unit) -> float

Gets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT,converted to unit.

  • Returns: the paper height, in units of unit

  • Since: 2.10


set_paper_height()

set_paper_height (self, height:float, unit:Gtk.Unit)

Sets the value of GTK_PRINT_SETTINGS_PAPER_HEIGHT.

  • Since: 2.10

get_use_color()

get_use_color (self) -> bool

Gets the value of GTK_PRINT_SETTINGS_USE_COLOR.

  • Returns: whether to use color

  • Since: 2.10


set_use_color()

set_use_color (self, use_color:bool)

Sets the value of GTK_PRINT_SETTINGS_USE_COLOR.

  • Since: 2.10

get_collate()

get_collate (self) -> bool

Gets the value of GTK_PRINT_SETTINGS_COLLATE.

  • Returns: whether to collate the printed pages

  • Since: 2.10


set_collate()

set_collate (self, collate:bool)

Sets the value of GTK_PRINT_SETTINGS_COLLATE.

  • Since: 2.10

get_reverse()

get_reverse (self) -> bool

Gets the value of GTK_PRINT_SETTINGS_REVERSE.

  • Returns: whether to reverse the order of the printed pages

  • Since: 2.10


set_reverse()

set_reverse (self, reverse:bool)

Sets the value of GTK_PRINT_SETTINGS_REVERSE.

  • Since: 2.10

get_duplex()

get_duplex (self) -> Gtk.PrintDuplex

Gets the value of GTK_PRINT_SETTINGS_DUPLEX.

  • Returns: whether to print the output in duplex.

  • Since: 2.10


set_duplex()

set_duplex (self, duplex:Gtk.PrintDuplex)

Sets the value of GTK_PRINT_SETTINGS_DUPLEX.

  • Since: 2.10

get_quality()

get_quality (self) -> Gtk.PrintQuality

Gets the value of GTK_PRINT_SETTINGS_QUALITY.

  • Returns: the print quality

  • Since: 2.10


set_quality()

set_quality (self, quality:Gtk.PrintQuality)

Sets the value of GTK_PRINT_SETTINGS_QUALITY.

  • Since: 2.10

get_n_copies()

get_n_copies (self) -> int

Gets the value of GTK_PRINT_SETTINGS_N_COPIES.

  • Returns: the number of copies to print

  • Since: 2.10


set_n_copies()

set_n_copies (self, num_copies:int)

Sets the value of GTK_PRINT_SETTINGS_N_COPIES.

  • Since: 2.10

get_number_up()

get_number_up (self) -> int

Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP.

  • Returns: the number of pages per sheet

  • Since: 2.10


set_number_up()

set_number_up (self, number_up:int)

Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP.

  • Since: 2.10

get_number_up_layout()

get_number_up_layout (self) -> Gtk.NumberUpLayout

Gets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.

  • Returns: layout of page in number-up mode

  • Since: 2.14


set_number_up_layout()

set_number_up_layout (self, number_up_layout:Gtk.NumberUpLayout)

Sets the value of GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT.

  • Since: 2.14

get_resolution()

get_resolution (self) -> int

Gets the value of GTK_PRINT_SETTINGS_RESOLUTION.

  • Returns: the resolution in dpi

  • Since: 2.10


set_resolution()

set_resolution (self, resolution:int)

Sets the values of GTK_PRINT_SETTINGS_RESOLUTION,GTK_PRINT_SETTINGS_RESOLUTION_X and GTK_PRINT_SETTINGS_RESOLUTION_Y.

  • Since: 2.10

set_resolution_xy()

set_resolution_xy (self, resolution_x:int, resolution_y:int)

Sets the values of GTK_PRINT_SETTINGS_RESOLUTION,GTK_PRINT_SETTINGS_RESOLUTION_X andGTK_PRINT_SETTINGS_RESOLUTION_Y.

  • Since: 2.16

get_resolution_x()

get_resolution_x (self) -> int

Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_X.

  • Returns: the horizontal resolution in dpi

  • Since: 2.16


get_resolution_y()

get_resolution_y (self) -> int

Gets the value of GTK_PRINT_SETTINGS_RESOLUTION_Y.

  • Returns: the vertical resolution in dpi

  • Since: 2.16


get_printer_lpi()

get_printer_lpi (self) -> float

Gets the value of GTK_PRINT_SETTINGS_PRINTER_LPI.

  • Returns: the resolution in lpi (lines per inch)

  • Since: 2.16


set_printer_lpi()

set_printer_lpi (self, lpi:float)

Sets the value of GTK_PRINT_SETTINGS_PRINTER_LPI.

  • Since: 2.16

get_scale()

get_scale (self) -> float

Gets the value of GTK_PRINT_SETTINGS_SCALE.

  • Returns: the scale in percent

  • Since: 2.10


set_scale()

set_scale (self, scale:float)

Sets the value of GTK_PRINT_SETTINGS_SCALE.

  • Since: 2.10

get_print_pages()

get_print_pages (self) -> Gtk.PrintPages

Gets the value of GTK_PRINT_SETTINGS_PRINT_PAGES.

  • Returns: which pages to print

  • Since: 2.10


set_print_pages()

set_print_pages (self, pages:Gtk.PrintPages)

Sets the value of GTK_PRINT_SETTINGS_PRINT_PAGES.

  • Since: 2.10

get_page_ranges()

get_page_ranges (self) -> list, num_ranges:int

Gets the value of GTK_PRINT_SETTINGS_PAGE_RANGES.

  • Returns: an arrayof Gtk.PageRanges. Use g_free() to free the array whenit is no longer needed.

  • Since: 2.10


set_page_ranges()

set_page_ranges (self, page_ranges:list)

Sets the value of GTK_PRINT_SETTINGS_PAGE_RANGES.

  • Since: 2.10

get_page_set()

get_page_set (self) -> Gtk.PageSet

Gets the value of GTK_PRINT_SETTINGS_PAGE_SET.

  • Returns: the set of pages to print

  • Since: 2.10


set_page_set()

set_page_set (self, page_set:Gtk.PageSet)

Sets the value of GTK_PRINT_SETTINGS_PAGE_SET.

  • Since: 2.10

get_default_source()

get_default_source (self) -> str

Gets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE.

  • Returns: the default source

  • Since: 2.10


set_default_source()

set_default_source (self, default_source:str)

Sets the value of GTK_PRINT_SETTINGS_DEFAULT_SOURCE.

  • Since: 2.10

get_media_type()

get_media_type (self) -> str

Gets the value of GTK_PRINT_SETTINGS_MEDIA_TYPE. The set of media types is defined in PWG 5101.1-2002 PWG.

  • Returns: the media type

  • Since: 2.10


set_media_type()

set_media_type (self, media_type:str)

Sets the value of GTK_PRINT_SETTINGS_MEDIA_TYPE. The set of media types is defined in PWG 5101.1-2002 PWG.

  • Since: 2.10

get_dither()

get_dither (self) -> str

Gets the value of GTK_PRINT_SETTINGS_DITHER.

  • Returns: the dithering that is used

  • Since: 2.10


set_dither()

set_dither (self, dither:str)

Sets the value of GTK_PRINT_SETTINGS_DITHER.

  • Since: 2.10

get_finishings()

get_finishings (self) -> str

Gets the value of GTK_PRINT_SETTINGS_FINISHINGS.

  • Returns: the finishings

  • Since: 2.10


set_finishings()

set_finishings (self, finishings:str)

Sets the value of GTK_PRINT_SETTINGS_FINISHINGS.

  • Since: 2.10

get_output_bin()

get_output_bin (self) -> str

Gets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN.

  • Returns: the output bin

  • Since: 2.10


set_output_bin()

set_output_bin (self, output_bin:str)

Sets the value of GTK_PRINT_SETTINGS_OUTPUT_BIN.

  • Since: 2.10

new_from_file()

new_from_file (file_name:str) -> Gtk.PrintSettings

Reads the print settings from file_name. Returns a new Gtk.PrintSettingsobject with the restored settings, or None if an error occurred. If thefile could not be loaded then error is set to either a GFileError orGKeyFileError. See Gtk.PrintSettings:to_file().

  • Returns: the restored Gtk.PrintSettings

  • Since: 2.12


new_from_key_file()

new_from_key_file (key_file:GLib.KeyFile, group_name:str=None) -> Gtk.PrintSettings

Reads the print settings from the group group_name in key_file. Returns anew Gtk.PrintSettings object with the restored settings, or None if anerror occurred. If the file could not be loaded then error is set to eithera GFileError or GKeyFileError.

  • Returns: the restored Gtk.PrintSettings

  • Since: 2.12


load_file()

load_file (self, file_name:str) -> bool

Reads the print settings from file_name. If the file could not be loadedthen error is set to either a GFileError or GKeyFileError.See Gtk.PrintSettings:to_file().

  • Returns: True on success

  • Since: 2.14


load_key_file()

load_key_file (self, key_file:GLib.KeyFile, group_name:str=None) -> bool

Reads the print settings from the group group_name in key_file. If thefile could not be loaded then error is set to either a GFileError orGKeyFileError.

  • Returns: True on success

  • Since: 2.14


to_file()

to_file (self, file_name:str) -> bool

This function saves the print settings from settings to file_name. If thefile could not be loaded then error is set to either a GFileError orGKeyFileError.

  • Returns: True on success

  • Since: 2.12


to_key_file()

to_key_file (self, key_file:GLib.KeyFile, group_name:str)

This function adds the print settings from settings to key_file.

  • Since: 2.12

results matching ""

    No results matching ""