Gtk.PrintUnixDialog¶
class — extends Dialog, Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager
A print dialog for platforms which don’t provide a native print dialog, like Unix.
<picture> <source srcset="printdialog-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkPrintUnixDialog" src="printdialog.png"> </picture>
It can be used very much like any other GTK dialog, at the cost of
the portability offered by the high-level printing API with
PrintOperation.
In order to print something with GtkPrintUnixDialog, you need to
use PrintUnixDialog.get_selected_printer to obtain a
Printer object and use it to construct a PrintJob
using PrintJob.new.
GtkPrintUnixDialog uses the following response values:
ResponseType.OK: for the “Print” buttonResponseType.APPLY: for the “Preview” buttonResponseType.CANCEL: for the “Cancel” button
GtkPrintUnixDialog as GtkBuildable¶
The GtkPrintUnixDialog implementation of the GtkBuildable interface
exposes its notebook internal children with the name “notebook”.
An example of a GtkPrintUnixDialog UI definition fragment:
<object class="GtkPrintUnixDialog" id="dialog1">
<child internal-child="notebook">
<object class="GtkNotebook" id="notebook">
<child>
<object type="GtkNotebookPage">
<property name="tab_expand">False</property>
<property name="tab_fill">False</property>
<property name="tab">
<object class="GtkLabel" id="tablabel">
<property name="label">Tab label</property>
</object>
</property>
<property name="child">
<object class="GtkLabel" id="tabcontent">
<property name="label">Content on notebook tab</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
CSS nodes¶
GtkPrintUnixDialog has a single CSS node with name window. The style classes
dialog and print are added.
Constructors¶
new¶
Creates a new GtkPrintUnixDialog.
Parameters:
title— Title of the dialogparent— Transient parent of the dialog
Methods¶
add_custom_tab¶
Adds a custom tab to the print dialog.
Parameters:
child— the widget to put in the custom tabtab_label— the widget to use as tab label
get_current_page¶
Gets the current page of the GtkPrintUnixDialog.
get_embed_page_setup¶
Gets whether to embed the page setup.
get_has_selection¶
Gets whether there is a selection.
get_manual_capabilities¶
Gets the capabilities that have been set on this GtkPrintUnixDialog.
get_page_setup¶
Gets the page setup that is used by the GtkPrintUnixDialog.
get_page_setup_set¶
Gets whether a page setup was set by the user.
get_selected_printer¶
Gets the currently selected printer.
get_settings¶
Gets a new GtkPrintSettings object that represents the
current values in the print dialog.
Note that this creates a new object, and you need to unref it if don’t want to keep it.
get_support_selection¶
Gets whether the print dialog allows user to print a selection.
set_current_page¶
Sets the current page number.
If current_page is not -1, this enables the current page choice
for the range of pages to print.
Parameters:
current_page— the current page number.
set_embed_page_setup¶
Embed page size combo box and orientation combo box into page setup page.
Parameters:
embed— embed page setup selection
set_has_selection¶
Sets whether a selection exists.
Parameters:
has_selection—Trueindicates that a selection exists
set_manual_capabilities¶
This lets you specify the printing capabilities your application supports.
For instance, if you can handle scaling the output then you pass
PrintCapabilities.SCALE. If you don’t pass that, then the dialog
will only let you select the scale if the printing system automatically
handles scaling.
Parameters:
capabilities— the printing capabilities of your application
set_page_setup¶
Sets the page setup of the GtkPrintUnixDialog.
Parameters:
page_setup— aGtkPageSetup
set_settings¶
Sets the GtkPrintSettings for the GtkPrintUnixDialog.
Typically, this is used to restore saved print settings from a previous print operation before the print dialog is shown.
Parameters:
settings— aGtkPrintSettings
set_support_selection¶
Sets whether the print dialog allows user to print a selection.
Parameters:
support_selection—Trueto allow print selection
Properties¶
current_page¶
The current page in the document.
embed_page_setup¶
True if the page setup controls are embedded.
has_selection¶
Whether the application has a selection.
manual_capabilities¶
Capabilities the application can handle.
page_setup¶
The GtkPageSetup object to use.
print_settings¶
The GtkPrintSettings object used for this dialog.
selected_printer¶
The GtkPrinter which is selected.
support_selection¶
Whether the dialog supports selection.