Skip to content

TemporaryDir

Qt Base Class: QTemporaryDir

Signature: QTemporaryDir(self) -> None QTemporaryDir(self, templateName: str) -> None

Base classes

Name Children Inherits
QTemporaryDir
PySide6.QtCore
QTemporaryDir(self) -> None

⋔ Inheritance diagram

graph TD
  1473299883344["core.TemporaryDir"]
  1473243749088["QtCore.QTemporaryDir"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473243749088 --> 1473299883344
  1473291690208 --> 1473243749088
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QTemporaryDir

Creates a unique directory for temporary use.

Source code in prettyqt\core\temporarydir.py
class TemporaryDir(QtCore.QTemporaryDir):
    """Creates a unique directory for temporary use."""

    def __getattr__(self, attr: str):
        return getattr(self.to_path(), attr)

    def __repr__(self):
        return get_repr(self, self.path())

    def __str__(self):
        return self.path()

    def __bool__(self):
        return self.isValid()

    def __fspath__(self) -> str:
        return self.path()

    def __truediv__(self, other: datatypes.PathType) -> pathlib.Path:
        current = pathlib.Path(self.path())
        return current / os.fspath(other)
        # new = current / other
        # if new.suffix == "":
        #     return core.Dir(new)
        # else:
        #     return core.File(new)

    def to_path(self) -> pathlib.Path:
        return pathlib.Path(self.path())