Gtk.PrintUnixDialog

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget Gtk.Native Gtk.Native GObject.GInterface->Gtk.Native Gtk.Root Gtk.Root GObject.GInterface->Gtk.Root Gtk.ShortcutManager Gtk.ShortcutManager GObject.GInterface->Gtk.ShortcutManager GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Dialog Gtk.Dialog Gtk.PrintUnixDialog Gtk.PrintUnixDialog Gtk.Dialog->Gtk.PrintUnixDialog Gtk.Window Gtk.Window Gtk.Native->Gtk.Window Gtk.Root->Gtk.Window Gtk.ShortcutManager->Gtk.Window Gtk.Widget->Gtk.Window Gtk.Window->Gtk.Dialog

Subclasses:

None

Methods

Inherited:

Gtk.Dialog (11), Gtk.Window (62), Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Native (6), Gtk.Root (3)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new (title, parent)

add_custom_tab (child, tab_label)

get_current_page ()

get_embed_page_setup ()

get_has_selection ()

get_manual_capabilities ()

get_page_setup ()

get_page_setup_set ()

get_selected_printer ()

get_settings ()

get_support_selection ()

set_current_page (current_page)

set_embed_page_setup (embed)

set_has_selection (has_selection)

set_manual_capabilities (capabilities)

set_page_setup (page_setup)

set_settings (settings)

set_support_selection (support_selection)

Virtual Methods

Inherited:

Gtk.Dialog (2), Gtk.Window (5), Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Gtk.ShortcutManager (2)

Properties

Inherited:

Gtk.Dialog (1), Gtk.Window (25), Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

current-page

int

r/w

embed-page-setup

bool

r/w

has-selection

bool

r/w

manual-capabilities

Gtk.PrintCapabilities

r/w

page-setup

Gtk.PageSetup

r/w

print-settings

Gtk.PrintSettings

r/w

selected-printer

Gtk.Printer

r

support-selection

bool

r/w

Signals

Inherited:

Gtk.Dialog (2), Gtk.Window (5), Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Gtk.Dialog (2), Gtk.Window (5), Gtk.Widget (13), GObject.Object (1)

Class Details

class Gtk.PrintUnixDialog(*args, **kwargs)
Bases:

Gtk.Dialog

Abstract:

No

GtkPrintUnixDialog implements a print dialog for platforms which don’t provide a native print dialog, like Unix.

An example Gtk.PrintUnixDialog

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 [class`Gtk`.PrintOperation].

In order to print something with GtkPrintUnixDialog, you need to use [method`Gtk`.PrintUnixDialog.get_selected_printer] to obtain a [class`Gtk`.Printer] object and use it to construct a [class`Gtk`.PrintJob] using [ctor`Gtk`.PrintJob.new].

GtkPrintUnixDialog uses the following response values:

Gtk.PrintUnixDialog as Gtk.Buildable

The GtkPrintUnixDialog implementation of the GtkBuildable interface exposes its notebook internal children with the name “notebook”.

An example of a GtkPrintUnixDialog UI definition fragment:

```xml

<child>

False False

Tab label </object>

Content on notebook tab /object

/object /child /object /child /object ```

CSS nodes

GtkPrintUnixDialog has a single CSS node with name window. The style classes dialog and print are added.

classmethod new(title, parent)[source]
Parameters:
  • title (str or None) – Title of the dialog

  • parent (Gtk.Window or None) – Transient parent of the dialog

Returns:

a new GtkPrintUnixDialog

Return type:

Gtk.Widget

Creates a new GtkPrintUnixDialog.

add_custom_tab(child, tab_label)[source]
Parameters:
  • child (Gtk.Widget) – the widget to put in the custom tab

  • tab_label (Gtk.Widget) – the widget to use as tab label

Adds a custom tab to the print dialog.

get_current_page()[source]
Returns:

the current page of self

Return type:

int

Gets the current page of the GtkPrintUnixDialog.

get_embed_page_setup()[source]
Returns:

whether to embed the page setup

Return type:

bool

Gets whether to embed the page setup.

get_has_selection()[source]
Returns:

whether there is a selection

Return type:

bool

Gets whether there is a selection.

get_manual_capabilities()[source]
Returns:

the printing capabilities

Return type:

Gtk.PrintCapabilities

Gets the capabilities that have been set on this GtkPrintUnixDialog.

get_page_setup()[source]
Returns:

the page setup of self.

Return type:

Gtk.PageSetup

Gets the page setup that is used by the GtkPrintUnixDialog.

get_page_setup_set()[source]
Returns:

whether a page setup was set by user.

Return type:

bool

Gets whether a page setup was set by the user.

get_selected_printer()[source]
Returns:

the currently selected printer

Return type:

Gtk.Printer or None

Gets the currently selected printer.

get_settings()[source]
Returns:

a new GtkPrintSettings object with the values from self

Return type:

Gtk.PrintSettings

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()[source]
Returns:

whether the application supports print of selection

Return type:

bool

Gets whether the print dialog allows user to print a selection.

set_current_page(current_page)[source]
Parameters:

current_page (int) – the current page number.

Sets the current page number.

If current_page is not -1, this enables the current page choice for the range of pages to print.

set_embed_page_setup(embed)[source]
Parameters:

embed (bool) – embed page setup selection

Embed page size combo box and orientation combo box into page setup page.

set_has_selection(has_selection)[source]
Parameters:

has_selection (bool) – True indicates that a selection exists

Sets whether a selection exists.

set_manual_capabilities(capabilities)[source]
Parameters:

capabilities (Gtk.PrintCapabilities) – the printing capabilities of your application

This lets you specify the printing capabilities your application supports.

For instance, if you can handle scaling the output then you pass Gtk.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.

set_page_setup(page_setup)[source]
Parameters:

page_setup (Gtk.PageSetup) – a GtkPageSetup

Sets the page setup of the GtkPrintUnixDialog.

set_settings(settings)[source]
Parameters:

settings (Gtk.PrintSettings or None) – a GtkPrintSettings

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.

set_support_selection(support_selection)[source]
Parameters:

support_selection (bool) – True to allow print selection

Sets whether the print dialog allows user to print a selection.

Property Details

Gtk.PrintUnixDialog.props.current_page
Name:

current-page

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE

The current page in the document.

Gtk.PrintUnixDialog.props.embed_page_setup
Name:

embed-page-setup

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

True if the page setup controls are embedded.

Gtk.PrintUnixDialog.props.has_selection
Name:

has-selection

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the application has a selection.

Gtk.PrintUnixDialog.props.manual_capabilities
Name:

manual-capabilities

Type:

Gtk.PrintCapabilities

Default Value:

0

Flags:

READABLE, WRITABLE

Capabilities the application can handle.

Gtk.PrintUnixDialog.props.page_setup
Name:

page-setup

Type:

Gtk.PageSetup

Default Value:

None

Flags:

READABLE, WRITABLE

The GtkPageSetup object to use.

Gtk.PrintUnixDialog.props.print_settings
Name:

print-settings

Type:

Gtk.PrintSettings

Default Value:

None

Flags:

READABLE, WRITABLE

The GtkPrintSettings object used for this dialog.

Gtk.PrintUnixDialog.props.selected_printer
Name:

selected-printer

Type:

Gtk.Printer

Default Value:

None

Flags:

READABLE

The GtkPrinter which is selected.

Gtk.PrintUnixDialog.props.support_selection
Name:

support-selection

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether the dialog supports selection.