Skip to content

Latest commit

 

History

History
233 lines (130 loc) · 7.34 KB

File metadata and controls

233 lines (130 loc) · 7.34 KB

NatronGui

PyTabWidget

Synopsis

A PyTabWidget is one of the GUI pane onto which the user can dock tabs such as the NodeGraph, CurveEditor... See detailed<pyTabWidget.details> description...

Functions

  • def appendTab<NatronGui.PyTabWidget.appendTab> (tab)
  • def closeCurrentTab<NatronGui.PyTabWidget.closeCurrentTab> ()
  • def closeTab<NatronGui.PyTabWidget.closeTab> (index)
  • def closePane<NatronGui.PyTabWidget.closePane> ()
  • def count<NatronGui.PyTabWidget.count> ()
  • def currentWidget<NatronGui.PyTabWidget.currentWidget> ()
  • def floatCurrentTab<NatronGui.PyTabWidget.floatCurrentTab> ()
  • def floatPane<NatronGui.PyTabWidget.floatPane> ()
  • def getCurrentIndex<NatronGui.PyTabWidget.getCurrentIndex> ()
  • def getScriptName<NatronGui.PyTabWidget.getScriptName> ()
  • def getTabLabel<NatronGui.PyTabWidget.getTabLabel> (index)
  • def insertTab<NatronGui.PyTabWidget.insertTab> (index,tab)
  • def removeTab<NatronGui.PyTabWidget.removeTab> (tab)
  • def removeTab<NatronGui.PyTabWidget.removeTab> (index)
  • def setCurrentIndex<NatronGui.PyTabWidget.setCurrentIndex> (index)
  • def setNextTabCurrent<NatronGui.PyTabWidget.setNextTabCurrent> ()
  • def splitHorizontally<NatronGui.PyTabWidget.splitHorizontally> ()
  • def splitVertically<NatronGui.PyTabWidget.splitVertically> ()

Detailed Description

The PyTabWidget class is used to represent panes visible in the user interface:

On the screenshot above, each PyTabWidget is surrounded by a red box.

You cannot construct tab widgets on your own, you must call one of the splitVertically()<NatronGui.PyTabWidget.splitVertically> or splitHorizontally()<NatronGui.PyTabWidget.splitHorizontally> functions to make a new one based on another existing ones.

By default the GUI of Natron cannot have less than 1 tab widget active, hence you can always split it to make new panes.

To retrieve an existing PyTabWidget you can call the getTabWidget(scriptName)<NatronGui.GuiApp.getTabWidget> function of GuiApp.

pane1 = app.getTabWidget("Pane1")

Note that the script-name of a pane can be seen on the graphical user interface by hovering the mouse over the "Manage layout" button (in the top left hand corner of a pane).

Managing tabs

To insert tabs in the TabWidget you can call either appendTab(tab)<NatronGui.PyTabWidget.appendTab> or insertTab(index,tab)<NatronGui.PyTabWidget.insertTab>.

Warning

Note that to insert a tab, it must be first removed from the tab into which it was.

To remove a tab, use the function removeTab(tab)<NatronGui.PyTabWidget.removeTab> on the parent PyTabWidget

For convenience to move tabs around, there is a moveTab(tab,pane)<NatronGui.GuiApp.moveTab> function in GuiApp.

The function closeTab(index)<NatronGui.PyTabWidget.closeTab> can be used to close permanently a tab, effectively destroying it.

To change the current tab, you can use one of the following functions:

  • setCurrentIndex(index)<NatronGui.PyTabWidget.setCurrentIndex>
  • setNextTabCurrent()<NatronGui.PyTabWidget.setNextTabCurrent>

To float the current tab into a new floating window, use the floatCurrentTab()<NatronGui.PyTabWidget.floatCurrentTab> function.

Managing the pane

To close the pane permanently, use the closePane()<NatronGui.PyTabWidget.closePane> function. To float the pane into a new floating window with all its tabs, use the floatPane()<NatronGui.PyTabWidget.floatPane> function.

Member functions description

NatronGui.PyTabWidget.appendTab(tab)

param tab

QWidget <https://pyside.github.io/docs/pyside/PySide/QtGui/QWidget.html>

Appends a new tab to the tab widget and makes it current.

NatronGui.PyTabWidget.closeCurrentTab()

Closes the current tab, effectively destroying it.

NatronGui.PyTabWidget.closeTab(index)

Closes the tab at the given index, effectively destroying it.

NatronGui.PyTabWidget.closePane()

Closes this pane, effectively destroying it. Note that all tabs will not be destroyed but instead moved to another existing pane.

Warning

If this pane is the last one on the GUI, this function does nothing.

NatronGui.PyTabWidget.count()

rtype

int

Returns the number of tabs in this pane.

NatronGui.PyTabWidget.currentWidget()

rtype

QWidget <https://pyside.github.io/docs/pyside/PySide/QtGui/QWidget.html>

Returns the current active tab.

NatronGui.PyTabWidget.floatCurrentTab()

Make a new floating window with a single pane and moves the current tab of this pane to the new pane of the floating window.

NatronGui.PyTabWidget.floatPane()

Make a new floating window and moves this pane to the new window (including all tabs).

NatronGui.PyTabWidget.getCurrentIndex()

rtype

int

Returns the index of the current tab. This is 0-based (starting from the left).

NatronGui.PyTabWidget.getScriptName()

rtype

str

Returns the script-name of the pane, as used by the getTabWidget(scriptName)<NatronGui.GuiApp.getTabWidget> function.

NatronGui.PyTabWidget.getTabLabel(index)

param index

int

rtype

str

Returns the name of the tab at the given index if it exists or an empty string otherwise.

NatronGui.PyTabWidget.insertTab(index,tab)

param tab

QWidget <https://pyside.github.io/docs/pyside/PySide/QtGui/QWidget.html>

param index

int

Inserts the given tab at the given index in this tab-widget.

NatronGui.PyTabWidget.removeTab(tab)

param tab

QWidget <https://pyside.github.io/docs/pyside/PySide/QtGui/QWidget.html>

Removes the given tab from this pane if it is found. Note that this function does not destroy the tab, unlike closeTab(index)<NatronGui.PyTabWidget.closeTab>.

This is used internally by moveTab(tab,pane)<NatronGui.GuiApp.moveTab>.

NatronGui.PyTabWidget.removeTab(index)

param index

int

Same as removeTab(tab)<NatronGui.PyTabWidget.removeTab> but the index of a tab is given instead.

NatronGui.PyTabWidget.setCurrentIndex(index)

param index

int

Makes the tab at the given index (0-based) the current one (if the index is valid).

NatronGui.PyTabWidget.setNextTabCurrent()

Set the tab at getCurrentIndex()<NatronGui.PyTabWidget.getCurrentIndex> + 1 the current one. This functions cycles back to the first tab once the last tab is reached.

NatronGui.PyTabWidget.splitHorizontally()

rtype

PyTabWidget<NatronGui.PyTabWidget>

Splits this pane into 2 horizontally-separated panes. The new pane will be returned.

NatronGui.PyTabWidget.splitVertically()

rtype

PyTabWidget<NatronGui.PyTabWidget>

Splits this pane into 2 vertically-separated panes. The new pane will be returned.