Gtk.PrintDialog¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.PrintDialog(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A
GtkPrintDialog
object collects the arguments that are needed to present a print dialog to the user, such as a title for the dialog and whether it should be modal.The dialog is shown with the [method`Gtk`.PrintDialog.setup] function. The actual printing can be done with [method`Gtk`.PrintDialog.print] or [method`Gtk`.PrintDialog.print_file]. These APIs follows the GIO async pattern, and the results can be obtained by calling the corresponding finish methods.
New in version 4.14.
- classmethod new()[source]¶
- Returns:
the new
GtkPrintDialog
- Return type:
Creates a new
GtkPrintDialog
object.New in version 4.14.
- get_accept_label()[source]¶
- Returns:
the accept label
- Return type:
Returns the label that will be shown on the accept button of the print dialog.
New in version 4.14.
- get_modal()[source]¶
- Returns:
whether the print dialog is modal
- Return type:
Returns whether the print dialog blocks interaction with the parent window while it is presented.
New in version 4.14.
- get_page_setup()[source]¶
- Returns:
the page setup
- Return type:
Returns the page setup.
New in version 4.14.
- get_print_settings()[source]¶
- Returns:
the settings
- Return type:
Returns the print settings for the print dialog.
New in version 4.14.
- get_title()[source]¶
- Returns:
the title
- Return type:
Returns the title that will be shown on the print dialog.
New in version 4.14.
- print_(parent, setup, cancellable, callback, *user_data)[source]¶
- Parameters:
parent (
Gtk.Window
orNone
) – the parentGtkWindow
setup (
Gtk.PrintSetup
orNone
) – theGtkPrintSetup
to usecancellable (
Gio.Cancellable
orNone
) – aGCancellable
to cancel the operationcallback (
Gio.AsyncReadyCallback
orNone
) – a callback to call when the operation is complete
This function prints content from a stream.
If you pass
NULL
as setup, then this method will present a print dialog. Otherwise, it will attempt to print directly, without user interaction.The callback will be called when the printing is done.
New in version 4.14.
- print_file(parent, setup, file, cancellable, callback, *user_data)[source]¶
- Parameters:
parent (
Gtk.Window
orNone
) – the parentGtkWindow
setup (
Gtk.PrintSetup
orNone
) – theGtkPrintSetup
to usefile (
Gio.File
) – theGFile
to printcancellable (
Gio.Cancellable
orNone
) – aGCancellable
to cancel the operationcallback (
Gio.AsyncReadyCallback
orNone
) – a callback to call when the operation is complete
This function prints a file.
If you pass
NULL
as setup, then this method will present a print dialog. Otherwise, it will attempt to print directly, without user interaction.New in version 4.14.
- print_file_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGAsyncResult
- Raises:
- Returns:
Whether the call was successful
- Return type:
Finishes the [method`Gtk`.PrintDialog.print_file] call and returns the results.
New in version 4.14.
- print_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGAsyncResult
- Raises:
- Returns:
a [class`Gio`.OutputStream]
- Return type:
Finishes the [method`Gtk`.PrintDialog.print] call and returns the results.
If the call was successful, the content to be printed should be written to the returned output stream. Otherwise,
NULL
is returned.The overall results of the print operation will be returned in the [method`Gio`.OutputStream.close] call, so if you are interested in the results, you need to explicitly close the output stream (it will be closed automatically if you just unref it). Be aware that the close call may not be instant as it operation will for the printer to finish printing.
New in version 4.14.
- set_accept_label(accept_label)[source]¶
- Parameters:
accept_label (
str
) – the new accept label
Sets the label that will be shown on the accept button of the print dialog shown for [method`Gtk`.PrintDialog.setup].
New in version 4.14.
- set_modal(modal)[source]¶
- Parameters:
modal (
bool
) – the new value
Sets whether the print dialog blocks interaction with the parent window while it is presented.
New in version 4.14.
- set_page_setup(page_setup)[source]¶
- Parameters:
page_setup (
Gtk.PageSetup
) – the new page setup
Set the page setup for the print dialog.
New in version 4.14.
- set_print_settings(print_settings)[source]¶
- Parameters:
print_settings (
Gtk.PrintSettings
) – the new print settings
Sets the print settings for the print dialog.
New in version 4.14.
- set_title(title)[source]¶
- Parameters:
title (
str
) – the new title
Sets the title that will be shown on the print dialog.
New in version 4.14.
- setup(parent, cancellable, callback, *user_data)[source]¶
- Parameters:
parent (
Gtk.Window
orNone
) – the parentGtkWindow
cancellable (
Gio.Cancellable
orNone
) – aGCancellable
to cancel the operationcallback (
Gio.AsyncReadyCallback
orNone
) – a callback to call when the operation is complete
This function presents a print dialog to let the user select a printer, and set up print settings and page setup.
The callback will be called when the dialog is dismissed. The obtained [struct`Gtk`.PrintSetup] can then be passed to [method`Gtk`.PrintDialog.print] or [method`Gtk`.PrintDialog.print_file].
One possible use for this method is to have the user select a printer, then show a page setup UI in the application (e.g. to arrange images on a page), then call [method`Gtk`.PrintDialog.print] on self to do the printing without further user interaction.
New in version 4.14.
- setup_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – aGAsyncResult
- Raises:
- Returns:
The
GtkPrintSetup
object that resulted from the call, orNULL
if the call was not successful- Return type:
Finishes the [method`Gtk`.PrintDialog.setup] call.
If the call was successful, it returns a [struct`Gtk`.PrintSetup] which contains the print settings and page setup information that will be used to print.
New in version 4.14.
Property Details¶
- Gtk.PrintDialog.props.accept_label¶
- Name:
accept-label
- Type:
- Default Value:
- Flags:
A label that may be shown on the accept button of a print dialog that is presented by [method`Gtk`.PrintDialog.setup].
New in version 4.14.
- Gtk.PrintDialog.props.modal¶
- Name:
modal
- Type:
- Default Value:
- Flags:
Whether the print dialog is modal.
New in version 4.14.
- Gtk.PrintDialog.props.page_setup¶
- Name:
page-setup
- Type:
- Default Value:
- Flags:
The page setup to use.
New in version 4.14.
- Gtk.PrintDialog.props.print_settings¶
- Name:
print-settings
- Type:
- Default Value:
- Flags:
The print settings to use.
New in version 4.14.