Custom Tabs

class UI4.Tabs.BaseTab(*args, **kwargs)

Bases: BaseFrame

Base class for all UI tabs.

Inherits from BaseFrame to provide handling of custom callbacks for actions and key events that are associated with user-defined keyboard shortcuts, and provides functions for storing and restoring settings per tab when loading and saving tab layouts.

Variables:
  • Icon – E{|}sparklesE{|} B{New in Katana 4.5}: An icon to use next to the title of a tab in the tab bar of a pane, and for menu items that represent the tab type in the B{Tabs} main menu and the B{Add Tab} pane menu, unless MenuItemIcon is defined. The icon for a tab type of a given name can be retrieved by calling UI4.App.Tabs.GetTabIcon().

  • MenuItemIcon – E{|}sparklesE{|} B{New in Katana 4.5}: An icon to use for menu items that represent the tab type in the B{Tabs} main menu and the B{Add Tab} pane menu. If MenuItemIcon is not defined, but Icon is defined, then Icon will be used for menu items that represent the tab type. The menu item icon for a tab type of a given name can be retrieved by calling UI4.App.Tabs.GetTabMenuItemIcon().

  • tabClosed – Signal that is emitted when a tab is being closed. Can be used to deregister event handlers or free up allocated resources.

__init__(parent, flags=0, deprecatedBy=None)

Initializes an instance of the class.

Parameters:
  • parent (QtWidgets.QWidget or None) – The parent widget to own the new instance. Passed verbatim to the base class initializer.

  • flags (QtCore.Qt.WindowFlags) – The window flags to use in case no parent is given. Passed wrapped in QtCore.Qt.WindowFlags() to the BaseFrame base class initializer.

  • deprecatedBy (str or None) – The name of a type of tab that is to be used instead of an instance of a specific class that is derived from the BaseTab class.

applySettings(settings)

Applies the given settings to the tab.

Is called when creating a tab of the type represented by a class derived from BaseTab.

Parameters:

settings (dict) – A dictionary of settings to apply to this tab.

Note:

The default implementation does nothing.

closeEvent(event)

This event handler is called with the given event when the tab receives a window close request. A signal is emitted when the tab gets closed which would then a child widget could pick up to unregister any of its registered event handlers.

Parameters:

event (QtGui.QCloseEvent) – Event sent to widgets that the user wants to close.

getMenuBar()
Return type:

QtWidgets.QMenuBar or None

Returns:

The tab’s menu bar, or None if the tab does not provide a menu bar.

getSettings()
Return type:

dict

Returns:

A dictionary of settings that should be stored and restored as part of a tab layout.

Note:

The default implementation returns an empty dictionary.

getTabTitle()
Return type:

str or None

Returns:

A specific title to use for this tab, or None to use a title that matches the type of the tab.

on_animation_finished()

Slot that is called when the animation for hiding the deprecation warning frame has finished.

Removes the deprecation warning frame from the tab’s layout and deletes it.

on_dismissButton_clicked()

Slot that is called when the B{Dismiss} button in the deprecation warning frame has been clicked.

Adds the title of this type of tab to the list of titles of tabs whose deprecation warnings have been dismissed that is stored in the user’s preferences.

on_replaceTabButton_clicked()

Slot that is called when the B{Replace} button has been clicked.

Replaces this tab with a tab of the type by which this type of tab has been deprecated.

showEvent(event)

Event handler for widget show events.

Parameters:

event (QtGui.QShowEvent) – An object containing details about the widget show event to process.

tabClosed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.