def mkButtons(self, nodes): # Remove+delete previous children layout = self.layout() for i in reversed(range(layout.count())): layout.itemAt(i).widget().setParent(None) if not nodes: return parent = nodes[0].parent if parent is not None: action = QAction("↑", self) action.setFont(self.font) action.triggered.connect( partial(self.showNode, parent.parent, direction="up")) action.setProperty("isMode", True) self.addAction(action) # Make separator pipe label = QAction("|", self) label.setFont(self.font) label.setDisabled(True) self.addAction(label) # Loop over each "GUIPlugin" plugin for node in reversed(list(nodes)): action = QAction(node.name, self) action.triggered.connect( partial(self.showNode, node, direction="down")) action.setFont(self.font) action.setProperty("isMode", True) action.setCheckable(True) action.setActionGroup(self.GUIPluginActionGroup) self.addAction(action) # Make separator pipe label = QAction("|", self) label.setFont(self.font) label.setDisabled(True) self.addAction(label) # Remove last separator if self.layout().count(): self.layout().takeAt( self.layout().count() - 1).widget().deleteLater() # Delete the last pipe symbol if parent is not None: # Make separator pipe label = QAction(">", self) label.setFont(self.font) label.setDisabled(True) self.addAction(label) action = QAction(parent.name, self) action.setFont(self.font) action.setProperty("isMode", True) action.setDisabled(True) action.setActionGroup(self.GUIPluginActionGroup) self.addAction(action) self.fadeIn()