def wallpaperSelectDialog(self): file_url, file_type = QFileDialog.getOpenFileName(self, self.tr("Choose wallpaper"), QDir.homePath(), "Image (*.png *.jpg)") print(file_url) if not "" == file_url: self.selectWallpaper = file_url item = QListWidgetItem(self.listWidget) item.setIcon(QIcon(file_url)) item.screenshotPath = file_url item.userSelect = True self.listWidget.setCurrentItem(item)
def wallpaperSelectDialog(self): file_url, file_type = QFileDialog.getOpenFileName(self, self.tr("Choose wallpaper"), QDir.homePath(), "Image (*.png *.jpg)") print(file_url) if not "" == file_url: self.selectWallpaper = file_url item = QListWidgetItem(self.listWidget) item.setIcon(QIcon(file_url)) item.screenshotPath = file_url item.userSelect = True self.listWidget.setCurrentItem(item)
def wallpapersParser(self): wallpaperPath = "/usr/share/wallpapers" for folder in os.listdir(wallpaperPath): path = join(wallpaperPath,folder, "contents") thumbFolder = os.listdir(path) for thumb in thumbFolder: if thumb.startswith("scre"): item = QListWidgetItem(self.listWidget) pix = QPixmap(join(path, thumb)) pix = pix.scaled(QSize(240, 140), Qt.IgnoreAspectRatio, Qt.FastTransformation) item.setIcon(QIcon(pix)) item.setSizeHint(QSize(250, 150)) item.screenshotPath = join(path, thumb)
def wallpapersParser(self): wallpaperPath = "/usr/share/wallpapers" for folder in os.listdir(wallpaperPath): path = join(wallpaperPath,folder, "contents") thumbFolder = os.listdir(path) for thumb in thumbFolder: if thumb.startswith("scre"): item = QListWidgetItem(self.listWidget) pix = QPixmap(join(path, thumb)) pix = pix.scaled(QSize(240, 140), Qt.IgnoreAspectRatio, Qt.FastTransformation) item.setIcon(QIcon(pix)) item.setSizeHint(QSize(250, 150)) item.screenshotPath = join(path, thumb)