StorageInfo
Base classes
| Name |
Children |
Inherits |
QStorageInfo PySide6.QtCore QStorageInfo(self, /) -> None |
|
|
⋔ Inheritance diagram
graph TD
844274742["core.StorageInfo"]
633226691["QtCore.QStorageInfo"]
37984305["Shiboken.Object"]
2751680898["builtins.object"]
633226691 --> 844274742
37984305 --> 633226691
2751680898 --> 37984305
🛈 DocStrings
Bases: QStorageInfo
Provides information about currently mounted storage and drives.
Source code in prettyqt/core/storageinfo.py
| class StorageInfo(QtCore.QStorageInfo):
"""Provides information about currently mounted storage and drives."""
def __init__(
self,
path: QtCore.QStorageInfo | QtCore.QDir | datatypes.PathType | None = None,
):
if path is None:
super().__init__()
else:
if isinstance(path, os.PathLike):
path = os.fspath(path)
super().__init__(path)
def __bool__(self):
return self.isValid()
def __repr__(self):
return get_repr(self, self.rootPath())
def get_device(self) -> str:
return bytes(self.device().data()).decode()
def get_file_system_type(self) -> str:
return bytes(self.fileSystemType().data()).decode()
def get_subvolume(self) -> str:
return bytes(self.subvolume().data()).decode()
def get_root_path(self) -> pathlib.Path:
return pathlib.Path(self.rootPath())
@classmethod
def get_root(cls) -> Self:
return cls(cls.root())
@classmethod
def get_mounted_volumes(cls) -> list[Self]:
return [cls(i) for i in cls.mountedVolumes()]
|
:fa-brands-github: Show source on GitHub