Ejemplo n.º 1
0
def checkDirsQt():
    it = Core.QDirIterator(BASEDIR, Core.QDirIterator.Subdirectories)
    while it.hasNext():
        this = Core.QFile(it.next())
        info = Core.QFileInfo(this)
        if info.suffix() == "iso":
            print(info.absolutePath())
Ejemplo n.º 2
0
    def _generator_find_images(self, valid_ext_list=None):
        """
        Iterate over the ":" path.  In Qt this is the loaded resources path
        when an item is found that matches the ``valid_ext_list`` it is yielded

        Notes:
            You don't call this directly, use ``build_img_dict``

        Args:
            valid_ext_list (list[str]): a list of valid extension strings, must start with a "." as in ".png".
            this is an optional argument, if no list is provided, the default list is loaded from the configuration file

        Yields:
            str: the next found path string
        """
        if not valid_ext_list:
            valid_ext_list = self.config["valid_ext"]

        if not isinstance(valid_ext_list, list):
            raise ValueError("You must provide a list of valid extensions")

        if not all(x.startswith(".") for x in valid_ext_list):
            raise ValueError("all extensions in valid_ext_list must start with a '.' ")

        it = QtCore.QDirIterator(":", QtCore.QDirIterator.Subdirectories)
        while it.hasNext():
            next_item = it.next()

            if any(next_item.startswith(x) for x in self.config["path_exclusions"]):
                continue

            if any(next_item.endswith(ext) for ext in valid_ext_list):
                yield next_item
Ejemplo n.º 3
0
    def loadfile_rand(self, folder):
        file_list = []
        it = QtCore.QDirIterator(folder, ['*.rpt', '*.csv'], QtCore.QDir.Files)
        while it.hasNext():
            file_list.append(it.next())

        from random import choice
        self.loadfile(choice(file_list))
Ejemplo n.º 4
0
    def findPages(self):
        ui_files = []
        cnt = 1

        while len(ui_files) < 15:
            it = QtCore.QDirIterator(":/wizardUI")
            while it.hasNext():
                filename = it.next()
                name = QtCore.QFileInfo(filename).fileName()
                if name.startswith("{}.".format(cnt)):
                    ui_files.append(filename)
                    cnt += 1

        return ui_files