當前位置: 首頁>>代碼示例>>Python>>正文


Python QDir.setFilter方法代碼示例

本文整理匯總了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]
開發者ID:Ingener74,項目名稱:Silly-Crossbow,代碼行數:31,代碼來源:AberrantTiger.py

示例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 ''
開發者ID:Ingener74,項目名稱:Small-Screwdriver,代碼行數:29,代碼來源:SundaysIron.py

示例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)
開發者ID:Ingener74,項目名稱:Small-Screwdriver,代碼行數:14,代碼來源:ScreamingMercury.py

示例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)
開發者ID:Ingener74,項目名稱:White-Albatross,代碼行數:21,代碼來源:GhastlyLion.py


注:本文中的PySide.QtCore.QDir.setFilter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。