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
GtkPageSetup
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 the
GtkPrintOperation
when printing. The benefit of splitting this out of theGtkPrintSettings
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
GtkPageSetup
use [ctor`Gtk`.PageSetup.new] to get the defaults, or use [func`Gtk`.print_run_page_setup_dialog] to show the page setup dialog and receive the resulting page setup.- A page setup dialog
```c static
Gtk.PrintSettings
*settings =None
; staticGtk.PageSetup
*page_setup =None
;static void do_page_setup (void) {
Gtk.PageSetup
*new_page_setup;if (settings ==
None
) settings =Gtk.PrintSettings.new
();new_page_setup =
Gtk.print_run_page_setup_dialog
(GTK_WINDOW (main_window), page_setup, settings);if (page_setup)
GObject.Object.unref
(page_setup);page_setup = new_page_setup; } ```
- classmethod new_from_file(file_name)[source]¶
- Parameters:
file_name (
str
) – the filename to read the page setup from- Raises:
- Returns:
the restored
GtkPageSetup
- Return type:
Reads the page setup from the file file_name.
Returns a new
GtkPageSetup
object with the restored page setup, orNone
if an error occurred. See [method`Gtk`.PageSetup.to_file].
- classmethod new_from_gvariant(variant)[source]¶
- Parameters:
variant (
GLib.Variant
) – an a{sv}GVariant
- Returns:
a new
GtkPageSetup
object- Return type:
Desrialize a page setup from an a{sv} variant.
The variant must be in the format produced by [method`Gtk`.PageSetup.to_gvariant].
- classmethod new_from_key_file(key_file, group_name)[source]¶
- Parameters:
key_file (
GLib.KeyFile
) – theGKeyFile
to retrieve the page_setup fromgroup_name (
str
orNone
) – the name of the group in the key_file to read to use the default name “Page Setup”
- Raises:
- Returns:
the restored
GtkPageSetup
- Return type:
Reads the page setup from the group group_name in the key file key_file.
Returns a new
GtkPageSetup
object with the restored page setup, orNone
if an error occurred.
- 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.
- 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.
- get_orientation()[source]¶
- Returns:
the page orientation
- Return type:
Gets the page orientation of the
GtkPageSetup
.
- 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 [method`Gtk`.PageSetup.get_paper_height].
- 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 [method`Gtk`.PageSetup.get_paper_width].
- 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 [method`Gtk`.PageSetup.get_page_height].
- get_paper_size()[source]¶
- Returns:
the paper size
- Return type:
Gets the paper size of the
GtkPageSetup
.
- 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 [method`Gtk`.PageSetup.get_page_width].
- 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.
- 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.
- 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 [method`Gtk`.PageSetup.to_file].
- load_key_file(key_file, group_name)[source]¶
- Parameters:
key_file (
GLib.KeyFile
) – theGKeyFile
to retrieve the page_setup fromgroup_name (
str
orNone
) – the name of the group in the key_file to read 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.
- set_orientation(orientation)[source]¶
- Parameters:
orientation (
Gtk.PageOrientation
) – aGtkPageOrientation
value
Sets the page orientation of the
GtkPageSetup
.
- set_paper_size(size)[source]¶
- Parameters:
size (
Gtk.PaperSize
) – aGtkPaperSize
Sets the paper size of the
GtkPageSetup
without changing the margins.See [method`Gtk`.PageSetup.set_paper_size_and_default_margins].
- set_paper_size_and_default_margins(size)[source]¶
- Parameters:
size (
Gtk.PaperSize
) – aGtkPaperSize
Sets the paper size of the
GtkPageSetup
and modifies the margins according to the new paper size.
- to_file(file_name)[source]¶
-
This function saves the information from self to file_name.