OMC::Actions Class Reference

Detailed Description

The Action global object.

Provided from the Application (OMH::Harmony::actions)

The application's action interface is used to perform underlying actions within the GUI in the application. Generally, actions are only available internally within the GUI. This interface can also be used to list available actions that can be performed.
In the event that a scripted solution is not available through the DOM, an action may be available. It is worth noting that actions can require user input and subsequent application event callbacks, some of which are not supported in a scripted environment.


Print Available Actions

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
actions = sess.actions #Get actions handler.
for responder in actions.responders:
print( responder )
action_list = actions.actions(responder)
for action in action_list:
print( " %s"%(action) ) #Expectation - All responders will be listed with their available actions.


Run an Action from a Responder

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
actions = sess.actions #Get actions handler.
result = actions.perform( "onActionCreatePeg()", "Node View" )
if result == "ACTION_NOTHING_TO_DO":
print( "Run ActionCreatePeg from Node View responder." )

Public Member Functions

QString & perform (const QString &slot)
 Perform the requested action (slot - menu item, toolbar item,...) More...
 
QString & perform (const QString &slot, const QString &responder)
 Perform the requested action (slot - menu item, toolbar item,...) More...
 
QString & perform (const QString &slot, const QString &responder, QVariant parameters)
 Execute an action using the action manager on the given responder with parameters. More...
 
QString & performForEach (const QString &slot, const QString &responder)
 Execute an action using the action manager on all responder instances. More...
 
QVariant validate (const QString &slot)
 Validate the requested action (slot - menu item, toolbar item,...) More...
 
QVariant validate (const QString &slot, const QString &responder)
 Validate the requested action (slot - menu item, toolbar item,...) More...
 
QStringList actions (const QString &responder)
 Retrieve the list of actions for a given responder. More...
 

Public Attributes

QStringList responders
 Retrieve the list of responder names. More...
 

Member Function Documentation

◆ actions()

QStringList OMC::Actions::actions ( const QString &  responder)

Retrieve the list of actions for a given responder.

Parameters
responderresponder identity to investigate.

◆ perform() [1/3]

QString& OMC::Actions::perform ( const QString &  slot)

Perform the requested action (slot - menu item, toolbar item,...)

Perform the requested action for the main application responder. If the main responder doesn't own the requested action, try to use the current view with focus as the responder.

◆ perform() [2/3]

QString& OMC::Actions::perform ( const QString &  slot,
const QString &  responder 
)

Perform the requested action (slot - menu item, toolbar item,...)

Perform the requested action for a specific responder.

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
actions = sess.actions #Get actions handler.
actions.perform("onActionToggleApplyToolToAllLayers()", "drawingView");
Parameters
slotThe action function name (ex: onMyAction()).
responderThe responder to the function name (ex: drawingView).

◆ perform() [3/3]

QString& OMC::Actions::perform ( const QString &  slot,
const QString &  responder,
QVariant  parameters 
)

Execute an action using the action manager on the given responder with parameters.

Parameters
slotaction to execute. See Actions.getActionList() for action list.
respondercommand target. See ActionsgetResponderList() for responder list.
parametersaction parameter(s). Use an array [] to provide multiple action parameters.

Example usage:

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
actions = sess.actions #Get actions handler.
actions.perform( "onActionShowDeformer(QString)","miniPegModuleResponder", "Top/Deformation-Drawing" );

◆ performForEach()

QString& OMC::Actions::performForEach ( const QString &  slot,
const QString &  responder 
)

Execute an action using the action manager on all responder instances.

Parameters
slotaction to execute. See Actions.getActionList() for action list.
respondercommand target. See Actions.getResponderList() for responder list.

◆ validate() [1/2]

QVariant OMC::Actions::validate ( const QString &  slot)

Validate the requested action (slot - menu item, toolbar item,...)

Validate the requested action for the main application responder. If the main responder doesn't own the requested action, try to use the current view with focus as the responder.

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
actions = sess.actions #Get actions handler.
validate_data = actions.validate( "onActionAbout()" );
Parameters
slotThe action function name(ex : onMyAction()).
Returns
A script object that has the valid_responder, valid_slot, enabled and checked boolean properties.

◆ validate() [2/2]

QVariant OMC::Actions::validate ( const QString &  slot,
const QString &  responder 
)

Validate the requested action (slot - menu item, toolbar item,...)

Validate the requested action for a specific responder.

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
actions = sess.actions #Get actions handler.
# Toggle on the Apply Tool to Line and Colour Art option only if it's off.
validateData = actions.validate("onActionToggleApplyToolToAllLayers()", "drawingView");
if( not validateData.checked )
actions.perform("onActionToggleApplyToolToAllLayers()", "drawingView");


from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
actions = sess.actions #Get actions handler.
# Toggle on the Apply Tool to Line and Colour Art option only if it's off.
validateData = actions.validate("onActionCreateNewDeformationChain()", "miniPegModuleResponder");
if( not (validateData.isValid and validateData.enabled) )
print("The desired action is unavailable, please select an element node");
Parameters
slotThe action function name (ex: onMyAction()).
responderThe responder to the function name (ex: drawingView).
Returns
A script object that has the isValid, enabled and checked boolean properties.

Member Data Documentation

◆ responders

QStringList OMC::Actions::responders
read

Retrieve the list of responder names.

Retrieve the list of responder names.

Inheritance diagram for OMC::Actions:
Collaboration diagram for OMC::Actions: