mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-01-29 06:10:51 +00:00
* fix resolution info * Fix for Raw and Vector Image types * Small refactor * Create IMAGE_RASTER_TYPES and remove is_image_ext_raster * Change if statment only for raster * Rename _IMAGE_SET to _IMAGE_RASTER_SET --------- Co-authored-by: gred <gred25@yandex.ru>
This commit is contained in:
@@ -207,7 +207,7 @@ class MediaCategories:
|
||||
".rw2",
|
||||
}
|
||||
_IMAGE_VECTOR_SET: set[str] = {".svg"}
|
||||
_IMAGE_SET: set[str] = {
|
||||
_IMAGE_RASTER_SET: set[str] = {
|
||||
".apng",
|
||||
".avif",
|
||||
".bmp",
|
||||
@@ -392,9 +392,14 @@ class MediaCategories:
|
||||
extensions=_IMAGE_VECTOR_SET,
|
||||
is_iana=False,
|
||||
)
|
||||
IMAGE_RASTER_TYPES: MediaCategory = MediaCategory(
|
||||
media_type=MediaType.IMAGE,
|
||||
extensions=_IMAGE_RASTER_SET,
|
||||
is_iana=False,
|
||||
)
|
||||
IMAGE_TYPES: MediaCategory = MediaCategory(
|
||||
media_type=MediaType.IMAGE,
|
||||
extensions=_IMAGE_SET | _IMAGE_RAW_SET | _IMAGE_VECTOR_SET,
|
||||
extensions=_IMAGE_RASTER_SET | _IMAGE_RAW_SET | _IMAGE_VECTOR_SET,
|
||||
is_iana=True,
|
||||
)
|
||||
INSTALLER_TYPES: MediaCategory = MediaCategory(
|
||||
|
||||
@@ -625,13 +625,7 @@ class PreviewPanel(QWidget):
|
||||
self.preview_gif.show()
|
||||
|
||||
image = None
|
||||
if (
|
||||
MediaCategories.is_ext_in_category(ext, MediaCategories.IMAGE_TYPES)
|
||||
and MediaCategories.is_ext_in_category(ext, MediaCategories.IMAGE_RAW_TYPES)
|
||||
and MediaCategories.is_ext_in_category(
|
||||
ext, MediaCategories.IMAGE_VECTOR_TYPES
|
||||
)
|
||||
):
|
||||
if MediaCategories.is_ext_in_category(ext, MediaCategories.IMAGE_RASTER_TYPES):
|
||||
image = Image.open(str(filepath))
|
||||
elif MediaCategories.is_ext_in_category(ext, MediaCategories.IMAGE_RAW_TYPES):
|
||||
try:
|
||||
@@ -668,7 +662,7 @@ class PreviewPanel(QWidget):
|
||||
# Stats for specific file types are displayed here.
|
||||
if image and (
|
||||
MediaCategories.is_ext_in_category(
|
||||
ext, MediaCategories.IMAGE_TYPES, mime_fallback=True
|
||||
ext, MediaCategories.IMAGE_RASTER_TYPES, mime_fallback=True
|
||||
)
|
||||
or MediaCategories.is_ext_in_category(
|
||||
ext, MediaCategories.VIDEO_TYPES, mime_fallback=True
|
||||
|
||||
Reference in New Issue
Block a user