def thumbnail(self, widget: QWidget): GUIUtilities.clear_layout(self.thumbnail_layout) widget.setCursor(QtCore.Qt.PointingHandCursor) app: QApplication = QApplication.instance() curr_theme = "dark" if app: curr_theme = app.property("theme") widget.setStyleSheet(self.unselected_style[curr_theme]) self.thumbnail_layout.addWidget(widget)
def update(self) -> None: GUIUtilities.clear_layout(self) if self.widgets and len(self.widgets) > 0: row = col = 0 n = max(len(self.widgets), self.cols) for idx in range(n): self.setColumnStretch(col, 1) self.setRowStretch(row, 1) if idx < len(self.widgets): widget = self.widgets[idx] self.addWidget(widget, row, col) else: self.addWidget(QWidget(), row, col) col += 1 if col % self.cols == 0: row += 1 col = 0
def clear(self): GUIUtilities.clear_layout(self) # clear the gridlayout