new $.oApp()
openHarmony/openHarmony_application.js, line 58
The constructor for the $.oApp class
Members
-
currentStencil$.oStencil
-
The currently selected stencil. Always returns the pencil tool current stencil.
-
currentTool$.oTool
-
The Position of the mouse cursor in the screen coordinates.
-
readonlyflavourstring
-
The software flavour: Premium, Advanced, Essential
-
readonlyglobalMousePosition$.oPoint
-
The Position of the mouse cursor in the screen coordinates.
-
readonlymainWindow
-
The Harmony Main Window.
-
readonlyminorVersionint
-
The Harmony minor Version (ex: 21.1.0 > 1 is the minor version)
-
readonlymousePosition$.oPoint
-
The Position of the mouse cursor in the toonboom window coordinates.
-
readonlypatchint
-
The Harmony patch number (ex: 21.1.0 > 0 is the patch number)
-
preferences
-
Access the Harmony Preferences
Example
// To access the preferences of Harmony, grab the preference object in the $.oApp class: var prefs = $.app.preferences; // It's then possible to access all available preferences of the software: for (var i in prefs){ log (i+" "+prefs[i]); } // accessing the preference value can be done directly by using the dot notation: prefs.USE_OVERLAY_UNDERLAY_ART = true; log (prefs.USE_OVERLAY_UNDERLAY_ART); //the details objects of the preferences object allows access to more information about each preference var details = prefs.details log(details.USE_OVERLAY_UNDERLAY_ART.category+" "+details.USE_OVERLAY_UNDERLAY_ART.id+" "+details.USE_OVERLAY_UNDERLAY_ART.type); for (var i in details){ log(i+" "+JSON.stringify(details[i])) // each object inside detail is a complete oPreference instance } // the preference object also holds a categories array with the list of all categories log (prefs.categories)
-
stencilsArray.<$.oStencil>
-
The list of stencils available in the Harmony UI.
Example
// Access the stencils list through the $.app object. var stencils = $.app.stencils // list all the properties of stencils for (var i in stencils){ log(" ---- "+stencils[i].type+" "+stencils[i].name+" ---- ") for(var j in stencils[i]){ log (j); } }
-
readonlytoolbars
-
The Harmony UI Toolbars.
-
readonlytoolsArray.<$.oTool>
-
Access the tools available in the application
Example
// Access the list of currently existing tools by using the $.app object var tools = $.app.tools; // output the list of tools names and ids for (var i in tools){ log(i+" "+tools[i].name) } // To get a tool by name, use the $.app.getToolByName() function var brushTool = $.app.getToolByName("Brush"); log (brushTool.name+" "+brushTool.id) // Output: Brush 9 // it's also possible to activate a tool in several ways: $.app.currentTool = 9; // using the tool "id" $.app.currentTool = brushTool // by passing a oTool object $.app.currentTool = "Brush" // using the tool name brushTool.activate() // by using the activate function of the oTool class
-
readonlyversionint
-
The Harmony version number
-
readonlyversionStringstring
-
The Harmony full version, including patch
Methods
-
getToolByName(){$.oTool}
openHarmony/openHarmony_application.js, line 441 -
get a tool by its name
Returns:
Type Description $.oTool a oTool object representing the tool, or null if not found. -
getValidStencils(tool){Array.<$.oStencil>}
openHarmony/openHarmony_application.js, line 455 -
returns the list of stencils useable by the specified tool
Name Type Description tool
$.oTool the tool object we want valid stencils for Returns:
Type Description Array.<$.oStencil> the list of stencils compatible with the specified tool -
getWidgetByName(name, parentName){QWidget}
openHarmony/openHarmony_application.js, line 271 -
Gets access to a widget from the Harmony Interface.
Name Type Description name
string The name of the widget to look for. parentName
string optional The name of the parent widget to look into, in case of duplicates. Returns:
Type Description QWidget The widget if found, or null if it doesn't exist. -
runMenuCommand(menuName, menuString)
openHarmony/openHarmony_application.js, line 466 -
Calls a function from one of the menus of Harmony. Doesn't support submenus at the moment. Doesn't work in batch mode.
Name Type Description menuName
string The name of the menu containing the action (must be a top level menu such as File, Edit etc) menuString
string The menu entry to trigger.