本文整理匯總了Python中PyQt4.QtGui.QImageReader.setFileName方法的典型用法代碼示例。如果您正苦於以下問題:Python QImageReader.setFileName方法的具體用法?Python QImageReader.setFileName怎麽用?Python QImageReader.setFileName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtGui.QImageReader
的用法示例。
在下文中一共展示了QImageReader.setFileName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_archive_wallpapers
# 需要導入模塊: from PyQt4.QtGui import QImageReader [as 別名]
# 或者: from PyQt4.QtGui.QImageReader import setFileName [as 別名]
def get_archive_wallpapers(self):
"""
Generator returning the date, path and copyright info (via db lookup) of each file found in the
archive location.
:rtype: QDate, unicode, unicode
"""
image_reader = QImageReader()
regex_date_split = re.compile(r'(\d{4})(\d{2})(\d{2})')
copyright_info = self.copyright_db.get_all_info()
archive_folder = self.settings.archive_location
for filename in reversed([x for x in os.listdir(archive_folder) if re_archive_file.match(x)]):
year, month, day = map(int, regex_date_split.findall(filename)[0])
wallpaper_date = QDate(year, month, day)
wallpaper_copyright = copyright_info.get('{0:04d}-{1:02d}-{2:02d}'.format(year, month, day), '')
wallpaper_filename = os.path.join(unicode(archive_folder), filename)
image_reader.setFileName(wallpaper_filename)
image_size = image_reader.size()
image_size.scale(QSize(200, 125), Qt.IgnoreAspectRatio)
image_reader.setScaledSize(image_size)
thumbnail_image = image_reader.read()
if thumbnail_image.isNull():
continue
self.lw_wallpaper_history.add_item(thumbnail_image, wallpaper_date, wallpaper_copyright,
archive_path=wallpaper_filename)
self.app.processEvents()
self.lw_wallpaper_history.sortItems(Qt.AscendingOrder)