OMH::Harmony Class Reference

Detailed Description

The Harmony Application object.

The top level object, representing the currently running instance of Harmony and provides access to the loaded project and its contents.

Public Member Functions

void process_one_event ()
 Processes the next event in the application's event queue. More...
 
void log (const QString &log) const
 Write to the application's Message Log; defaults to a trace_level log. More...
 
void log (const QString &log, const QString &level) const
 Write to the application's Message Log with different levels as an option. More...
 
void trace (const QString &log) const
 Write to the application's Message Log as trace output.
 
void debug (const QString &log) const
 Write to the application's Message Log as debug output.
 
void error (const QString &log) const
 Write to the application's Message Log as error output.
 

Public Attributes

OMH::HarmonyProjectproject
 Get the active project from the instance of Harmony. More...
 
OMC::Aboutabout
 Get the active about details from the instance of Harmony. More...
 
OMC::Preferencespreferences
 Get the active preferences from the instance of Harmony. More...
 
OMC::Actionsactions
 Get the application's action interface. More...
 
OMC::ViewList * views
 Get the application's available views - not yet available. More...
 
OMC::ToolList * tools
 Get the application's available tools - not yet available. More...
 
OMC::InterfaceManager * interfaces
 Get the DOM interface manager - not yet available. More...
 
bool notify_enabled
 Get/set whether application notifications are enabled. More...
 

Member Function Documentation

◆ log() [1/2]

void OMC::Application::log ( const QString &  log) const
inherited

Write to the application's Message Log; defaults to a trace_level log.

from ToonBoom import harmony #Import the Harmony Module
session = harmony.session()
session.log( "Hello World!" ) #Expectation: Hello World appears in the MessageLog's view.

◆ log() [2/2]

void OMC::Application::log ( const QString &  log,
const QString &  level 
) const
inherited

Write to the application's Message Log with different levels as an option.

The Message Log supports three levels of output, which can be specified in this function.

Available log levels include:

  • trace : The standard trace output in the MessageLog view.
  • debug : The debug output in the MessageLog view, only available when the Application's debug mode is enabled.
  • error : The error output in the MessageLog view, as well as a critical error popup window.
from ToonBoom import harmony #Import the Harmony Module
session = harmony.session()
session.log( "Hello Debug World!", "debug" ) #Expectation: Hello World appears in the MessageLog's view.

◆ process_one_event()

void OMC::Application::process_one_event ( )
inherited

Processes the next event in the application's event queue.

In the event that the script requires updates in the GUI, process_one_event() will ublock the application from the current script and run the next event in the application queue.

from ToonBoom import harmony #Import the Harmony Module
session = harmony.session()
actions = session.actions
actions.perform( "actionThatRequiresGUI" )
session.process_one_event()

Member Data Documentation

◆ about

OMH::Harmony::about

Get the active about details from the instance of Harmony.

The About class provides general information about the current Harmony session. This includes environment information, and general application information,

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
about = sess.about #Get about object.
print( about.path_application ) #Expectation: Prints the path to the Harmony application's path.

◆ actions

OMH::Harmony::actions

Get the application's action interface.

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.

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.

◆ interfaces

OMH::Harmony::interfaces

Get the DOM interface manager - not yet available.

Not yet available.

◆ notify_enabled

bool OMH::Harmony::notify_enabled
readwrite

Get/set whether application notifications are enabled.

Most actions in Harmony result in events that update the GUI and refresh the contents in the scene. Setting the notify_enabled to false will prevent these intermediate updates, and will often allow scripts to run faster. Once a script has completed, it is important that this be reenabled in order for the GUI to appropriately update with all expected changes.

import math
from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
sess.notify_enabled = False #Disable application events, so everything happens under-the-hood, quickly.
proj = sess.project
scn = proj.scene
top = scn.top
for n in range( 100 ): #Create 100 pegs -- for fun!
rad = ( n / 100.0 ) * 2.0 * math.pi #Time to be fancy!
dist = 100.0
new_node = top.nodes.create( "PEG", "PEG_%04d"%(n) )
new_node.position.x = math.cos( rad ) * dist
new_node.position.y = math.sin( rad ) * dist
sess.notify_enabled = True #Reenable applicaiton events to see all 100 fancy new pegs (in record time!)

◆ preferences

OMH::Harmony::preferences

Get the active preferences from the instance of Harmony.

The preference handler for the application provides read and write access to the current application preferences. This is useful for storing and modifying tool preferences.

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
prefs = sess.preferences #Get preferences handler.
prefs["PEG_DEFAULT_SEPARATE_POSITION"] = True #Expectation: The Peg default separate position preference will now be set to true.

◆ project

OMH::Harmony::project

Get the active project from the instance of Harmony.

The project provides access to properties of the project, and objects contained within the project (such as scenes, palettes, nodes, ect).

from ToonBoom import harmony #Import the Harmony Module
sess = harmony.session() #Get access to the Harmony session, this class.
project = sess.project #Get the currently loaded project.

◆ tools

OMH::Harmony::tools

Get the application's available tools - not yet available.

Not yet available.

◆ views

OMH::Harmony::views

Get the application's available views - not yet available.

Not yet available.

Inheritance diagram for OMH::Harmony:
Collaboration diagram for OMH::Harmony: