def __init__(self, executor, parent=None): super(CommandViewer, self).__init__(parent=parent) self.executor = executor layout = QtWidgets.QVBoxLayout(self) self.scrollWidget = QtWidgets.QScrollArea(self) layout.addWidget(self.scrollWidget) scrollLayout = QtWidgets.QVBoxLayout(self) self.scrollWidget.setLayout(scrollLayout) self.listWidget = QtWidgets.QListWidget(self) scrollLayout.addWidget(self.listWidget) self.setLayout(layout) self.setup()
def initUI(self): self.mainLayout = QtWidgets.QVBoxLayout(self) self.scrollArea = QtWidgets.QScrollArea(parent=self) self.scrollArea.setWidgetResizable(True) self.scrollArea.setFrameStyle(QtWidgets.QFrame.NoFrame) self.scrollArea.setFrameShadow(QtWidgets.QFrame.Plain) self.scrollWidget = QtWidgets.QWidget() self.scrollLayout = flowlayout.FlowLayout() self.scrollWidget.setLayout(self.scrollLayout) self.scrollArea.setWidget(self.scrollWidget) self.mainLayout.addWidget(self.scrollArea) self.setLayout(self.mainLayout) for i in iconlib.Icon.iconCollection: colorRandom = (random.randrange(0, 255), random.randrange(0, 255), random.randrange(0, 255)) btn = QtWidgets.QToolButton(parent=self) icon = iconlib.Icon.iconColorized(i, size=256, color=colorRandom) btn.setIcon(icon) btn.setText(i) btn.clicked.connect(self.copyNameToClipboard) self.scrollLayout.addWidget(btn)