gtk.Assistant — a widget used to guide users through multi-step operations (new in PyGTK 2.10)
class gtk.Assistant(gtk.Window): |
+--gobject.GObject +-- gtk.Object +-- gtk.Widget +-- gtk.Container +-- gtk.Bin +-- gtk.Window +-- gtk.Assistant
|
|
gtk.Container Signal Prototypes
"apply" | def callback( |
"cancel" | def callback( |
"close" | def callback( |
"prepare" | def callback( |
A gtk.Assistant
is a widget used to guide the user through a complex operation by
breaking it into several steps. Each step is generally handled by one
assistant page. The assistant controls the page flow to collect the
necessary data to complete the application task.
gtk.Assistant()
Returns : | a new gtk.Assistant
object. |
This constructor is available in PyGTK 2.10 and above.
Creates a new gtk.Assistant
.
def get_current_page()
Returns :, | The index (starting from 0) of the current page in the assistant, if the assistant has no pages, -1 will be returned. |
This method is available in PyGTK 2.10 and above.
The get_current_page
() method returns
the page number of the current page.
def set_current_page(page_num
)
| the 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 assistant, there will be no change. |
This method is available in PyGTK 2.10 and above.
The set_current_page
() method switches
the page to the page specified by
page_num
. Note that this will only be necessary
in custom buttons, as the assistant flow can be set with the set_forward_page_func
()
method.
def get_n_pages()
Returns : | The number of pages in the assistant. |
This method is available in PyGTK 2.10 and above.
The get_n_pages
() method returns the
number of pages in the assistant
def get_nth_page(page_num
)
| The index of a page in the assistant, or -1 to get the last page; |
Returns : | The child widget, or None if
page_num is out of
bounds. |
This method is available in PyGTK 2.10 and above.
The get_nth_page
() method returns the
child widget contained in the page specified by
page_num
.
def prepend_page(page
)
| a gtk.Widget |
Returns : | the index (starting at 0) of the inserted page |
This method is available in PyGTK 2.10 and above.
The prepend_page
() method prepends the
page specified by page
to the assistant.
def append_page(page
)
| a gtk.Widget |
Returns : | the index (starting at 0) of the inserted page |
This method is available in PyGTK 2.10 and above.
The append_page
() method appends the
page specified by page
to the assistant.
def insert_page(page
, position
)
| a gtk.Widget |
| the index (starting at 0) at which to insert the page, or -1 to append the page to the assistant |
Returns : | the index (starting from 0) of the inserted page |
This method is available in PyGTK 2.10 and above.
The insert_page
() method inserts the
page specified by page
in the assistant at the
position index specified by position
.
def set_forward_page_func(page_func
, data
)
| the function, or None to use
the default function. |
| user data for
page_func |
This method is available in PyGTK 2.10 and above.
The set_forward_page_func
() method 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 use the default
forward function, which just goes to the next visible page.
The signature of page_func
is:
def page_func(current_page, user_data):
where current_page
is the index of the
current page and user_data
is
data
.
def set_page_type(page
, type
)
| a page in the assistant |
| the new type for
page |
This method is available in PyGTK 2.10 and above.
The set_page_type
() method sets the
page type, which specifies the page behavior, for the page specified
by page
to the value specified by
type
. The page type must be one of the GTK Assistant Page Type Constants.
def get_page_type(page
)
| a page in the assistant |
Returns : | the page type of
page . |
This method is available in PyGTK 2.10 and above.
The get_page_type
() method returns the
page type of the page specified by page
. The
page type will be one of the GTK Assistant Page Type Constants.
def set_page_title(page
, title
)
| a page of the assistant |
| the new title for
page |
This method is available in PyGTK 2.10 and above.
The set_page_title
() method sets the
title for the page specified by page
to the
string specified by title
. The title is
displayed in the header area of the assistant when
page
is the current page.
def get_page_title(page
)
| a page of the assistant |
Returns : | the title for
page . |
This method is available in PyGTK 2.10 and above.
The get_page_title
() method returns the
title for the page specified by page
.
def set_page_header_image(page
, pixbuf
=None)
| a page of the assistant |
| the new header image for
page or
None . |
This method is available in PyGTK 2.10 and above.
The set_page_header_image
() method sets
the gtk.gdk.Pixbuf
specified by pixbuf
as the header image for the
page specified by page
. This image is displayed
in the header area of the assistant when page
is the current page. If pixbuf
is
None
the header image will be removed.
def get_page_header_image(page
)
| a page of the assistant |
Returns : | the header image for page ,
or None if there's no header image for the
page. |
This method is available in PyGTK 2.10 and above.
The get_page_header_image
() method
returns the header image for the page specified by
page
.
def set_page_side_image(page
, pixbuf
=None)
| a page of the assistant |
| the new side image for
page or
None . |
This method is available in PyGTK 2.10 and above.
The set_page_side_image
() method sets
the gtk.gdk.Pixbuf
specified by pixbuf
as the header image for the
page specified by page
. This image is displayed
in the side area of the assistant when page
is
the current page. If pixbuf
is
None
the side image will be removed.
def get_page_side_image(page
)
| a page of the assistant |
Returns : | the side image for page ,
or None if there's no side image for the
page. |
This method is available in PyGTK 2.10 and above.
The get_page_side_image
() method
returns the header image for the page specified by
page
.
def set_page_complete(page
, complete
)
| a page of the assistant |
| if True the page status is
complete. |
This method is available in PyGTK 2.10 and above.
The set_page_complete
() method sets the
"complete" property of the page specified by
page
to the value specified by
complete
. If complete
is
True
the page
contents are
complete. This will make the assistant update the state of its
buttons.
def get_page_complete(page
)
| a page of the assistant |
Returns : | True if
page is complete. |
This method is available in PyGTK 2.10 and above.
The get_page_complete
() method returns
the value of the "complete" property of the page specified by
page
. If the return value is
True
, the page
contents are
complete.
def add_action_widget(child
)
| a gtk.Widget |
This method is available in PyGTK 2.10 and above.
The add_action_widget
() method adds the
widget specified by child
to the action area of
the assistant.
def remove_action_widget(child
)
| a gtk.Widget |
This method is available in PyGTK 2.10 and above.
The remove_action_widget
() method
removes the widget specified by child
from the
action area of the assistant.
def update_buttons_state()
This method is available in PyGTK 2.10 and above.
The update_buttons_state
() method
forces the assistant to recompute the state of its buttons.
PyGTK 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.
def commit()
This method is available in PyGTK 2.22 and above.
The commit
() method 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.
def callback(assistant
, user_param1
, ...
)
| the gtk.Assistant
that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
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 to put a page of type
gtk.ASSISTANT_PAGE_PROGRESS
after the confirmation
page and handle this operation within the "prepare" signal of the
progress page.
def callback(assistant
, user_param1
, ...
)
| the gtk.Assistant
that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "cancel" signal is emitted when the cancel button is clicked.
def callback(assistant
, user_param1
, ...
)
| the gtk.Assistant
that received the signal |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
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 type gtk.ASSISTANT_PAGE_CONFIRM
) is
clicked.
def callback(assistant
, page
, user_param1
, ...
)
| the gtk.Assistant
that received the signal |
| the new page to prepare for display |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
The "prepare" signal is emitted when a new page is set as the
assistant's current page, but before making the new page visible. A
handler for this signal can do any preparation that are necessary
before showing page
.