gtk.ActionGroup — a group of actions (new in PyGTK 2.4)
class gtk.ActionGroup(gobject.GObject): |
|
gobject.GObject Signal Prototypes
"connect-proxy" | def callback(actiongroup, action, proxy, user_param1, ...) |
"disconnect-proxy" | def callback(actiongroup, action, proxy, user_param1, ...) |
"post-activate" | def callback(actiongroup, action, user_param1, ...) |
"pre-activate" | def callback(actiongroup, action, user_param1, ...) |
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
action : | the action to add |
accelerator : | 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.
|
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.
|
entries : | a list or tuple of action descriptions |
user_data : | 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:
The "activate" signals of the actions are connected to the callbacks and their accel paths are set to <Actions>/group-name/action-name.
|
entries : | a list or tuple of toggle action entry tuples |
user_data : | 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 six items with the following information:
The "activate" signals of the actions are connected to the callbacks and their accel paths are set to <Actions>/group-name/action-name.
|
entries : | a list or tuple of radio action entry tuples |
value : | the value of the radio action to set active |
on_change : | a callback to connect to the "changed" signal of the first radio action |
user_data : | 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:
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.
|
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.
|
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.
|
actiongroup : | the actiongroup that received the signal |
action : | the action that is associated with proxy |
proxy : | the proxy widget associated with action |
user_param1 : | the first user parameter (if any) specified with the connect() method |
... : | 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.
|
actiongroup : | the actiongroup that received the signal |
action : | the action that is associated with proxy |
proxy : | the proxy widget associated with action |
user_param1 : | the first user parameter (if any) specified with the connect() method |
... : | 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.
|
actiongroup : | the actiongroup that received the signal |
action : | the action that is being activated |
user_param1 : | the first user parameter (if any) specified with the connect() method |
... : | 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.
|
actiongroup : | the actiongroup that received the signal |
action : | the action that is being activated |
user_param1 : | the first user parameter (if any) specified with the connect() method |
... : | 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.