Gtk.PageSetup¶
Example¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.PageSetup(**kwargs)¶
- Bases:
- Abstract:
No
A
Gtk.PageSetup
object stores the page size, orientation and margins. The idea is that you can get one of these from the page setup dialog and then pass it to theGtk.PrintOperation
when printing. The benefit of splitting this out of theGtk.PrintSettings
is that these affect the actual layout of the page, and thus need to be set long before user prints.- Margins
The margins specified in this object are the “print margins”, i.e. the parts of the page that the printer cannot print on. These are different from the layout margins that a word processor uses; they are typically used to determine the minimal size for the layout margins.
To obtain a
Gtk.PageSetup
useGtk.PageSetup.new
() to get the defaults, or useGtk.print_run_page_setup_dialog
() to show the page setup dialog and receive the resulting page setup.- A page setup dialog
static GtkPrintSettings *settings = NULL; static GtkPageSetup *page_setup = NULL; static void do_page_setup (void) { GtkPageSetup *new_page_setup; if (settings == NULL) settings = gtk_print_settings_new (); new_page_setup = gtk_print_run_page_setup_dialog (GTK_WINDOW (main_window), page_setup, settings); if (page_setup) g_object_unref (page_setup); page_setup = new_page_setup; }
Printing support was added in GTK+ 2.10.
- classmethod new()[source]¶
- Returns:
a new
Gtk.PageSetup
.- Return type:
Creates a new
Gtk.PageSetup
.New in version 2.10.
- classmethod new_from_file(file_name)[source]¶
- Parameters:
file_name (
str
) – the filename to read the page setup from- Raises:
- Returns:
the restored
Gtk.PageSetup
- Return type:
Reads the page setup from the file file_name. Returns a new
Gtk.PageSetup
object with the restored page setup, orNone
if an error occurred. SeeGtk.PageSetup.to_file
().New in version 2.12.
- classmethod new_from_gvariant(variant)[source]¶
- Parameters:
variant (
GLib.Variant
) – an a{sv}GLib.Variant
- Returns:
a new
Gtk.PageSetup
object- Return type:
Desrialize a page setup from an a{sv} variant in the format produced by
Gtk.PageSetup.to_gvariant
().New in version 3.22.
- classmethod new_from_key_file(key_file, group_name)[source]¶
- Parameters:
key_file (
GLib.KeyFile
) – theGLib.KeyFile
to retrieve the page_setup fromgroup_name (
str
orNone
) – the name of the group in the key_file to read, orNone
to use the default name “Page Setup”
- Raises:
- Returns:
the restored
Gtk.PageSetup
- Return type:
Reads the page setup from the group group_name in the key file key_file. Returns a new
Gtk.PageSetup
object with the restored page setup, orNone
if an error occurred.New in version 2.12.
- copy()[source]¶
- Returns:
a copy of self
- Return type:
Copies a
Gtk.PageSetup
.New in version 2.10.
- get_bottom_margin(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value- Returns:
the bottom margin
- Return type:
Gets the bottom margin in units of unit.
New in version 2.10.
- get_left_margin(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value- Returns:
the left margin
- Return type:
Gets the left margin in units of unit.
New in version 2.10.
- get_orientation()[source]¶
- Returns:
the page orientation
- Return type:
Gets the page orientation of the
Gtk.PageSetup
.New in version 2.10.
- get_page_height(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value- Returns:
the page height.
- Return type:
Returns the page height in units of unit.
Note that this function takes orientation and margins into consideration. See
Gtk.PageSetup.get_paper_height
().New in version 2.10.
- get_page_width(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value- Returns:
the page width.
- Return type:
Returns the page width in units of unit.
Note that this function takes orientation and margins into consideration. See
Gtk.PageSetup.get_paper_width
().New in version 2.10.
- get_paper_height(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value- Returns:
the paper height.
- Return type:
Returns the paper height in units of unit.
Note that this function takes orientation, but not margins into consideration. See
Gtk.PageSetup.get_page_height
().New in version 2.10.
- get_paper_size()[source]¶
- Returns:
the paper size
- Return type:
Gets the paper size of the
Gtk.PageSetup
.New in version 2.10.
- get_paper_width(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value- Returns:
the paper width.
- Return type:
Returns the paper width in units of unit.
Note that this function takes orientation, but not margins into consideration. See
Gtk.PageSetup.get_page_width
().New in version 2.10.
- get_right_margin(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value- Returns:
the right margin
- Return type:
Gets the right margin in units of unit.
New in version 2.10.
- get_top_margin(unit)[source]¶
- Parameters:
unit (
Gtk.Unit
) – the unit for the return value- Returns:
the top margin
- Return type:
Gets the top margin in units of unit.
New in version 2.10.
- load_file(file_name)[source]¶
- Parameters:
file_name (
str
) – the filename to read the page setup from- Raises:
- Returns:
True
on success- Return type:
Reads the page setup from the file file_name. See
Gtk.PageSetup.to_file
().New in version 2.14.
- load_key_file(key_file, group_name)[source]¶
- Parameters:
key_file (
GLib.KeyFile
) – theGLib.KeyFile
to retrieve the page_setup fromgroup_name (
str
orNone
) – the name of the group in the key_file to read, orNone
to use the default name “Page Setup”
- Raises:
- Returns:
True
on success- Return type:
Reads the page setup from the group group_name in the key file key_file.
New in version 2.14.
- set_bottom_margin(margin, unit)[source]¶
- Parameters:
Sets the bottom margin of the
Gtk.PageSetup
.New in version 2.10.
- set_left_margin(margin, unit)[source]¶
- Parameters:
Sets the left margin of the
Gtk.PageSetup
.New in version 2.10.
- set_orientation(orientation)[source]¶
- Parameters:
orientation (
Gtk.PageOrientation
) – aGtk.PageOrientation
value
Sets the page orientation of the
Gtk.PageSetup
.New in version 2.10.
- set_paper_size(size)[source]¶
- Parameters:
size (
Gtk.PaperSize
) – aGtk.PaperSize
Sets the paper size of the
Gtk.PageSetup
without changing the margins. SeeGtk.PageSetup.set_paper_size_and_default_margins
().New in version 2.10.
- set_paper_size_and_default_margins(size)[source]¶
- Parameters:
size (
Gtk.PaperSize
) – aGtk.PaperSize
Sets the paper size of the
Gtk.PageSetup
and modifies the margins according to the new paper size.New in version 2.10.
- set_right_margin(margin, unit)[source]¶
- Parameters:
Sets the right margin of the
Gtk.PageSetup
.New in version 2.10.
- set_top_margin(margin, unit)[source]¶
- Parameters:
Sets the top margin of the
Gtk.PageSetup
.New in version 2.10.
- to_file(file_name)[source]¶
-
This function saves the information from self to file_name.
New in version 2.12.
- to_gvariant()[source]¶
- Returns:
a new, floating,
GLib.Variant
- Return type:
Serialize page setup 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 page setup togroup_name (
str
orNone
) – the group to add the settings to in key_file, orNone
to use the default name “Page Setup”
This function adds the page setup from self to key_file.
New in version 2.12.