Parses the data into a list of ActionInfo and SeparatorInfo objects.
The data is parsed based on the simple DSL documented below.
:Parameters:
data
The data to be parsed into `ActionInfo` and `SeparatorInfo` objects.
event_handler
The event handler that implements the actions. See `finding handlers`_
for more information.
container
the wxPython element containing the UI components associated with
the `ActionInfo`.
DSL syntax
----------
::
[menu]
name | documentation | shortcut | icon
Fields
------
menu
The name of the menu under which the entries below it are inserted.
name
The name of the menu entry to be added. If name is ``---``, a
`SeparatorInfo` object is created instead of an `ActionInfo` object.
If name is post fixed with shortcuts between parenthesis and separated
with ' or ', these shortcuts are parsed to machine local presentation
and shown after the name. This can be used instead of shotrcut-element
if you want to add shortcuts that you want to bind yourself and/or add
several shortcuts.
documentation
Documentation for the action.
shortcut
Keyboard shortcut to invoke the action.
icon
Icon for the toolbar button.
position
Value for menu item ordering.
See the `ActionInfo` attributes with same/similar names for more
information about the fields and their possible values. Three
last fields are optional.
Finding handlers
----------------
The given ``event_handler`` must have handler methods that map to the
specified action names. The mapping is done by prefixing the name with
``On``, removing spaces, and capitalizing all words. For example ``Save``
and ``My Action`` must have handler methods ``OnSave`` and ``OnMyAction``,
respectively. If name has content between parenthesis at the end, this
content is ignored when creating handler mapping.
Specifying container
--------------------
By default the given ``container`` is passed to the `ActionInfo.__init__`
method directly. This can be altered by prefixing the ``name`` with an
exclamation mark (e.g. ``!Save`` or ``!My Action``) to make that action
global. With these actions the container given to the `ActionInfo.__init__`
is always ``None``.
Example
-------
::
[File]
!&Open | Open file containing tests | Ctrl-O | ART_FILE_OPEN
!Open &Resource | Open a resource file | Ctrl-R
---
&Save | Save selected datafile | Ctrl-S | ART_FILE_SAVE
[Tools]
!Manage Plugins | | | | POSITION-80
[Content]
Content Assist (Ctrl-Space or Ctrl-Alt-Space) | Has two shortcuts.
Definition at line 106 of file actioninfo.py.