PyGuiApplication

Inherits PyCoreApplication

Synopsis

See PyCoreApplication for a detailed explanation of the purpose of this object. This class is only used when Natron is run in GUI mode (with user interface). It gives you access to more GUI functionalities via the GuiApp class.

Functions

Member functions description

class NatronGui.PyGuiApplication

See PyCoreApplication()

NatronGui.PyGuiApplication.addMenuCommand(grouping, function)
Parameters
  • groupingstr

  • functionstr

Adds a new menu entry in the menubar of Natron. This should be used exclusively in the initGui.py initialisation script.

The grouping is a string indicating a specific menu entry where each submenu is separated from its parent menu with a /:

File/Do something special

MyStudio/Scripts/Our special trick

The function is the name of a python defined function.

Warning

If called anywhere but from the initGui.py script, this function will fail to dynamically add a new menu entry.

Example:

def printLala():
    print("Lala")

natron.addMenuCommand("Inria/Scripts/Print lala script","printLala")

This registers in the menu Inria–>Scripts an entry named Print lala script which will print Lala to the Script Editor when triggered.

NatronGui.PyGuiApplication.addMenuCommand(grouping, function, key, modifiers)
Parameters
  • groupingstr

  • functionstr

  • keyPySide.QtCore.Qt.Key

  • modifiersPySide.QtCore.Qt.KeyboardModifiers

Same as addMenuCommand(grouping,function) excepts that it accepts a default shortcut for the action. See PySide documentation for possible keys and modifiers.

The user will always be able to modify the shortcut from the built-in shortcut editor of Natron anyway.

NatronGui.PyGuiApplication.getGuiInstance(idx)
Parameters

idxint

Return type

GuiApp

Same as getInstance(idx) but returns instead an instance of a GUI project.

Basically you should never call this function as Natron pre-declares all opened projects with the following variables: app1 for the first opened project, app2 for the second, and so on…

NatronGui.PyGuiApplication.informationDialog(title, message)
Parameters
  • titlestr

  • messagestr

Shows a modal information dialog to the user with the given window title and containing the given message.

NatronGui.PyGuiApplication.warningDialog(title, message)
Parameters
  • titlestr

  • messagestr

Shows a modal warning dialog to the user with the given window title and containing the given message.

NatronGui.PyGuiApplication.errorDialog(title, message)
Parameters
  • titlestr

  • messagestr

Shows a modal error dialog to the user with the given window title and containing the given message.

NatronGui.PyGuiApplication.questionDialog(title, message)
Parameters
  • titlestr

  • messagestr

Return type

NatronEngine.StandardButtonEnum

Shows a modal question dialog to the user with the given window title and containing the given message. The dialog will be a “Yes” “No” dialog, and you can compare the result to the NatronEngine.StandardButtonEnum members.