本文整理汇总了Python中PySide.QtCore.QDir.setFilter方法的典型用法代码示例。如果您正苦于以下问题:Python QDir.setFilter方法的具体用法?Python QDir.setFilter怎么用?Python QDir.setFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtCore.QDir
的用法示例。
在下文中一共展示了QDir.setFilter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import setFilter [as 别名]
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setupUi(self)
self.settings = QSettings(QSettings.IniFormat, QSettings.UserScope, COMPANY, APPNAME)
self.restoreGeometry(self.settings.value(self.__class__.__name__))
self.images = []
if len(sys.argv) > 1:
d = QDir(path=sys.argv[1])
else:
d = QDir(path=QFileDialog.getExistingDirectory())
d.setNameFilters(['*.png'])
d.setFilter(QDir.Files or QDir.NoDotAndDotDot)
d = QDirIterator(d)
images = []
while d.hasNext():
images.append(d.next())
for i in images:
print i
self.images = [QImage(i) for i in images]
self.images += [crop_image_from_file(i, 50)[0] for i in images]
示例2: pack
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import setFilter [as 别名]
def pack(directory, quiet, algorithm, size):
cprint('working directory {}'.format(directory), color='green')
cprint('quiet {}'.format(quiet), color='green')
cprint('algorithm {}'.format(algorithm), color='green')
cprint('size {}'.format(size))
folder = QDir(path=directory)
folder.setNameFilters(['*.png'])
folder.setFilter(QDir.Files or QDir.NoDotAndDotDot)
dit = QDirIterator(folder, flags=QDirIterator.Subdirectories, filters=QDir.Files)
filenames = []
while dit.hasNext():
im = folder.relativeFilePath(dit.next())
if not re.search('atlas', im):
filenames.append(im)
images = [Image(directory, filename) for filename in filenames]
BinPacking.bin_packing_progress = MyBinPackingProgress()
bin_packer = FirstFitShelfBinPacking(Size(2048, 2048), images, bin_parameters={})
bin_packer.saveAtlases(directory)
print ''
示例3: harvestDirectory
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import setFilter [as 别名]
def harvestDirectory(self, directory):
folder = QDir(path=directory)
folder.setNameFilters(["*.png"])
folder.setFilter(QDir.Files or QDir.NoDotAndDotDot)
dit = QDirIterator(folder, flags=QDirIterator.Subdirectories, filters=QDir.Files)
while dit.hasNext():
im = folder.relativeFilePath(dit.next())
if not re.search("atlas", im):
self.images.append(im)
self.bin_packing_thread.setDirectory(self.directory)
self.bin_packing_thread.setImages(self.images)
self.updateImages(self.images)
示例4: open_folder
# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import setFilter [as 别名]
def open_folder(self):
self.imagesList.clear()
if not self.current_directory:
self.current_directory = QFileDialog.getExistingDirectory(parent=self,
caption=u'Add images from directory')
folder = QDir(self.current_directory)
folder.setNameFilters(['*.png'])
folder.setFilter(QDir.Files or QDir.NoDotAndDotDot)
dir_iterator = QDirIterator(folder, flags=QDirIterator.Subdirectories, filters=QDir.Files)
images = []
while dir_iterator.hasNext():
images.append(folder.relativeFilePath(dir_iterator.next()))
self.white_albatross.addImages(folder, images)
self.imagesList.addItems(images)