Actions¶
Base Classes¶
Represents a single “action” in a shortcut.
UUID string identifying the
resultvariable produced by the action.Used to link result variables to their origin.
Used to deserialize
actionobjects from JSON.
The action’s category (e.g. SCRIPTING or MATH). Always in ALL CAPS.
May be excluded for control-flow blocks, such as the If block’s End If.
List of CSS classes (str) to apply to special actions (e.g. Comment action)
Return a particular element in
lines, as identified by itskey. Usually used inmodifyto pick a line out for modification.Raises ValueError if the key does not a match a line.
Return a particular element in
title, as identified by itskey. Usually used inmodifyto pick an element out for modification.Raises ValueError if the key does not a match an element.
The action’s glyph, usually matching the category. If there is no category, there is also no glyph, and vice versa.
Actions donated from an app have the app icon as their glyph
Add the “hidden” CSS class to particular element in
line, as identified by itskey.Raises ValueError if the label does not a match a line.
Add the “hidden” CSS class to text element in
title, as identified by itsvalue.Raises ValueError if the value does not a match any text.
Add the “hidden” CSS class to particular element in
title, as identified by itskey.Raises ValueError if the label does not a match an element.
Visual indentation level for actions inside control flow blocks.
Control flow blocks may be nested indefinitely, but stop visually indenting after 8 levels.
Determines whether subsequent actions are (un)-indented. Permitted values: -1, 0, +1.
Todo: Check whether indentation delta is either -1, 0, or +1.
Copies (inherited) class variables to instance.
Allows us to make defining actions with similar
category,glyph, andresultDRYer.Creates instance specific title, lines, and elem so that their values may be individually set.
List of keys and values particular to the Dictionary action.
List of additional options customizing an action’s behaviour.
Populated with
line_${elem}objects.
Called after
to_htmlhas been invoked ontitle,lines, andelem.Houses special logic for each action. Usually, this means hiding element X if element Y has value Z.
Meant to be overriden.
The action’s name when searched in Shortcuts.
Every action may (or may not) produce one result, which may (or may not) be given a custom name.
This field define’s the action’s default result name (if any).
Nonemeans the action does not produce a result.
List of element objects composing the title (large head text).
Populated with
textobjects, and children ofbase_magic.
Invokes
to_htmlmethod of every object intitle,lines, andelem, transforming these into lists ofdictfor the Django template engine.Invokes action’s
modifymethod last.
Represents a control flow action such as If, Repeat, or Choose from Menu.
Looks up the action’s WFControlFlowMode.
Adjusts action based on it’s
flow_modevalue0: Head block
- Has a category & glyph
- Accepts parameters
- Indents inner actions by +1
1: Body block
- No category or glyph
- Does not accept parameters
- Unindented 1 level from inner blocks (same indentation as Head)
- Does not change indentation of subsequent blocks
2: Foot block
- No category or glyph
- Does not accept parameters
- Unindented 1 level from inner blocks (same indentation as Head)
- Unindents subsequent blocks -1.