Filterable Popup Buttons¶
Filterable popup buttons are buttons that open filterable popups when clicked.
Class Inheritance
QtWidgets.QWidget
QtWidgets.QAbstractButton
QtWidgets.QPushButton
QT4Widgets.FilterablePopupButton
UI4.Widgets.CameraPickerButton¶
- class UI4.Widgets.CameraPickerButton¶
Bases:
FilterablePopupButton
Class implementing a filterable popup button used for the selection of a light or camera from a list of available lights and cameras.
- The display mode can be set to one of the following values:
DISPLAY_CAMERAS
- Displays cameras only.DISPLAY_LIGHTS
- Displays lights only.DISPLAY_CAMERAS | DISPLAY_LIGHTS
- Displays cameras and lights.
When using
DISPLAY_CAMERAS | DISPLAY_LIGHTS
for display mode, the button’s label is displayed without a scene graph icon. This mode is used for the main camera/light selection in the Viewer tab, for example.- Variables:
DISPLAY_CAMERAS – Display mode for displaying cameras.
DISPLAY_LIGHTS – Display mode for displaying lights.
__builtins – A list of names of viewer cameras provided. Can be extended by calling the
addBuiltin()
function.
Code example:
cameraPickerButton = UI4.Widgets.CameraPickerButton() cameraPickerButton.show()
Example Screenshot:
- DISPLAY_CAMERAS = 1¶
- DISPLAY_LIGHTS = 2¶
- __init__(parent=None, flat=True, showIcon=False, specialItems=None, showBuiltIns=True, abbreviateNames=True)¶
Initializes an instance of the class.
- Parameters:
parent (
QtWidgets.QWidget
orNone
) – The widget that the new widget will become a child of, orNone
if the new widget should be owned by PyQt instead of Qt.flat (
bool
) – Flag to control whether to give the button a flat appearance.showIcon (
bool
) – Flag to control whether to display a dropdown icon next to the button’s label.specialItems (
list
orNone
) – A list of items to always display in the popup, regardless of current display mode or filter settings. A special item is a tuple of(text, pixmap)
, where text is astr
to use as the item label andpixmap
is aQtGui.QPixmap
to use for the item orNone
.showBuiltIns (
bool
) – Flag to control whether to include names of built- in cameras in the list of available cameras and lights in the popup.abbreviateNames (
bool
) – Flag to control whether to display locations of cameras and lights with abbreviated names instead of their full scene graph location names.
- addBuiltin(name)¶
Adds a built-in camera to the list of cameras in the popup, like
"persp"
,"top"
,"left"
,"front"
etc.- Parameters:
name (
str
) – The name of the camera to add to the list of cameras in the popup.
- clearBuiltins()¶
Empties the list of built-in cameras.
- dragEnterEvent(event)¶
Event handler for widget drag enter events which are passed in the
event
parameter. Is called when a drag is in progress and the mouse enters the widget.If the event is ignored, the widget won’t receive any drag move events.
- Parameters:
event (
QtGui.QDragEnterEvent
) – The object that describes the event.
- dropEvent(event)¶
Event handler for widget drop events which are passed in the
event
parameter. Is called when the drag is dropped on the widget.- Parameters:
event (
QtGui.QDropEvent
) – The object that describes the event.
- getBuiltInCameraPath(cameraName)¶
Converts a displayed camera name into the format that is passed to the viewer when the camera is chosen.
- getBuiltInNameFromPath(cameraPath)¶
Converts a camera path into the original camera name. This is the reverse operation of
getBuiltInCameraPath
.
- getBuiltIns()¶
Returns the list of build-in camera names.
- lookThrough¶
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.
- on_aboutToShow()¶
Slot that is called when the popup for the camera picker button is about to be opened.
Rebuilds the list of available items in the popup.
- on_checkbox_stateChanged(state)¶
Slot that is called when the B{Lights} or B{Cameras} check box’s state changes, i.e. whenever the user checks or unchecks it.
Rebuilds the list of available items in the popup.
- Parameters:
state (
QtCore.Qt.CheckState
) – The state of checkable items, controls, and widgets.
- on_itemChosen(value, meta)¶
Slot that is called when an item in the popup is chosen.
- Parameters:
value (
str
) – The label of the item that was chosen.meta (
tuple
) – A tuple containing the camera or light path and the type of the item that was chosen.
- on_validateLocationsCheckbox_stateChanged(state)¶
Slot that is called when the Validate Locations check box’s state changes, i.e. whenever the user checks or unchecks it.
Sets the validation state and rebuilds the list of available items in the popup.
- Parameters:
state (
QtCore.Qt.CheckState
) – The state of checkable items, controls, and widgets.
- populate()¶
Rebuilds the list of available items in the popup.
- setCameraPath(path)¶
Sets the camera or light path for the camera picker button to the given value.
- Parameters:
path (
str
) – The camera or light path to set for the camera picker button.
- setDisplayMode(displayMode)¶
Sets the display mode of the camera picker button to the given value.
- Parameters:
displayMode (
int
) – The display mode to set for the camera picker button.
- setScenegraphPixmap(pixmap)¶
Sets the icon displayed next to the button’s text to the given pixmap.
- Parameters:
pixmap (
QtGui.QPixmap
orNone
) – The pixmap to use as the button’s icon.