def setup_subreddit_content_list(self):
"""Sets up the subreddit content list with content that is in the currently selected subreddits directory"""
self.subreddit_content_list.clear()
try:
folder_name = '%s%s/' % (self.current_sub.save_path, self.current_sub.name.lower())
self.picture_list = self.extract_pictures(folder_name)
if len(self.picture_list) > 0:
for file in self.picture_list:
path, text = file.rsplit('/', 1)
item = QtWidgets.QListWidgetItem()
icon = QtGui.QIcon()
pixmap = QtGui.QPixmap(file).scaled(QtCore.QSize(500, 500), QtCore.Qt.KeepAspectRatio)
icon.addPixmap(pixmap)
item.setIcon(icon)
item.setText(text)
self.subreddit_content_list.addItem(item)
QtWidgets.QApplication.processEvents()
except FileNotFoundError:
self.subreddit_content_list.addItem('No content has been downloaded for this subreddit yet')
SubredditSettingsDialog.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录