Skip to content

fix resolution info #550 #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tagstudio/src/core/media_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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(
Expand Down
10 changes: 2 additions & 8 deletions tagstudio/src/qt/widgets/preview_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,7 @@ def update_widgets(self) -> bool:
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:
Expand Down Expand Up @@ -668,7 +662,7 @@ def update_widgets(self) -> bool:
# 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
Expand Down