mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-30 23:08:25 +02:00
[ui] ThumbnailCache: use QStandardPath for default cache dir
This commit is contained in:
parent
cd955893e3
commit
268f608344
1 changed files with 3 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
from meshroom.common import Signal
|
from meshroom.common import Signal
|
||||||
|
|
||||||
from PySide2.QtCore import QObject, Slot, QSize, QUrl, Qt
|
from PySide2.QtCore import QObject, Slot, QSize, QUrl, Qt, QStandardPaths
|
||||||
from PySide2.QtGui import QImageReader, QImageWriter
|
from PySide2.QtGui import QImageReader, QImageWriter
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -19,9 +19,7 @@ class ThumbnailCache(QObject):
|
||||||
Since creating thumbnails can be long (as it requires to read the full image from disk)
|
Since creating thumbnails can be long (as it requires to read the full image from disk)
|
||||||
it is performed asynchronously to avoid blocking the main thread.
|
it is performed asynchronously to avoid blocking the main thread.
|
||||||
|
|
||||||
The default cache location is a subdirectory of the user's home directory:
|
The default cache location can be overriden with the MESHROOM_THUMBNAIL_DIR environment variable.
|
||||||
~/Meshroom/thumbnails.
|
|
||||||
This location can be overriden with the MESHROOM_THUMBNAIL_DIR environment variable.
|
|
||||||
|
|
||||||
This class also takes care of cleaning the thumbnail directory,
|
This class also takes care of cleaning the thumbnail directory,
|
||||||
i.e. scanning this directory and removing thumbnails that have not been used for too long.
|
i.e. scanning this directory and removing thumbnails that have not been used for too long.
|
||||||
|
@ -38,7 +36,7 @@ class ThumbnailCache(QObject):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Thumbnail cache directory
|
# Thumbnail cache directory
|
||||||
thumbnailDir = os.path.join(Path.home(), 'Meshroom', 'thumbnails')
|
thumbnailDir = os.path.join(QStandardPaths.writableLocation(QStandardPaths.CacheLocation), 'Meshroom', 'thumbnails')
|
||||||
|
|
||||||
# Thumbnail dimensions limit (the actual dimensions of a thumbnail will depend on the aspect ratio)
|
# Thumbnail dimensions limit (the actual dimensions of a thumbnail will depend on the aspect ratio)
|
||||||
thumbnailSize = QSize(100, 100)
|
thumbnailSize = QSize(100, 100)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue