6. ui

class mocha.ui.ActionTriggerHandler(action)

Bases: PySide.QtCore.QObject

Wraps a handler of given action with custom one. Set handler attribute to functional object which accepts only one argument. This argument is a callable object which calls the original action handler.

Example:

action_handler = ui.ActionTriggerHandler(mocha_action)
def my_handler(f):
    # Custom code before
    f()  # calls the original action handler
    # Custom code after
action_handler.handler = my_handler
mocha.ui.down_cast_qobject(tp, obj)
Parameters:
  • tp (type) – Target type
  • obj (QObject) – Pristine object

Down cast the given QObject instance. Note that the function returns a new wrapper instance instead of object type changing (Python denies this).

mocha.ui.find_widget(name, convert_to_type=None)
Parameters:
  • name (str) – Name of an existing widget
  • convert_to_type (type) – Optional target type to convert found widget instance.

Find a widget by name and convert to a specific type (optional).

mocha.ui.get_current_frame()
Return type:int

Return the current frame index on canvas.

mocha.ui.get_displayed_clip()
Return type:mocha.project.Clip

Return the current displayed clip on canvas.

mocha.ui.get_displayed_view()
Return type:mocha.project.View

Return the current displayed view on canvas.

mocha.ui.get_menus()

Return all mocha menu items as a list of QMenu instances

mocha.ui.get_widgets()

Return all underlying mocha widgets

mocha.ui.gui_api()
Return type:PySide.QtCore.QObject

Returns mocha GUI API entry point as a mediator object.

mocha.ui.set_current_frame(frame)
Parameters:frame (int) – New current frame index

Set the current frame index on canvas.

mocha.ui.set_displayed_clip(clip)
Parameters:clip (mocha.project.Clip) – New displayed clip.

Set current displayed clip on canvas.

mocha.ui.set_displayed_view(view)
Parameters:view (mocha.project.View) – New displayed view.

Set current displayed view on canvas.

mocha.ui.swap_action_proxy(action, new_proxy)

Swap QAction proxy object with custom one.

Note: use ActionTriggerHandler instead