Gtk.PaperSize¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Gtk.PaperSize¶
GtkPaperSize
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,
GtkPaperSize
allows to construct custom paper sizes with arbitrary dimensions.The
GtkPaperSize
object stores not only the dimensions (width and height) of a paper size and its name, it also provides default print margins.- 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.
- 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
GtkPaperSize
objects- Return type:
Creates a list of known paper sizes.
- classmethod new(name)[source]¶
- Parameters:
- Returns:
a new
GtkPaperSize
, use [method`Gtk`.PaperSize.free] to free it- Return type:
Creates a new
GtkPaperSize
object by parsing a PWG 5101.1-2002 paper name.If name is
None
, the default paper size is returned, see [func`Gtk`.PaperSize.get_default].
- classmethod new_custom(name, display_name, width, height, unit)[source]¶
- Parameters:
- Returns:
a new
GtkPaperSize
object, use [method`Gtk`.PaperSize.free] to free it- Return type:
Creates a new
GtkPaperSize
object with the given parameters.
- classmethod new_from_gvariant(variant)[source]¶
- Parameters:
variant (
GLib.Variant
) – an a{sv}GVariant
- Returns:
a new
GtkPaperSize
object- Return type:
Deserialize a paper size from a
GVariant
.The `:obj:GLib.Variant must be in the format produced by [method`Gtk`.PaperSize.to_gvariant].
- classmethod new_from_ipp(ipp_name, width, height)[source]¶
- Parameters:
- Returns:
a new
GtkPaperSize
, use [method`Gtk`.PaperSize.free] to free it- Return type:
Creates a new
GtkPaperSize
object by using IPP information.If ipp_name is not a recognized paper name, width and height are used to construct a custom
GtkPaperSize
object.
- classmethod new_from_key_file(key_file, group_name)[source]¶
- Parameters:
key_file (
GLib.KeyFile
) – theGKeyFile
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
GtkPaperSize
object with the restored paper size- Return type:
Reads a paper size from the group group_name in the key file key_file.
- classmethod new_from_ppd(ppd_name, ppd_display_name, width, height)[source]¶
- Parameters:
- Returns:
a new
GtkPaperSize
, use [method`Gtk`.PaperSize.free] to free it- Return type:
Creates a new
GtkPaperSize
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
GtkPaperSize
object.
- 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
GtkPaperSize
.
- 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
GtkPaperSize
.
- 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
GtkPaperSize
.
- 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
GtkPaperSize
.
- get_display_name()[source]¶
- Returns:
the human-readable name of self
- Return type:
Gets the human-readable name of the
GtkPaperSize
.
- 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
GtkPaperSize
, in units of unit.
- get_ppd_name()[source]¶
- Returns:
the PPD name of self
- Return type:
Gets the PPD name of the
GtkPaperSize
, which may beNone
.
- 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
GtkPaperSize
, in units of unit.
- 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
) – anotherGtkPaperSize
object- Returns:
True
, if self and size2 represent the same paper size- Return type:
Compares two
GtkPaperSize
objects.
- 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.
- to_gvariant()[source]¶
- Returns:
a new, floating,
GVariant
- Return type:
Serialize a paper size to an
a{sv}
variant.
- to_key_file(key_file, group_name)[source]¶
- Parameters:
key_file (
GLib.KeyFile
) – theGKeyFile
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.