Zoo tools Host Engine

class HostApplication(name, version, versionYear)

Bases: object

Simple class for containing the current Host application information. Meant to be derived for the Host specifically.

Parameters:
  • name (str) – The name of the host application.

  • version (str) – The version of the host application.

  • versionYear (int) – The version year of the host application.

property executable

The executable path of the host application.

Returns:

The executable path.

Return type:

str

property installLocation

The installation location of the host application.

Returns:

The installation location.

Return type:

str

property isHeadless

Checks if the host application is running in headless mode.

Returns:

True if headless, False otherwise.

Return type:

bool

property qtMainWindow

Returns the main window of the host application.

Returns:

The main window.

Return type:

QMainWindow

property pythonExecutable

The path of the Python executable used by the host application.

Returns:

The Python executable path.

Return type:

str

class Engine(configuration, engineName)

Bases: object

Base class for a host engine.

When a DCC integration is created it should derive from this base class and reimplement the required methods. It’s designed to load zootools in a DCC specific way, loading menus, shelf, callback management, launching dialogs (docking, etc.), retrieve host information (version). The usersetup.py (maya, houdini), blender addon, maya plugin would create the specific engine by name.

Parameters:
  • configuration (Configuration) – The configuration object.

  • engineName (str) – The name of the engine.

init()

Initializes the engine. Called immediately after the engine is created.

property initialized

Checks if the engine has been initialized.

Returns:

True if initialized, False otherwise.

Return type:

bool

property host

Returns the current host application information.

Returns:

The host application information.

Return type:

HostApplication

postInit()

Post-initialization method. called after the engine has been created but before any packages have been setup.

preEnvInit()

Before any packages have been set up but after postInit.

Implemented by derived class

postEnvInit()

After all packages and package command scripts have been initialized.

Implemented by derived class

shutdownEngine()

Shuts down the engine.

Implemented by derived class

showDialog(windowCls, name='', show=True, allowsMultiple=False, *clsArgs, **clsKwargs)

Shows a dialog window.

Parameters:
  • windowCls (type) – The class of the dialog window.

  • name (str) – The name of the dialog.

  • show (bool) – Flag indicating whether to show the dialog.

  • allowsMultiple (bool) – Flag indicating whether multiple instances of the dialog are allowed.

  • clsArgs (tuple) – Additional arguments to pass to the dialog class constructor.

  • clsKwargs (dict) – Additional keyword arguments to pass to the dialog class constructor.

closeDialog(name, widget)

Closes a dialog window.

Parameters:
  • name (str) – The name of the dialog.

  • widget (QWidget) – The widget of the dialog to close.

closeAllDialogs()

Closes all registered dialog windows.

registerDialog(name, dialog)

Registers a dialog window.

Parameters:
  • name (str) – The name of the dialog.

  • dialog (QWidget) – The dialog window to register.

unregisterDialog(name, dialog)

Unregisters a dialog window.

Parameters:
  • name (str) – The name of the dialog.

  • dialog (QWidget) – The dialog window to unregister.

dialogsByName(name)

Returns all dialogs which have been registered with the given name.

Parameters:

name (str) – The name of the registered dialog

Returns:

A list of Dialogs, windows, zoo windows which match the registered name

Return type:

list[QtWidgets.QMainWindow]

setStyleSheet(style)

Sets the style sheet for all registered dialogs.

Parameters:

style (str) – The style sheet to apply.

currentEngine()

Retrieves the current engine.

Returns:

The current engine.

Return type:

Engine

setCurrentEngine(engine)

Sets the current engine.

Parameters:

engine (Engine) – The engine to set as current.

startEngine(config, engineCls, engineName)

Starts the engine.

Parameters:
  • config (Configuration) – The configuration object.

  • engineCls (type) – The engine class.

  • engineName (str) – The name of the engine.

Returns:

The initialized engine.

Return type:

Engine

shutdownEngine()

Shuts down the current engine.