gtk.ActionGroup — a group of actions (new in PyGTK 2.4)
class gtk.ActionGroup( |
|
def callback( | |
def callback( | |
def callback( | |
def callback( |
This object is available in PyGTK 2.4 and above.
gtk.Action
objects
are organized into gtk.ActionGroup
objects. An action group is basically a map from names to gtk.Action
objects.
All actions that would make sense to use in a particular context should be in a single action group. Multiple action groups may be used for a particular user interface. In fact, it is expected that most nontrivial applications will make use of multiple groups. For example, in an application that can edit multiple documents, there could be one group holding global actions (e.g. quit, about, new), and one group per document holding actions that act on that document (e.g. save, cut/copy/paste, etc). Each window's menus would be constructed from a combination of the two action groups.
Accelerators are handled by the GTK+ accelerator map. All actions are assigned an accelerator path (which normally has the form "<Actions>/group-name/action-name") and a shortcut is associated with this accelerator path. All menuitems and toolitems take on this accelerator path. The GTK+ accelerator map code makes sure that the correct shortcut is displayed next to the menu item.
gtk.ActionGroup(name
)
| the name of the action group. |
Returns : | the new gtk.ActionGroup |
This constructor is available in PyGTK 2.4 and above.
Creates a new gtk.ActionGroup
object with the name specified by name
. The name of
the action group is used when associating keybindings with the
actions.
def get_name()
Returns : | the name of the action group. |
This method is available in PyGTK 2.4 and above.
The get_name
() method returns the value
of the "name" property that contains the name of the action group.
def get_sensitive()
Returns : | True if the group is
sensitive. |
This method is available in PyGTK 2.4 and above.
The get_sensitive
() method returns the
value of the "sensitive" property. If "sensitive" is True
the group is enabled. The constituent actions can only be logically
sensitive (see the gtk.Action.is_sensitive()
method) if they are sensitive (see the gtk.Action.get_sensitive()
method) and their group is sensitive.
def set_sensitive(sensitive
)
| if True , the group is
enabled |
This method is available in PyGTK 2.4 and above.
The set_sensitive
() method sets the
"sensitive" property to the value of
sensitive
. If sensitive
is True
, the gtk.ActionGroup
is enabled.
def get_visible()
Returns : | True if the group is
visible. |
This method is available in PyGTK 2.4 and above.
The get_visible
() method returns the
value of the "visible" property. If "visible" is True
,
the group is visible. The constituent actions can only be logically visible
(see the gtk.Action.is_visible()
method) if they are visible (see the gtk.Action.get_visible()
method) and their group is visible.
def set_visible(visible
)
| if True , the group will be
visible |
This method is available in PyGTK 2.4 and above.
The set_visible
() method sets the
"visible" property to the value of visible
. If
visible
is True
the gtk.ActionGroup
will be visible.
def get_action(action_name
)
| the name of the action |
Returns : | the action, or None if no
action with that name exists. |
This method is available in PyGTK 2.4 and above.
The get_action
() method retrieves the
action in the action group with the name specified by
action_name
.
def list_actions()
Returns : | a list of the action objects in the action group |
This method is available in PyGTK 2.4 and above.
The list_action
() method returns a list
containing the gtk.Action
objects
in the action group.
def add_action(action
)
| an action |
This method is available in PyGTK 2.4 and above.
The add_action
() method adds the gtk.Action
specified
by action
to the action group.
def add_action_with_accel(action
, accelerator
)
| the action to add |
| the accelerator for the action, in the format
understood by the gtk.accelerator_parse ()
function, or None to use the stock
accelerator |
This method is available in PyGTK 2.4 and above.
The add_action_with_accel
() method adds
a gtk.Action
specified by action
to the action group and sets up
the accelerator specified by accelerator
.
If accelerator
is
None
, this method attempts to use the accelerator
associated with the "stock_id" property of the gtk.Action
.
Accel paths are set to
<Actions>/
.group-name
/action-name
def remove_action(action
)
| a gtk.Action |
This method is available in PyGTK 2.4 and above.
The remove_action
() method removes the
gtk.Action
specified by action
from the action group.
def add_actions(entries
, user_data
=None)
| a list or tuple of action descriptions |
| data to pass to the action callbacks |
This method is available in PyGTK 2.4 and above.
The add_actions
() method is a
convenience method that creates a number of gtk.Action
objects
based on the information in the list of action entry tuples contained in
entries
and adds them to the action group. The entry
tuples can vary in size from one to six items with the following
information:
None
if a label is specified.set_translation_domain
()
method. Optional with a default value of None
if a stock
id is specified.gtk.accelerator_parse
()
function. Optional with a default value of
None
.set_translation_domain
()
method. Optional with a default value of None
.None
.The "activate" signals of the actions are connected to the
callbacks and their accel paths are set to
<Actions>/
.group-name
/action-name
def add_toggle_actions(entries
, user_data
=None)
| a list or tuple of toggle action entry tuples |
| data to pass to the action callbacks |
This method is available in PyGTK 2.4 and above.
The add_toggle_actions
() method is a
convenience method that creates a number of gtk.ToggleAction
objects based on the information in the list of action entry tuples
contained in entries
and adds them to the action
group. The toggle action entry tuples can vary in size from one to seven items
with the following information:
None
if a label is specified.set_translation_domain
()
method. Optional with a default value of None
if a stock
id is specified.gtk.accelerator_parse
()
function. Optional with a default value of
None
.set_translation_domain
()
method. Optional with a default value of None
.None
.False
.The "activate" signals of the actions are connected to the
callbacks and their accel paths are set to
<Actions>/
.group-name
/action-name
def add_radio_actions(entries
, value
=0, on_change
=None, user_data
=None)
| a list or tuple of radio action entry tuples |
| the value of the radio action to set active |
| a callback to connect to the "changed" signal of the first radio action |
| data to pass to the
on_change callback |
This method is available in PyGTK 2.4 and above.
The add_radio_actions
() method is a
convenience method that creates a number of gtk.RadioAction
objects based on the information in the list of action entry tuples
contained in entries
and adds them to the action
group. The entry tuples can vary in size from one to six items with the
following information:
None
if a label is specified.set_translation_domain
()
method. Optional with a default value of None
if a stock
id is specified.gtk.accelerator_parse
()
function. Optional with a default value of
None
.set_translation_domain
()
method. Optional with a default value of None
.0
. Should be specified in
applications.The value
parameter specifies the radio
action that should be set active. The "changed" signal of the first radio
action is connected to the on_change
callback (if
specified and not None
) and the accel paths of the
actions are set to
<Actions>/
.group-name
/action-name
def set_translation_domain(domain
)
| the translation domain to use for
dgettext() calls |
This method is available in PyGTK 2.4 and above.
The set_translation_domain
() method
sets the translation domain to the string specified by
domain
and uses dgettext()
for translating the label
and
tooltip
strings of the actions added by the add_actions
(),
add_toggle_actions
()
and add_radio_actions
()
methods.
def translate_string(string
)
| the string to be translated |
Returns : | the translation of
string |
This method is available in PyGTK 2.6 and above.
The translate_string
() method
translates the string specified by string
using the
specified translate_func
(). This is mainly intended for
language bindings.
def callback(actiongroup
, action
, proxy
, user_param1
, ...
)
| the actiongroup that received the signal |
| the action that is associated with
proxy |
| the proxy widget associated with
action |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
This signal is available in PyGTK 2.4 and above.
The "connect-proxy" signal is emitted when the widget specified
by proxy
is connected to the gtk.Action
specified
by action
.
def callback(actiongroup
, action
, proxy
, user_param1
, ...
)
| the actiongroup that received the signal |
| the action that is associated with
proxy |
| the proxy widget associated with
action |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
This signal is available in PyGTK 2.4 and above.
The "disconnect-proxy" signal is emitted when the widget
specified by proxy
is disconnected from the gtk.Action
specified
by action
.
def callback(actiongroup
, action
, user_param1
, ...
)
| the actiongroup that received the signal |
| the action that is being activated |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
This signal is available in PyGTK 2.4 and above.
The "post-activate" signal is emitted after the gtk.Action
specified
by action
has been activated.
def callback(actiongroup
, action
, user_param1
, ...
)
| the actiongroup that received the signal |
| the action that is being activated |
| the first user parameter (if any) specified
with the connect () |
| additional user parameters (if any) |
This signal is available in PyGTK 2.4 and above.
The "pre-activate" signal is emitted before the gtk.Action
specified
by action
is activated.