当前位置: 首页>>代码示例>>Python>>正文


Python QDir.setNameFilters方法代码示例

本文整理汇总了Python中PySide.QtCore.QDir.setNameFilters方法的典型用法代码示例。如果您正苦于以下问题:Python QDir.setNameFilters方法的具体用法?Python QDir.setNameFilters怎么用?Python QDir.setNameFilters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtCore.QDir的用法示例。


在下文中一共展示了QDir.setNameFilters方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import setNameFilters [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]
开发者ID:Ingener74,项目名称:Silly-Crossbow,代码行数:31,代码来源:AberrantTiger.py

示例2: pack

# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import setNameFilters [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 ''
开发者ID:Ingener74,项目名称:Small-Screwdriver,代码行数:29,代码来源:SundaysIron.py

示例3: harvestDirectory

# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import setNameFilters [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)
开发者ID:Ingener74,项目名称:Small-Screwdriver,代码行数:14,代码来源:ScreamingMercury.py

示例4: open_folder

# 需要导入模块: from PySide.QtCore import QDir [as 别名]
# 或者: from PySide.QtCore.QDir import setNameFilters [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)
开发者ID:Ingener74,项目名称:White-Albatross,代码行数:21,代码来源:GhastlyLion.py


注:本文中的PySide.QtCore.QDir.setNameFilters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。