Gtk.Assistant¶
Example¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Window (119), Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10)
- Structs:
Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Window (5), Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)
|
|
|
|
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
Use Header Bar for actions. |
Child Properties¶
Name |
Type |
Default |
Flags |
Short Description |
---|---|---|---|---|
|
r/w |
Whether all required fields on the page have been filled out |
||
|
r/w |
Whether the assistant adds padding around the page |
||
|
r/w |
Header image for the assistant page |
||
|
r/w |
The type of the assistant page |
||
|
r/w |
Sidebar image for the assistant page |
||
|
r/w |
The title of the assistant page |
Style Properties¶
- Inherited:
Name |
Type |
Default |
Flags |
Short Description |
---|---|---|---|---|
|
|
d/r |
Number of pixels around the content pages. |
|
|
|
d/r |
Number of pixels around the header. |
Signals¶
- Inherited:
Gtk.Window (5), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name |
Short Description |
---|---|
The |
|
The |
|
The |
|
The |
Fields¶
- Inherited:
Gtk.Window (5), Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Gtk.Assistant(*args, **kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A
Gtk.Assistant
is a widget used to represent a generally complex operation splitted in several steps, guiding the user through its pages and controlling the page flow to collect the necessary data.The design of
Gtk.Assistant
is that it controls what buttons to show and to make sensitive, based on what it knows about the page sequence and thetype
of each page, in addition to state information like the pagecompletion
andcommitted
status.If you have a case that doesn’t quite fit in
Gtk.Assistants
way of handling buttons, you can use theGtk.AssistantPageType.CUSTOM
page type and handle buttons yourself.The
Gtk.Assistant
implementation of theGtk.Buildable
interface exposes the action_area as internal children with the name “action_area”.To add pages to an assistant in
Gtk.Builder
, simply add it as a child to theGtk.Assistant
object, and set its child properties as necessary.- CSS nodes
Gtk.Assistant
has a single CSS node with the name assistant.- classmethod new()[source]¶
- Returns:
a newly created
Gtk.Assistant
- Return type:
Creates a new
Gtk.Assistant
.New in version 2.10.
- add_action_widget(child)[source]¶
- Parameters:
child (
Gtk.Widget
) – aGtk.Widget
Adds a widget to the action area of a
Gtk.Assistant
.New in version 2.10.
- append_page(page)[source]¶
- Parameters:
page (
Gtk.Widget
) – aGtk.Widget
- Returns:
the index (starting at 0) of the inserted page
- Return type:
Appends a page to the self.
New in version 2.10.
- commit()[source]¶
Erases the visited page history so the back button is not shown on the current page, and removes the cancel button from subsequent pages.
Use this when the information provided up to the current page is hereafter deemed permanent and cannot be modified or undone. For example, showing a progress page to track a long-running, unreversible operation after the user has clicked apply on a confirmation page.
New in version 2.22.
- get_current_page()[source]¶
- Returns:
The index (starting from 0) of the current page in the self, or -1 if the self has no pages, or no current page.
- Return type:
Returns the page number of the current page.
New in version 2.10.
- get_n_pages()[source]¶
- Returns:
the number of pages in the self
- Return type:
Returns the number of pages in the self
New in version 2.10.
- get_nth_page(page_num)[source]¶
- Parameters:
page_num (
int
) – the index of a page in the self, or -1 to get the last page- Returns:
the child widget, or
None
if page_num is out of bounds- Return type:
Gtk.Widget
orNone
Returns the child widget contained in page number page_num.
New in version 2.10.
- get_page_complete(page)[source]¶
- Parameters:
page (
Gtk.Widget
) – a page of self- Returns:
True
if page is complete.- Return type:
Gets whether page is complete.
New in version 2.10.
- get_page_has_padding(page)[source]¶
- Parameters:
page (
Gtk.Widget
) – a page of self- Returns:
True
if page has padding- Return type:
Gets whether page has padding.
New in version 3.18.
- get_page_header_image(page)[source]¶
- Parameters:
page (
Gtk.Widget
) – a page of self- Returns:
the header image for page, or
None
if there’s no header image for the page- Return type:
Gets the header image for page.
New in version 2.10.
Deprecated since version 3.2: Since GTK+ 3.2, a header is no longer shown; add your header decoration to the page content instead.
- get_page_side_image(page)[source]¶
- Parameters:
page (
Gtk.Widget
) – a page of self- Returns:
the side image for page, or
None
if there’s no side image for the page- Return type:
Gets the side image for page.
New in version 2.10.
Deprecated since version 3.2: Since GTK+ 3.2, sidebar images are not shown anymore.
- get_page_title(page)[source]¶
- Parameters:
page (
Gtk.Widget
) – a page of self- Returns:
the title for page
- Return type:
Gets the title for page.
New in version 2.10.
- get_page_type(page)[source]¶
- Parameters:
page (
Gtk.Widget
) – a page of self- Returns:
the page type of page
- Return type:
Gets the page type of page.
New in version 2.10.
- insert_page(page, position)[source]¶
- Parameters:
page (
Gtk.Widget
) – aGtk.Widget
position (
int
) – the index (starting at 0) at which to insert the page, or -1 to append the page to the self
- Returns:
the index (starting from 0) of the inserted page
- Return type:
Inserts a page in the self at a given position.
New in version 2.10.
- next_page()[source]¶
Navigate to the next page.
It is a programming error to call this function when there is no next page.
This function is for use when creating pages of the
Gtk.AssistantPageType.CUSTOM
type.New in version 3.0.
- prepend_page(page)[source]¶
- Parameters:
page (
Gtk.Widget
) – aGtk.Widget
- Returns:
the index (starting at 0) of the inserted page
- Return type:
Prepends a page to the self.
New in version 2.10.
- previous_page()[source]¶
Navigate to the previous visited page.
It is a programming error to call this function when no previous page is available.
This function is for use when creating pages of the
Gtk.AssistantPageType.CUSTOM
type.New in version 3.0.
- remove_action_widget(child)[source]¶
- Parameters:
child (
Gtk.Widget
) – aGtk.Widget
Removes a widget from the action area of a
Gtk.Assistant
.New in version 2.10.
- remove_page(page_num)[source]¶
- Parameters:
page_num (
int
) – the index of a page in the self, or -1 to remove the last page
Removes the page_num’s page from self.
New in version 3.2.
- set_current_page(page_num)[source]¶
- Parameters:
page_num (
int
) – index of the page to switch to, starting from 0. If negative, the last page will be used. If greater than the number of pages in the self, nothing will be done.
Switches the page to page_num.
Note that this will only be necessary in custom buttons, as the self flow can be set with
Gtk.Assistant.set_forward_page_func
().New in version 2.10.
- set_forward_page_func(page_func, *data)[source]¶
- Parameters:
page_func (
Gtk.AssistantPageFunc
orNone
) – theGtk.AssistantPageFunc
, orNone
to use the default one
Sets the page forwarding function to be page_func.
This function will be used to determine what will be the next page when the user presses the forward button. Setting page_func to
None
will make the assistant to use the default forward function, which just goes to the next visible page.New in version 2.10.
- set_page_complete(page, complete)[source]¶
- Parameters:
page (
Gtk.Widget
) – a page of selfcomplete (
bool
) – the completeness status of the page
Sets whether page contents are complete.
This will make self update the buttons state to be able to continue the task.
New in version 2.10.
- set_page_has_padding(page, has_padding)[source]¶
- Parameters:
page (
Gtk.Widget
) – a page of selfhas_padding (
bool
) – whether this page has padding
Sets whether the assistant is adding padding around the page.
New in version 3.18.
- set_page_header_image(page, pixbuf)[source]¶
- Parameters:
page (
Gtk.Widget
) – a page of selfpixbuf (
GdkPixbuf.Pixbuf
orNone
) – the new header image page
Sets a header image for page.
New in version 2.10.
Deprecated since version 3.2: Since GTK+ 3.2, a header is no longer shown; add your header decoration to the page content instead.
- set_page_side_image(page, pixbuf)[source]¶
- Parameters:
page (
Gtk.Widget
) – a page of selfpixbuf (
GdkPixbuf.Pixbuf
orNone
) – the new side image page
Sets a side image for page.
This image used to be displayed in the side area of the assistant when page is the current page.
New in version 2.10.
Deprecated since version 3.2: Since GTK+ 3.2, sidebar images are not shown anymore.
- set_page_title(page, title)[source]¶
- Parameters:
page (
Gtk.Widget
) – a page of selftitle (
str
) – the new title for page
Sets a title for page.
The title is displayed in the header area of the assistant when page is the current page.
New in version 2.10.
- set_page_type(page, type)[source]¶
- Parameters:
page (
Gtk.Widget
) – a page of selftype (
Gtk.AssistantPageType
) – the new type for page
Sets the page type for page.
The page type determines the page behavior in the self.
New in version 2.10.
- update_buttons_state()[source]¶
Forces self to recompute the buttons state.
GTK+ automatically takes care of this in most situations, e.g. when the user goes to a different page, or when the visibility or completeness of a page changes.
One situation where it can be necessary to call this function is when changing a value on the current page affects the future page flow of the assistant.
New in version 2.10.
- do_apply() virtual¶
Signal emitted when the apply button is clicked.
- do_cancel() virtual¶
Signal emitted when the cancel button is clicked.
- do_close() virtual¶
Signal emitted either when the close button or last page apply button is clicked.
- do_prepare(page) virtual¶
- Parameters:
page (
Gtk.Widget
) –
Signal emitted when a new page is set as the assistant’s current page, before making the new page visible.
Signal Details¶
- Gtk.Assistant.signals.apply(assistant)¶
- Signal Name:
apply
- Flags:
- Parameters:
assistant (
Gtk.Assistant
) – The object which received the signal
The
::apply
signal is emitted when the apply button is clicked.The default behavior of the
Gtk.Assistant
is to switch to the page after the current page, unless the current page is the last one.A handler for the
::apply
signal should carry out the actions for which the wizard has collected data. If the action takes a long time to complete, you might consider putting a page of typeGtk.AssistantPageType.PROGRESS
after the confirmation page and handle this operation within theGtk.Assistant
::prepare
signal of the progress page.New in version 2.10.
- Gtk.Assistant.signals.cancel(assistant)¶
- Signal Name:
cancel
- Flags:
- Parameters:
assistant (
Gtk.Assistant
) – The object which received the signal
The
::cancel
signal is emitted when then the cancel button is clicked.New in version 2.10.
- Gtk.Assistant.signals.close(assistant)¶
- Signal Name:
close
- Flags:
- Parameters:
assistant (
Gtk.Assistant
) – The object which received the signal
The
::close
signal is emitted either when the close button of a summary page is clicked, or when the apply button in the last page in the flow (of typeGtk.AssistantPageType.CONFIRM
) is clicked.New in version 2.10.
- Gtk.Assistant.signals.escape(assistant)¶
- Signal Name:
escape
- Flags:
- Parameters:
assistant (
Gtk.Assistant
) – The object which received the signal
- Gtk.Assistant.signals.prepare(assistant, page)¶
- Signal Name:
prepare
- Flags:
- Parameters:
assistant (
Gtk.Assistant
) – The object which received the signalpage (
Gtk.Widget
) – the current page
The
::prepare
signal is emitted when a new page is set as the assistant’s current page, before making the new page visible.A handler for this signal can do any preparations which are necessary before showing page.
New in version 2.10.
Property Details¶
- Gtk.Assistant.props.use_header_bar¶
- Name:
use-header-bar
- Type:
- Default Value:
-1
- Flags:
True
if the assistant uses aGtk.HeaderBar
for action buttons instead of the action-area.For technical reasons, this property is declared as an integer property, but you should only set it to
True
orFalse
.New in version 3.12.