GuiApp

Inherits App

Synopsis

This class is used for GUI application instances. See detailed description…

Functions

Detailed Description

See App for the documentation of base functionalities of this class.

To create a new modal dialog , use the createModalDialog() function.

Several functions are made available to pop dialogs to ask the user for filename(s) or colors. See getFilenameDialog(filters,location) and getRGBColorDialog().

To create a new custom python panel, there are several ways to do it:

  • Sub-class the PyPanel class and make your own PySide widget

  • Create a PyPanel object and add controls using user parameters (as done for modal dialogs)

Once created, you can register the panel in the project so that it gets saved into the layout by calling registerPythonPanel(panel,pythonFunction)

Member functions description

NatronGui.GuiApp.createModalDialog()
Return type:

PyModalDialog

Creates a modal dialog : the control will not be returned to the user until the dialog is not closed. Once the dialog is created, you can enrich it with parameters or even raw PySide Qt widgets. To show the dialog call the function exec() on the dialog.

NatronGui.GuiApp.getFilenameDialog(filters[, location=None])
Parameters:
  • filters – sequence

  • location – str

Return type:

str

Opens-up a file dialog to ask the user for a single filename which already exists.

filters is a list of file extensions that should be displayed in the file dialog.

location is the initial location the dialog should display, unless it is empty in which case the dialog will display the last location that was opened previously by a dialog.

NatronGui.GuiApp.getSequenceDialog(filters[, location=None])
Parameters:
  • filters – sequence

  • location – str

Return type:

str

Same as getFilenameDialog(filters,location) but the dialog will accept sequence of files.

NatronGui.GuiApp.getDirectoryDialog([location=None])
Parameters:

location – str

Return type:

str

Same as getFilenameDialog(filters,location) but the dialog will only accept directories as a result.

NatronGui.GuiApp.saveFilenameDialog(filters[, location=None])
Parameters:
  • filters – sequence

  • location – str

Return type:

str

Opens-up a file dialog to ask the user for a single filename. If the file already exists, the user will be warned about potential overriding of the file.

filters is a list of file extensions that should be displayed in the file dialog.

location is the initial location the dialog should display, unless it is empty in which case the dialog will display the last location that was opened previously by a dialog.

NatronGui.GuiApp.saveSequenceDialog(filters[, location=None])
Parameters:
  • filters – sequence

  • location – str

Return type:

str

Same as saveFilenameDialog(filters,location) but the dialog will accept sequence of files.

NatronGui.GuiApp.getRGBColorDialog()
Return type:

ColorTuple

Opens-up a color dialog to ask the user for an RGB color.

NatronGui.GuiApp.getTabWidget(scriptName)
Parameters:

scriptName – str

Return type:

PyTabWidget

Returns the tab-widget with the given scriptName. The scriptName of a tab-widget can be found in the user interface when hovering with the mouse the “Manage layout” button (in the top left-hand corner of the pane)

../../../_images/paneScriptName.png
NatronGui.GuiApp.moveTab(tabScriptName, pane)
Parameters:
  • tabScriptName – str

  • pane – PyTabWidget

Return type:

bool

Attempts to move the tab with the given tabScriptName into the given pane and make it current in the pane. This function returns True upon success or False otherwise.

Warning

Moving tabs that are not registered to the application via registerPythonPanel(panel,pythonFunction) will not work.

NatronGui.GuiApp.registerPythonPanel(panel, pythonFunction)
Parameters:
  • panel – PyPanel

  • scriptName – str

Registers the given panel into the project. When registered, the panel will be saved into the layout for the current project and a new entry in the “Panes” sub-menu of the “Manage layouts” button (in the top left-hand corner of each tab widget) will appear for this panel. pythonFunction is the name of a python-defined function that takes no argument that should be used to re-create the panel.

NatronGui.GuiApp.unregisterPythonPanel(panel)
Parameters:

panel – PyPanel

Unregisters a previously registered panel.

NatronGui.GuiApp.getSelectedNodes([group = None])
Return type:

sequence

Returns a sequence of nodes currently selected in the given group. You can pass the app object to get the top-level NodeGraph. If passing None, the last user-selected NodeGraph will be used:

topLevelSelection = app.getSelectedNodes()

group = app.createNode("fr.inria.built-in.Group")

groupSelection = app.getSelectedNodes(group)
NatronGui.GuiApp.getViewer(scriptName)
Parameters:

scriptName – str

Returns the viewer with the given scriptName if one can be found.

NatronGui.GuiApp.getUserPanel(scriptName)
Parameters:

scriptName – str

Returns a user panel matching the given scriptName if there is any.

NatronGui.GuiApp.selectNode(node, clearPreviousSelection)
Parameters:
  • node – Effect

  • clearPreviousSelection – bool

Select the given node in its containing nodegraph. If clearPreviousSelection is set to True, all the current selection will be wiped prior to selecting the node; otherwise the node will just be added to the selection.

NatronGui.GuiApp.deselectNode(node)
Parameters:

node – Effect

Deselect the given node in its containing nodegraph. If the node is not selected, this function does nothing.

NatronGui.GuiApp.setSelection(nodes)
Parameters:

nodes – sequence

Set all the given nodes selected in the nodegraph containing them and wipe any current selection.

Note

All nodes must be part of the same nodegraph (group), otherwise this function will fail.

NatronGui.GuiApp.selectAllNodes([group=None])
Parameters:

group – Group

Select all nodes in the given group. You can pass the app object to get the top-level NodeGraph. If passing None, the last user-selected NodeGraph will be used.

NatronGui.GuiApp.copySelectedNodes([group=None])
Parameters:

group – Group

Copy all nodes in the given group. You can pass the app object to get the top-level NodeGraph. If passing None, the last user-selected NodeGraph will be used.

NatronGui.GuiApp.pasteNodes([group=None])
Parameters:

group – Group

Paste copied nodes in the given group. You can pass the app object to get the top-level NodeGraph. If passing None, the last user-selected NodeGraph will be used.

NatronGui.GuiApp.clearSelection([group=None])

Wipe any current selection in the given group. You can pass the app object to get the top-level NodeGraph. If passing None, the last user-selected NodeGraph will be used.

NatronGui.GuiApp.renderBlocking(effect, firstFrame, lastFrame, frameStep)
Parameters:
  • effect – Effect

  • firstFrame – int

  • lastFrame – int

  • frameStep – int

Starts rendering the given effect on the frame-range defined by [firstFrame,*lastFrame*]. The frameStep parameter indicates how many frames the timeline should step after rendering each frame. The value must be greater or equal to 1. The frameStep parameter is optional and if not given will default to the value of the Frame Increment parameter in the Write node.

For instance:

render(effect,1,10,2)

Would render the frames 1,3,5,7,9

This is a blocking function. A blocking render means that this function returns only when the render finishes (from failure or success).

This function should only be used to render with a Write node or DiskCache node.

NatronGui.GuiApp.renderBlocking(tasks)
Parameters:

tasks – sequence

This function takes a sequence of tuples of the form (effect,firstFrame,lastFrame[,frameStep]) The frameStep is optional in the tuple and if not set will default to the value of the Frame Increment parameter in the Write node.

This is an overloaded function. Same as render(effect,firstFrame,lastFrame,frameStep) but all tasks will be rendered concurrently.

This function is called when rendering a script in background mode with multiple writers.

This is a blocking call.