Gtk.PaperSize¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Gtk.PaperSize¶
Gtk.PaperSize
handles paper sizes. It uses the standard called PWG 5101.1-2002 PWG: Standard for Media Standardized Names to name the paper sizes (and to get the data for the page sizes). In addition to standard paper sizes,Gtk.PaperSize
allows to construct custom paper sizes with arbitrary dimensions.The
Gtk.PaperSize
object stores not only the dimensions (width and height) of a paper size and its name, it also provides default print margins.Printing support has been added in GTK+ 2.10.
- classmethod get_default()[source]¶
- Returns:
the name of the default paper size. The string is owned by GTK+ and should not be modified.
- Return type:
Returns the name of the default paper size, which depends on the current locale.
New in version 2.10.
- classmethod get_paper_sizes(include_custom)[source]¶
- Parameters:
include_custom (
bool
) – whether to include custom paper sizes as defined in the page setup dialog- Returns:
a newly allocated list of newly allocated
Gtk.PaperSize
objects- Return type:
Creates a list of known paper sizes.
New in version 2.12.
- classmethod new(name)[source]¶
- Parameters:
- Returns:
a new
Gtk.PaperSize
, useGtk.PaperSize.free
() to free it- Return type:
Creates a new
Gtk.PaperSize
object by parsing a PWG 5101.1-2002 paper name.If name is
None
, the default paper size is returned, seeGtk.PaperSize.get_default
().New in version 2.10.
- classmethod new_custom(name, display_name, width, height, unit)[source]¶
- Parameters:
- Returns:
a new
Gtk.PaperSize
object, useGtk.PaperSize.free
() to free it- Return type:
Creates a new
Gtk.PaperSize
object with the given parameters.New in version 2.10.
- classmethod new_from_gvariant(variant)[source]¶
- Parameters:
variant (
GLib.Variant
) – an a{sv}GLib.Variant
- Returns:
a new
Gtk.PaperSize
object- Return type:
Deserialize a paper size from an a{sv} variant in the format produced by
Gtk.PaperSize.to_gvariant
().New in version 3.22.
- classmethod new_from_ipp(ipp_name, width, height)[source]¶
- Parameters:
- Returns:
a new
Gtk.PaperSize
, useGtk.PaperSize.free
() to free it- Return type:
Creates a new
Gtk.PaperSize
object by using IPP information.If ipp_name is not a recognized paper name, width and height are used to construct a custom
Gtk.PaperSize
object.New in version 3.16.
- classmethod new_from_key_file(key_file, group_name)[source]¶
- Parameters:
key_file (
GLib.KeyFile
) – theGLib.KeyFile
to retrieve the papersize fromgroup_name (
str
orNone
) – the name of the group in the key file to read, orNone
to read the first group
- Raises:
- Returns:
a new
Gtk.PaperSize
object with the restored paper size, orNone
if an error occurred- Return type:
Reads a paper size from the group group_name in the key file key_file.
New in version 2.12.
- classmethod new_from_ppd(ppd_name, ppd_display_name, width, height)[source]¶
- Parameters:
- Returns:
a new
Gtk.PaperSize
, useGtk.PaperSize.free
() to free it- Return type:
Creates a new
Gtk.PaperSize
object by using PPD information.If ppd_name is not a recognized PPD paper name, ppd_display_name, width and height are used to construct a custom
Gtk.PaperSize
object.New in version 2.10.
- copy()[source]¶
- Returns:
a copy of self
- Return type:
Copies an existing
Gtk.PaperSize
.New in version 2.10.
- free()[source]¶
Free the given
Gtk.PaperSize
object.New in version 2.10.
- get_default_bottom_margin(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value, notGtk.Unit.NONE
- Returns:
the default bottom margin
- Return type:
Gets the default bottom margin for the
Gtk.PaperSize
.New in version 2.10.
- get_default_left_margin(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value, notGtk.Unit.NONE
- Returns:
the default left margin
- Return type:
Gets the default left margin for the
Gtk.PaperSize
.New in version 2.10.
- get_default_right_margin(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value, notGtk.Unit.NONE
- Returns:
the default right margin
- Return type:
Gets the default right margin for the
Gtk.PaperSize
.New in version 2.10.
- get_default_top_margin(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value, notGtk.Unit.NONE
- Returns:
the default top margin
- Return type:
Gets the default top margin for the
Gtk.PaperSize
.New in version 2.10.
- get_display_name()[source]¶
- Returns:
the human-readable name of self
- Return type:
Gets the human-readable name of the
Gtk.PaperSize
.New in version 2.10.
- get_height(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value, notGtk.Unit.NONE
- Returns:
the paper height
- Return type:
Gets the paper height of the
Gtk.PaperSize
, in units of unit.New in version 2.10.
- get_name()[source]¶
- Returns:
the name of self
- Return type:
Gets the name of the
Gtk.PaperSize
.New in version 2.10.
- get_ppd_name()[source]¶
- Returns:
the PPD name of self
- Return type:
Gets the PPD name of the
Gtk.PaperSize
, which may beNone
.New in version 2.10.
- get_width(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value, notGtk.Unit.NONE
- Returns:
the paper width
- Return type:
Gets the paper width of the
Gtk.PaperSize
, in units of unit.New in version 2.10.
- is_custom()[source]¶
- Returns:
whether self is a custom paper size.
- Return type:
Returns
True
if self is not a standard paper size.
- is_equal(size2)[source]¶
- Parameters:
size2 (
Gtk.PaperSize
) – anotherGtk.PaperSize
object- Returns:
True
, if self and size2 represent the same paper size- Return type:
Compares two
Gtk.PaperSize
objects.New in version 2.10.
- is_ipp()[source]¶
- Returns:
whether self is not an IPP custom paper size.
- Return type:
Returns
True
if self is an IPP standard paper size.
- set_size(width, height, unit)[source]¶
- Parameters:
Changes the dimensions of a self to width x height.
New in version 2.10.
- to_gvariant()[source]¶
- Returns:
a new, floating,
GLib.Variant
- Return type:
Serialize a paper size to an a{sv} variant.
New in version 3.22.
- to_key_file(key_file, group_name)[source]¶
- Parameters:
key_file (
GLib.KeyFile
) – theGLib.KeyFile
to save the paper size togroup_name (
str
) – the group to add the settings to in key_file
This function adds the paper size from self to key_file.
New in version 2.12.