Skip to content

LockFile

Qt Base Class: QLockFile

Signature: QLockFile(self, fileName: str) -> None

Base classes

Name Children Inherits
QLockFile
PySide6.QtCore
QLockFile(self, fileName: str) -> None

⋔ Inheritance diagram

graph TD
  1473299873584["core.LockFile"]
  1473243833024["QtCore.QLockFile"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473243833024 --> 1473299873584
  1473291690208 --> 1473243833024
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QLockFile

Locking between processes using a file.

Source code in prettyqt\core\lockfile.py
class LockFile(QtCore.QLockFile):
    """Locking between processes using a file."""

    def __init__(self, path: datatypes.PathType):
        super().__init__(os.fspath(path))

    def get_error(self) -> LockErrorStr:
        return LOCK_ERROR.inverse[self.error()]

    @contextlib.contextmanager
    def lock_file(self):
        self.lock()
        yield self
        self.unlock()