def addNodeWidget(self, node: Node, **kwargs: Any) -> None: """ Add a node widget as dock. :param node: node for which to add the widget. :keyword arguments: * *visible* (`bool`; default: taken from widget class definition) -- whether the widget is visible from the start * *dockArea* (`QtCore.Qt.DockWidgetArea`; default: taken from class) -- where the dock widget initially sits in the window * *icon* (`QtCore.QIcon`; default: taken from class) -- an icon to use for the toolbar """ if node.useUi and node.ui is not None and node.uiClass is not None: dockArea = kwargs.get('dockArea', node.ui.preferredDockWidgetArea) visible = kwargs.get('visible', node.uiVisibleByDefault) icon = kwargs.get('icon', node.ui.icon) d = QtWidgets.QDockWidget(node.name(), self) d.setWidget(node.ui) self.nodeWidgets[node.name()] = d self.addDockWidget(dockArea, d) action = d.toggleViewAction() if icon is not None: action.setIcon(icon) self.nodeToolBar.addAction(action) if not visible: d.close()
def addNodeWidget(self, node: Node): """ Add a node widget as dock. :param node: node for which to add the widget. :return: """ if node.useUi and node.uiClass is not None: d = QtGui.QDockWidget(node.name(), self) d.setWidget(node.ui) self.nodeWidgets[node.name()] = d self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, d)